Player ------ This is a tiny `Click'n'Run' tool I wrote some time ago. It `executes' any kind of file according to the information found in ~/.mime.types and ~/.mailcap. The idea is certainly not original, and there are lots of other tools doing the same or more, but I love the tool as it is. The `Open' button pops up a file dialogue. After selecting a file, the program selects the appropriate MIME type according to your .mime.types file, and then executes the appropriate display utility according to your .mailcap. The `Sync' button re-reads ~/.mime.types and ~/.mailcap in case they have changed and is quite useful for testing purposes. If you don't need the button, hack the source. The `Quit' button should be self-explanatory. You can enter arbitrary commands in the field above the buttons, which are executed when you hit Return. Whenever a command is executed, a new button is created to give information about which programs are currently controlled by the process. You can simply click on such a button to terminate the associated program. Any output is captured and displayed in text widgets. Because I use the file dialog provided by Tk 4.2, you need Tcl 7.6 to run `player'. See the source for more information. You are free to edit the source and change anything, but give me credit when you pass it on, please. The ~/.mime.types file ---------------------- This file maps a file's extension (the text after the last `.') to a MIME type. Empty lines and those beginning with `#' are ignored. Other lines have two or more whitespace-separated columns, where the first gives the MIME type, and the other columns give extensions to be mapped to that type. I have included my .mime.types file (with the leading dot removed). If you want to use it, do a `cp mime.types ~/.mime.types'. For more information about MIME types. see the metamail documentation or RFC1522. The ~/.mailcap file ------------------- This file defines now to (dis)play the various kinds of files. Empty lines and those beginning with `#' are ignored. Other lines must consist of two or three columns separated by a semicolon `;' and surrounding whitespace. The first column gives a pattern which is matched against the MIME type of the given file, using glob-style matching (with the wildcards `?' and `*'). The second column gives a command to execute. If an `%s' appears, it is replaced with the full path name to the file in question. A `%t' is replaced with the MIME type for the file according to .mime.types. Two double quotes `""' are replaced with a single `%' character. If no `%s' appears in the command name, the file in question is pro- vided to the executed program as standard input. The third column is optional and may give options. The only option currently understood is `needsterminal'. If this option is given, the program is executed in its own xterm. I have included my .mailcap file (with the leading dot removed). If you want to use it, do a `cp mailcap ~/.mailcap'. For more information, see the metamail documentation (try man mailcap). Example ------- A short ~/.mime.types: image/jpeg jpeg jpg A short ~/.mailcap: image/*; xv %s Now if you click on `Open' and select a file with the extension `.jpg', the entry in .mime.types identifies the file as a JPEG image. Next, the associated MIME type, `image/jpeg' is matched against the entry in .mailcap, and the result is that the image will be displayed using `xv'. Notes ----- Because this is not exactly a killer application and I do not think that it will find wide distribution, I have not put too much effort in handling failure cases, or documentation, for that matter. I hope you will find the tool useful anyway, and if it does something you don't like, patch it!