Plays Music from SomaFM

read -p "Which station? "; mplayer --reallyquiet -vo none -ao sdl http://somafm.com/startstream=${REPLY}.pls
This command asks for the station name and then connects to somafm, Great for those who have linux home entertainment boxes and ssh enabled on them, just for the CLI fiends out there ( I know I'm one of them ;) Also, don't forget to add this as alias(ie alias somafm="read -p 'Which Station? "; mplayer --reallyquite -vo none -ao sdl

What Others Think

didn't understood the alias part. You say put the whole command as an alias in the .bashrc?
gadget00 · 493 weeks and 5 days ago
@gadget00 your correct, it saves from having it lost in your home directory as some random script file. Which can be a quite handy trick for these simple one liners.
denzuko · 493 weeks and 4 days ago
I added a little bit to this and turned it into a function. It provides a list of stations to listen to instead of just asking. somafm() { local station;echo "Select a station to listen to:";select station in "Doomed" "Groove Salad" "Lush" "Suburbs of Goa" "Secret Agent" "Drone Zone" "Space Station" "cliqhop idm" "Digitalis" "Sonic Universe" "Boot Liquor" "Covers" "Illinois Street Lounge" "indie pop rocks" "PopTron" "Tags Trip" "Beat Bender" "Mission Control";do station=$(echo -n "$station"|tr '[:upper:]' '[:lower:]'|sed 's/ //g');break;done;mplayer -vo none -ao sdl http://somafm.com/startstream=${station}.pls;}
eightmillion · 468 weeks and 2 days ago
@eightmillion Thanks, that helps a lot. Do you mind if I publish your version(credit and linkbacks to you included) on my blogs?
denzuko · 464 weeks and 5 days ago
neither of thes are working for me.
stealyourwife · 456 weeks and 4 days ago
Ok, i figured it out.. the --reallyquiet flag is the problem. i guess it helps to read error messages
stealyourwife · 456 weeks and 4 days ago
function version isn't working though...i saved in in a file and chmod +x somafm ...it just goes back to a prompt when i try to run it
stealyourwife · 456 weeks and 4 days ago
Function works brilliantly for me! Executing this at CLI (or in a file) simply creates the 'somafm' function. You then need to execute it: somafm
j0rg3 · 288 weeks and 2 days ago

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: