Minimal Rockbox scrobbler.log to submitter

I've recently found myself on a severely resource-limited computer, and I tried to find a way to submit my listening history from my Rockbox device to without needing a lot of dependencies. After a bit of searching I stumbled upon a script made by a couple of Linux Outlaws listeners, back on the LO forum... but it had a couple of glitches.

The script only works as a converter from the scrobbler.log format to the one used by - a migration tool, so you basically needed to run a couple of commands just to upload some tracks.

Another hassle was that the script didn't filter the skipped tracks, effectively spamming my listening history with songs I didn't feel like listening that day. Also, the duplicate entries weren't filtered either.

I've modified the script to fix those issues, and to invoke automagically for you.

Just save it as in a folder of your choice, along with and from the project. Then edit it and change line 46 with your username.

If you don't need automatic scrobbling, comment lines 46 and 47, and a rockbox.log file with be left in the current folder, for you to manually import. Run it with ./ /path/to/your/rockbox/player/mount/point

Here's the script:

#A script to convert Rockbox .scrobbler.logs to a format suitable for
#Just run this script as "./ /path/to/scrobbler_log_file"
#You may have to change the timezone (on line 20 I.E. UTC+1 = British summer time)
# to suit your timezone if you get errors.
#The file can then be uploaded via the script found here
#Place and in the same folder as the script for automatic
# submission, otherwise comment lines 46 and 47 (by adding a "#" in front).

#Remove the uneeded info

cat $1/.scrobbler.log | grep -Pv "\tS\t" | sed '1,3d' | cut -f 1,3 > /tmp/scrobtracks.tmp

#convert timestamps from epoch time to human readable

cat $1/.scrobbler.log | grep -Pv "\tS\t" | sed '1,3d' | cut -f 7 | while read line
date -d '1970-01-01 UTC+3 '$line' seconds' +"%FT%TZ" >> /tmp/scrobdate.tmp

#build finished file

paste /tmp/scrobtracks.tmp /tmp/scrobdate.tmp > /tmp/scroblog.tmp

awk '!x[$0]++' /tmp/scroblog.tmp > ./rockbox.log

NUM=`cat /tmp/scrobdate.tmp | wc -l`

echo "-------------------------------------------"
echo ": There are $NUM tracks in your rockbox.log :"
echo "-------------------------------------------"

rm /tmp/scrobdate.tmp
rm /tmp/scrobtracks.tmp
rm /tmp/scroblog.tmp

echo ""
echo ""
echo "Finished processing"
echo "Starting import"
echo ""
./ -s YOUR_LIBRE.FM_USERNAME ./rockbox.log
rm ./rockbox.log
rm $1/.scrobbler.log
echo ""
echo ""
echo "Done"
echo ""