30 September, 2009

Using mplayer as alarm in linux

Some time ago my stereo died, so I started to use my PC as alarm (I like to listen some music during wake-up). For some time I used it in this way:
echo "mplayer -ao alsa -shuffle /docs/music/unsorted/*" | at 10:00

"-shuffle" option makes mplayer to play files in random order.
Everything worked fine, but some time ago I didn't here my sweet alarm. I wasn't able to figure out the reason, so asked at #mplayer. Lobs suggested to use "-noconsolecontrols" option to fix it and it helped. Also "-really-quiet" option can be useful if you don't want at to produce big mails with mplayer's output. I guess it can be also useful for using mplayer with cron.
So the final solution is:
echo "mplayer -ao alsa -noconsolecontrols -really-quiet -shuffle /docs/music/unsorted/*" | at 10:00