r="readlink /proc/`pgrep -o mplayer`/fd/3";while [ -e "`$r`" ];do if [ "$f" = "`$r`" ];then sleep 1;else f="`$r`";notify-send " $f";fi;done

Makes mplayer show file played through libnotify, 140 characters

Will finish automagically when mplayer quits. Can be run from any directory. It seems to finish by it self rarely, probably because of some timing issue? There's probably a way around that which I can't think of right now
Sample Output
(in OSD): /home/aix/Music/Chrispin Glover - Clowny Clown Clown.flac

0
By: aix
2012-02-26 06:49:16

These Might Interest You

  • A function for streaming youtube to mplayer. The option "-g" for youtube-dl tells it to output the direct video URL, instead of downloading the video. "-fs" tells MPlayer to go FullScreen, and "-quit" makes it less verbose. Requires: youdube-dl ( http://bitbucket.org/rg3/youtube-dl/ ) (Tested in zsh) Show Sample Output


    15
    yt () mplayer -fs -quiet $(youtube-dl -g "$1")
    elfreak · 2010-09-29 18:48:19 12
  • mplayer -vo caca will give you a similar result but in color


    1
    Play "foo.mpg" in your terminal using ASCII characters
    chrisclymer · 2009-02-20 22:12:14 1
  • You will need libnotify-bin for this to work: sudo aptitude install libnotify-bin


    24
    ./my-really-long-job.sh && notify-send "Job finished"
    root · 2009-05-07 15:50:27 3
  • You wont hear anything when you run that command. You must run: mplayer music.mp3 YOU NEED MPLAYER sudo apt-get install mplayer


    0
    mplayer -cache 100 -dumpstream http://listen.di.fm/public3/drumandbass.pls -dumpfile music.mp3
    TheShadowFog · 2011-11-08 15:36:33 0
  • Ever compress a file for the web by replacing all newline characters with nothing so it makes one nice big blob? It is a great idea, however what about when you want to edit that file? ...Serious pain in the butt. I ran into this today in that my only copy of a CSS file was "compressed" with no newlines. I whipped this up and it converted back into nice human readable CSS :-) It could be nicer, but it does the job.


    1
    cat somefile.css | awk '{gsub(/{|}|;/,"&\n"); print}' >> uncompressed.css
    lrvick · 2009-06-02 15:51:51 5
  • Sometimes audio and video are not sync'ed. The factor 1.0884 is the quotient 48000/44100. One mplayer plays the audio file in the background, the other the video in the foreground. You can dump the audio file before with another commandlinefu Show Sample Output


    1
    mplayer test.mp3 < /dev/null & mplayer test.avi -nosound -speed 1.0884
    fxj · 2009-10-31 09:33:33 0

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: