I’ll be there when you fall
And they’ll be no pain at all
And I’ll be your shelter...
Your shelter from the storm
This short BASH script takes Mediamonkey database copied from android tablet and copies rating for each rated song to collection database of your beloved amarok 1.4
It expects database from tablet in the file /mnt/ftp/matrixx/mmstore.db - Change this to use your file!
If you use trinity, you will problably need to replace ~/.kde to ~/.trinity
It has bugs!!! It doesn't work reliably with songs containing " and ! in its tags - maybe more limitations, I don't know, I don't care. If you fix it, I can edit the code displayed here - if you send me the fix. Thanks.
ret="0"
echo "copying ratings from mediamonkey to amarok:"
sqlite3 /mnt/ftp/matrixx/mmstore.db 'select title,artists,rating from media WHERE rating != -1;' | while read line
do
title="`echo $line | cut -f1 -d\|`"
artist="`echo $line | cut -f2 -d\|`"
rating="`echo $line | cut -f3 -d\| | sed -e 's/0//'`"
url="`sqlite3 ~/.kde/share/apps/amarok/collection.db 'select tags.url FROM tags JOIN artist ON tags.artist=artist.id JOIN statistics ON tags.url=statistics.url JOIN composer ON composer.id=tags.composer WHERE tags.title="'"$title"'" AND artist.name="'"$artist"'";' `"
echo " "$title by $artist has new rating $rating
sqlite3 ~/.kde/share/apps/amarok/collection.db 'UPDATE statistics SET rating='"$rating"' WHERE url="'"$url"'"'
let ret++
done
echo
echo "DONE! (successfully???) copied $ret ratings :-)"
echo