<<< Date Index >>>     <<< Thread Index >>>

Re: Mailcap question



On 18Jun2006 17:16, Leonardo Caldas <leonardo.caldas@xxxxxxxxx> wrote:
| I'd like to know wheter is possible or not when seeing an attached file, put
| it in background and keep normally seeing the other msgs.
| 
| For example:
| 
| I got this in my mailcap refering to mp3 files:
| 
| audio/mpeg; mpg321 -d esd '%s' > /dev/null & sleep 5; description="MP3 Audio 
File"
| 
| The desired behavior is when opening an attached mp3 file in a msg, it
| will call the desired application, start to play the file and free
| the prompt, so that i could go see other messages, or even see another
| attached files. And of course, the same going with pictures (opening
| display - or whatever is my favorite picture viewer - and being
| possible to keep the file open while seeing other messages) and other
| types of files...
| 
| I've already seen a couple of sources (mutt wiki and freenode's #Mutt
| included), but I got no help. Thanks in advance for your help.

It should work. Bear in mind that you need two types of mailcap entries
in mutt. One should have the "copiousoutput" keyword; this is the entry
that will be used to process the file in the "message display" mode.
The entry without that keyword is used to open the file from the
attachments menu.

For example, my image/jpeg lines are like this:

  image/jpeg; ah %s -end xv; gui
  image/jpeg; noui iminfo %s; copiousoutput

The second one recites a little information about the JPEG file in-line in
the message text when I view the message (size, etc).

The first one is used when I open the jpeg in the attachments menu.  You can
ignore the "gui" keyword; it's one of my own that one of my scripts uses when
it really wants a GUI app.

Now, "ah" is a handler script of mine that kicks off an image viewer (for
JPEGs, anyway) and also offers to save the file. You want mpg123 for you case
I expect.

For your needs you would do exactly as you have, with some changes:

  audio/mpeg; mpg321 -d esd %s >/dev/null 2>&1 </dev/null & ; description="MP3 
Audio File"
  audio/mpeg; ls -ldh -- %s; copiousoutput description="MP3 Audio File"

Notice that we have closed stdin (just in case) and also sent standard error
to /dev/null. (BTW, why the "sleep 5"?)

Also, you should not need the quotes - "%s" is supposed to be replaced
with a shell-safe  filename, so mutt should be putting in quotes
if necessary (in practice it does not, because it refuses to create
filenames which would need quoting).

Now, in spite of all this, I would have expected your mailcap line to
work. Can you go into some detail about how it fails?
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

I suppose the solution would be to close the composition window and let
my article sit for half an hour or so once I've finished with it, and
then go back and proofread it once more.  But that would be a pain in
the proverbial bifurcated derriere.  Part of the experience of flaming is
to load a searing missive into the conceptual breech of my SPARCcannon
and pull the imaginary lanyard whilst flushed with the adrenaline of mortal
combat.
        - Geoff Miller, <geoffm@xxxxxxxxxxxxxxxxxxxxxxx>