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.
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!