Skip to content

October 31, 2012

Recording lastfm songs with shell-fm

I listen to the last.fm radio all day at the office (it’s a lifesaver
when your workplace has quite a lot noise).

This has one good advantage: I don’t have to bring my music with me.
I dont have to worry about changing groups, nor putting anything into
“shuffle” mode, also, I really like last.fm, is a great service.

But, what happens when your network goes down, or is just too slow?

Here comes to the rescue Shell-fm.

It’s no secret I’m a big fan of the console, and no friend of graphical interfaces, but anyway, shell-fm does
a really great job.

We can configure shell-fm to execute an external program, where it will
pass the music stream… for each song, this way, we could use just
mplayer:

~/.shell-fm/shell-fm.rc:
 extern=mplayer -really-quiet -softvol -softvol-max 1000 -volume 1000
 -noconsolecontrols -demuxer lavf -lavfdopts format=mp3 -

This also puts volume 10 times louder than the max volume you usually
have!

Ok, now we have it playing on mplayer, but we wanted to download them
too, didn’t we? Well, let’s make “tee” do the trick, both tee and
mplayer are usually installed in every linux distro.

extern=tee ~/Music/%a-%t.mp3 | mplayer -really-quiet -softvol-max 100
 -volume 100 -noconsolecontrols -demuxer lavf -lavfdopts format=mp3 -

This will download your music to ~/Music/-.mp3 

Shell-fm is a powerful little thingy, you could, for example, download
all lyrics to a file, open another terminal/tmux-screen split/whatever
and do less’ it. I’m not going to extend myself on that here, but I’m using
“lyricsdownloader” script, passing the artist and song name, as with the
mplayer stuff.

np-cmd = lyricsdownloader --artist "%a" --songname "%t" 2> /dev/null > /tmp/lyrics.txt

This is my final result:

Read more from Life, Misc

Share your thoughts, post a comment.

(required)
(required)

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments