Posted by & filed under Coding.

as i mentioned before again and again, i’ve been working on to get shell-fm to record music from last.fm. originally, i was trying to get shell-fm pipe to tee to save the songs and play using madplay (or mplayer) based on this method. this worked. i just need to write scripts to post process the songs to get id3 tags, etc. things work, and i have something like this in my shell-fm.rc file:

extern = tee "/Users/vinh/shell-fm-saves/%a;%t;%l;%d.mpg3" | madplay -Q -
##extern = tee "/Users/vinh/shell-fm-saves/%a;%t;%l;%d.mpg3" | mplayer -cache 32 -


however, if u look at the end of the same page, it mentions hacking the source code because u can get shell-fm to automatically save free files, and get id3 tags on there. hopped on #shell-fm on the freenode and spoke to the author. (i tried this before but it didn’t work — reason was i didnt do a make clean first…i had residuals from the fail install since its on a mac).

now, to get shell-fm to compile with recording of every songs and get id3 tags working, just install libtag via MacPorts, modify play.c (search for freetrack and comment out that part):

if( /*freetrack && strlen(freetrack) > 0 && */ haskey(& rc, "download")) {


to compile, go in the source directory, do a make clean, then do the following on a mac:

cc -o shell-fm -D__darwin__ -Os -Wall -W -I./include/ -DLIBAO -I/opt/local/include -I/opt/local/include -L/opt/local/lib -lmad -lm -Wl,-framework -Wl,AudioUnit -L/opt/local/lib -lao -lpthread -DTAGLIB pkg-config --libs taglib_c *.c


the author helped me figure out the DTAGLIB stuff, and how to get this command originally (had to remove the main.c in the middle and change the last .a file to *.c).

did:

cp ./shell-fm /usr/bin/
cd ../manual
make
sudo shell-fm.1 /usr/share/man/man1/


now, go to ~/.shell-fm/shell-fm.rc and put in download = /Users/vinh/shell-fm-saves/%a – %t.mp3 and all completed songs will be saved WITH id3tag