mplayer "ice3.somafm.com/spacestation-3" | stdbuf -o L grep "^ICY Info: StreamTitle=" | while read line; do stream=`echo $line | cut -d\' -f2`; len=$((`echo $stream | wc -c`+4)); Xdialog --infobox "$stream" 5 $len 10000; done

A few days ago, I used this shell one-liner to listen to Space Station Soma, and whenever the stream switched to a new tune, pop up a window showing what it was.

Instead of popping up randomly, I wanted to flesh it out so I could call up a pop-up whenever.

long mplayer stuff 

Also, you can control mplayer with or without a terminal window if you do this:

mkdir -p $HOME/.mplayer

mkfifo $HOME/.mplayer/fifo

echo "input=file=/home/you/.mplayer/fifo" >> $HOME/.mplayer/config

Then, while mplayer's running,

Quit mplayer:
echo quit > $HOME/.mplayer/fifo

Pause/resume mplayer:
echo pause > $HOME/.mplayer/fifo

Play next file/stream:
echo pt_step 1 > $HOME/.mplayer/fifo

Play previous file/stream:
echo pt_step -1 > $HOME/.mplayer/fifo

Follow

Anyway, back to streams & pop-ups, I fleshed it out into two shellscripts & commented the heck out of them.

I listen to radio streams at work with one script, $HOME/bin/radio: pastebin.com/rPsrKP94

And find out what's playing with another, $HOME/bin/radio-xsonginfo: pastebin.com/DHx7TraQ

Sign in to participate in the conversation
Computer Fairies

Computer Fairies is a Mastodon instance that aims to be as queer, friendly and furry as possible. We welcome all kinds of computer fairies!