record music from last.fm using shell-fm

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:

<pre class="src src-sh">extern = tee <span style="color: #ffa07a;">"/Users/vinh/shell-fm-saves/%a;%t;%l;%d.mpg3"</span> | 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):

<pre class="src src-C"><span style="color: #00ffff;">if</span>( <span style="color: #ff4500;">/*</span><span style="color: #ff4500;">freetrack &amp;&amp; strlen(freetrack) &gt; 0 &amp;&amp; </span><span style="color: #ff4500;">*/</span> haskey(&amp; rc, <span style="color: #ffa07a;">"download"</span>)) {

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

<pre class="src src-sh">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 <span style="color: #fa8072;">`pkg-config --libs taglib_c`</span> *.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:

<pre class="src src-sh">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

About Vinh Nguyen

Statistician

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>