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

These Might Interest You

  • This is the alias command that I discussed in my prior release which you can add to your ~/.bashrc. 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 ;) You can find future releases of this and many more scripts at the teachings of master denzuko - denzuko.co.cc.


    -2
    alias somafm='read -p "Which station? "; mplayer --reallyquiet -vo none -ao sdl http://somafm.com/startstream=${REPLY}.pls'
    denzuko · 2009-05-05 12:13:46 0
  • Plays the sound of the file, should sound like *some* kind of music, most files sound like static but some are really cool. variations: sudo cat /dev/sda > /dev/dsp sudo cat /dev/sda5 | aplay Check out http://bbs.archlinux.org/viewtopic.php?id=70937 for more variations! semi-dupe--like http://www.commandlinefu.com/commands/view/985/generate-white-noise but with different syntax and program. Show Sample Output


    0
    sudo cat /usr/share/icons/*/*/* > /dev/dsp
    12345678 · 2009-08-06 03:12:27 0
  • An alias i made for myself to play music in a faster way. Works great when you have Guake / Tilda installed (Console that drops down like in the game QUAKE) --- I put this in my bash_alias file (I'm on ubuntu, the bash_alias file does autostart with the right config) but it works putting it in bashrc too. Or anything that autostarts when the console is opened. --- Needs Mplayer and music files to work. With out music theres nothing to play! Oh, and also, without modification, this alias will try to play stuff from your ~/Music folder! (case sensitive). Make sure that folder exists and has music OR edit this alias to fit your needs. Show Sample Output


    -2
    alias mux='clear && cd ~/Music/ && ls && echo -n "File> " && read msi && mplayer ~/Music/$msi'
    Noxn · 2009-03-23 10:45:27 0
  • The glob pattern * expands to all files, no need for the 'ls' command. The quotes around "$i" make sure filenames with spaces in them are handled correctly. mplayer determines if it is a media file and plays it, or gives errors and the loop asks if this file has to be removed. Show Sample Output


    0
    for i in *; do mplayer "$i" && rm -i "$i"; done
    warkruid · 2013-12-26 17:13:23 0

What Others Think

didn't understood the alias part. You say put the whole command as an alias in the .bashrc?
gadget00 · 476 weeks 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 · 475 weeks and 6 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 · 450 weeks and 4 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 · 446 weeks and 6 days ago
neither of thes are working for me.
stealyourwife · 438 weeks and 5 days ago
Ok, i figured it out.. the --reallyquiet flag is the problem. i guess it helps to read error messages
stealyourwife · 438 weeks and 5 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 · 438 weeks and 5 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 · 270 weeks and 4 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: