Spotify Recorder

By zenx on Jun 05, 2011

Records & encodes songs from spotify to your HDD as you play them.



control_c() {
        killall -q arecord lame
        exit 0

trap control_c SIGINT
trap control_c SIGTERM

cd "$musakansio"
echo "" > .sp

while true

        currsong="`xwininfo -root -tree|grep -o "Spotify - .*:" |sed 's/Spotify - //' |sed 's/\"://' |sed 's/ /_/g'`"
        filesong="`cat .sp`"

        if [[ "$currsong" != "$filesong" && "$currsong" != "" ]]; then
                tempsong="`echo $currsong |sed 's/–/-/g'`"
                if [ ! -f "$tempsong.mp3" ]; then
                        artist="`echo $tempsong |cut -d '-' -f1 |sed 's/_/ /g'`"
                        song="`echo $tempsong |cut -d '-' -f2- |sed 's/_/ /g' |sed 's/ //'`"
                        killall -q arecord
                        echo "$currsong" > .sp
                        echo -ne "                                                                                                                                           \r"
                        echo -ne "Recording $currsong \r"
                        echo "$tempsong" >> "$musakansio/biisit.txt"
                        arecord -q -f dat | lame --quiet --ta "$artist" --tt "$song" -m j -V 4 -q 3 --lowpass 17 --abr "$abitrate" - "$tempsong.mp3" > /dev/null &1>/dev/null

        sleep 0.5



Sign in to comment.
iota   -  Apr 25, 2013

./ line 22: s/"://: No such file or directory
Mind a bit of a tutorial?

nem   -  May 18, 2012

i got past that, care to update the script?? they no longer display the titles in the same way they did and your script returns ----.mp3 as song title all the time

nem   -  May 18, 2012

nem@home:~/spotify$ ./
lame: unrecognized option -------------.mp3

what is the lame options i can remove or change to make this work on debian??

Jordyk19   -  Jun 06, 2011

That's just awesome.

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.