Spotify Recorder

By zenx
Platform:  Shell
Published  Jun 05, 2011
Updated  Jun 05, 2011
Records & encodes songs from spotify to your HDD as you play them. #!/bin/bash

musakansio="/home/o/recspotify/"
abitrate="192"

control_c() {
killall -q arecord lame
exit 0
}

trap control_c SIGINT
trap control_c SIGTERM

cd "$musakansio"
echo "" > .sp

while true
do

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
fi
fi

sleep 0.5

done

Comments

Sign in to comment.
iota   -  29 days ago
./spotify.sh: line 22: s/"://: No such file or directory
Mind a bit of a tutorial?
 Respond  
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
 Respond  
nem   -  May 18, 2012
nem@home:~/spotify$ ./spotify.sh
lame: unrecognized option -------------.mp3


what is the lame options i can remove or change to make this work on debian??
 Respond  
Aha2Y   -  Jun 06, 2011
That's just awesome.
 Respond  
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.