Amarok ate your stats?

I have a reasonably large music collection. In a desire to trim this collection down to stuff that I really like, over the years I have painstakingly rated my songs in Amarok. But twice, now, I have had Amarok eat up all my ratings and scores and play counts and other stats. This post will show you how to recover from such a loss.

Amarok

The first solution is for a situation where an Amarok upgrade caused the stats to be lost. I was using the default Amarok setup — that is, all the stats are stored in a file on disk using sqlite. During my Amarok upgrade, Amarok decided to create a new database. Fortunately, it left the old sqlite database file lying around. If you have an old version of your database, you can restore the stats using the following script:

The next scenario arose when I switched to using Amrok2 recently. Now, granted that Amarok2 is still under heavy development and hence the requisite migration paths might not be in place. But I still hate to lose all my stats. Amarok2 uses embedded MySQL instead of sqlite to store all its data. The following script uses your old database to restore all the stats in the new database.

Note that for this to work, you need to first start a MySQL server using the embedded MySQL directory as the data backend, as pointed out here.

Hope that helps!

5 comments

  1. Rodrigo Rosenfeld Rosas

    You seem to be like me and spend a considerable time rating your songs. You should really consider setting up a daily backup of your amarok database.

    I’ve configured it to use a real MySql server, instead of an embedded one, and I’ve set the backups to run daily and logrotate to rotate them up to one week. This is the minimal that I would consider for avoiding loosing all the hard work you’ve put on song rating.

Leave a Reply