Created
January 16, 2011 21:33
Revisions
-
tupton revised this gist
Jan 19, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ while read L; do done < <(grep -e '^\(title\|artist\|album\|stationName\|pRet\|pRetStr\|wRet\|wRetStr\|songDuration\|songPlayed\|rating\)=' /dev/stdin) # don't overwrite $1... username='<YOUR GOOGLE USERNAME>'; secret='<YOUR SCROBBULAR SECRET>'; case "$1" in songfinish) -
tupton revised this gist
Jan 19, 2011 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,8 +7,8 @@ while read L; do export "$k=$v" done < <(grep -e '^\(title\|artist\|album\|stationName\|pRet\|pRetStr\|wRet\|wRetStr\|songDuration\|songPlayed\|rating\)=' /dev/stdin) # don't overwrite $1... username='<YOUR GOOGLE USERNAME>'; secret='<YOUR SCROBBULAR SECRET>' case "$1" in songfinish) -
tupton revised this gist
Jan 16, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ case "$1" in if [ -n "$songDuration" ] && [ $(echo "scale=4; ($songPlayed/$songDuration*100)>50" | bc) -eq 1 ] && [ "$rating" -ne 2 ]; then curl -X POST --data-urlencode "username=$username" \ --data-urlencode "s=$secret" \ --data-urlencode "track=$title" \ --data-urlencode "artist=$artist" \ -
tupton revised this gist
Jan 16, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ #!/bin/bash # create variables while read L; do -
tupton created this gist
Jan 16, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ #!/bin/bash # create variables while read L; do k="`echo "$L" | cut -d '=' -f 1`" v="`echo "$L" | cut -d '=' -f 2`" export "$k=$v" done < <(grep -e '^\(title\|artist\|album\|stationName\|pRet\|pRetStr\|wRet\|wRetStr\|songDuration\|songPlayed\|rating\)=' /dev/stdin) # don't overwrite $1... username='username'; secret='secret' case "$1" in songfinish) # scrobble if 75% of the song has been played but only if the song hasn't been banned if [ -n "$songDuration" ] && [ $(echo "scale=4; ($songPlayed/$songDuration*100)>50" | bc) -eq 1 ] && [ "$rating" -ne 2 ]; then curl -X POST --data-urlencode "username=$username"\ --data-urlencode "s=$secret" \ --data-urlencode "track=$title" \ --data-urlencode "artist=$artist" \ --data-urlencode "duration=$((songDuration/1000))" \ --data-urlencode "album=$album" \ http://scrobbular.appspot.com/scrobble fi; ;; songstart) curl -X POST --data-urlencode "username=$username" \ --data-urlencode "s=$secret" \ --data-urlencode "track=$title" \ --data-urlencode "artist=$artist" \ --data-urlencode "album=$album" \ http://scrobbular.appspot.com/now_playing ;; esac