I recently reinstalled my Linux system (Arch with KDE Plasma). I placed my music files at the same location as they used to be and opened Elisa. Unfortunately all my star ratings disappeared.
I expected them to be stored in the music file directly, but it looks that I was wrong (I tried to change the rating of a file and the `lastModified date did not change). I assume that metadata such as star ratings are stored in some database elsewhere?
I have a backup of my old
home directory, with all my app settings: I assume that my ratings should be somewhere there. Where are Elisa star ratings stored and how can I restore them?
I’m not sure if it’s the primary source, but I found ratings in
~/.local/share/elisa/elisaDatabase.db. It’s an SQLite database file. It contains a table
Tracks with a column
Rating: those are the star ratings (multiplied by 2, so 5 stars shows as 10).
I’m not sure what’s the best way to restore them now. I could reapply them manually but there’s probably a better way.
I’m not a db person, but if you just overwrite the ~/.local/share/elisa/elisaDatabase.db with the one in your backup, it should be back to what it was. Just rename the existing one with a .old or .bak so you can undo if needed.
I should have mentioned that I tried copy/pasting the DB file. Since paths are exactly the same, I expected it to work. Unfortunately when I opened Elisa again, it triggered a DB refresh and removed the ratings again.
I experimented a bit trying to run an SQL query to move data from the old DB to the new one. It restored ratings in Elisa but this time they were not showing in Dolphin/right click/properties/Details so I fear that it would also be lost on the next DB refresh.
My solution in the end was to manually re-apply the ratings based on the old DB. It was a bit slow, but I feel more confident that it will stay. This means that my immediate issue is fixed; but I’d still like to leave this thread open until a better solution is found (or I get confirmation that there’s no good solution currently).
AFAIK the rating is stored in the xattr of a file. This eXtraATTRibute is stored by the file system. When you move files between file systems (i.e. from one hard disk to an usb stick or another hard disk), you will need to use software for that move that does preserve those attributes.
Oh, that would make sense. My backup was on an NTFS drive so it may be why I lost the ratings. On my system I have btrfs, and when I updated the ratings manually I saw the “modified at” date changing.
It means that next time I should be more careful about the filesystem / export extra attributes. Thanks!
this write up was very helpful
the takeway is when using Dolphin to use Move rather than Copy so that the xatta are preserved.
And if you are doing backup with rsync or grsync, make sure you have it set to keep the attributes.