2014-05-07, 00:01
[EDIT]: I have come upon this problem again when moving Kodi to another box, and when moving to a MySQL database. The problem is that Export Music does not export the song ratings, it seems to only export scraped artist and album data. So when setting up a new library importing your exported library will not keep your ratings, what's worse, when scraping a library your ratings within the Kodi Music database may be overwritten with ratings from ID3 tags or online sources. My second post in this thread includes a working script that can copy ratings, last played, and itimes played to a new SQLite based database from and old SQLite Music database. I will be adding a new post that includes code to copy ratings from an SQlite to a MySQL database.
[/EDIT]
Hello all,
I am trying to move from Eden to Gotham, but my music library database seems corrupt in that Gotham is unable to upgrade it (end up with an empty library), and the library export from Eden does not work (tried to do it manually and everything). So I have made a fresh Gotham install with xbmcbuntu, and I added my music to a new fresh library, and I was hoping I could use my old music database to update the ratings field of the new database. I am doing this because my ratings are very important to me and represent years of listening and rating songs. I am able to open the old database, view the contents and use sql commands on it, but xbmc does not seem to be able to work with it.
What I want to do is this:
Match songs via path and filename (song.strFilename, & path.strPath), and update the rating in the new database with the value found in the old database. I had trouble doing this because I don't know sql very well, but I also tried to match on (song.strTitle & song.strFilename) and that didn't work. I am trying to match on two field since I am sure that the filenames aren't unique, and the Titles aren't unique. But filename and path are 100% unique due to the filesystem.
I have tried to do this (using just title and filename) with the following command but it doesn't work (MyMusic18.db is my old database):
This didn't work, all of the ratings turned out to be 3 in the new database. I even manually changed one rating, then ran the command code again and ended up with all 3s again. I really don't know what I am doing, but I really like to update the song.rating using a match on filename and path. I know that path would require a join with the path table and the song table but again I am lost on how to do this. Any help would be greatly appreciated.
Thanks!!!
Why am I doing this?:
I have a big investment in my music database ratings. I have a large messy music collection, and I have been using ratings as a method of music organization/curation that I started back when I had a mythtv box. When I transitioned from mythtv to xbmc, I made a script to write the ratings from my mythtv music database to ID3 tags of the songs so that when scanned with xbmc that the ratings would be used. Now I am trying to upgrade form Eden to Gotham, and my music database seems to be corrupt since I cannot successfully export my music library (just doesn't work). I love using the ratings, since I can just play unrated songs (0 or 3 rating) and find rare gems that are in my music collection that I didn't know existed. This works great with the smart playlists. I can just play songs based on how much I like them. This was a lifesaver for my wedding since I could easily locate all of our favorite music to make an awesome mix.
[/EDIT]
Hello all,
I am trying to move from Eden to Gotham, but my music library database seems corrupt in that Gotham is unable to upgrade it (end up with an empty library), and the library export from Eden does not work (tried to do it manually and everything). So I have made a fresh Gotham install with xbmcbuntu, and I added my music to a new fresh library, and I was hoping I could use my old music database to update the ratings field of the new database. I am doing this because my ratings are very important to me and represent years of listening and rating songs. I am able to open the old database, view the contents and use sql commands on it, but xbmc does not seem to be able to work with it.
What I want to do is this:
Match songs via path and filename (song.strFilename, & path.strPath), and update the rating in the new database with the value found in the old database. I had trouble doing this because I don't know sql very well, but I also tried to match on (song.strTitle & song.strFilename) and that didn't work. I am trying to match on two field since I am sure that the filenames aren't unique, and the Titles aren't unique. But filename and path are 100% unique due to the filesystem.
I have tried to do this (using just title and filename) with the following command but it doesn't work (MyMusic18.db is my old database):
Code:
ATTACH "/path/to/MyMusic18.db" as MM18;
UPDATE song
SET
rating = (
SELECT rating
FROM MM18.song
WHERE
song.strFileName = MM18.song.strFileName AND
song.strTitle = MM18.song.strTitle
)
WHERE EXISTS (
SELECT *
FROM song
WHERE
song.strFileName = MM18.song.strFileName AND
song.strTitle = MM18.song.strTitle
);
This didn't work, all of the ratings turned out to be 3 in the new database. I even manually changed one rating, then ran the command code again and ended up with all 3s again. I really don't know what I am doing, but I really like to update the song.rating using a match on filename and path. I know that path would require a join with the path table and the song table but again I am lost on how to do this. Any help would be greatly appreciated.
Thanks!!!
Why am I doing this?:
I have a big investment in my music database ratings. I have a large messy music collection, and I have been using ratings as a method of music organization/curation that I started back when I had a mythtv box. When I transitioned from mythtv to xbmc, I made a script to write the ratings from my mythtv music database to ID3 tags of the songs so that when scanned with xbmc that the ratings would be used. Now I am trying to upgrade form Eden to Gotham, and my music database seems to be corrupt since I cannot successfully export my music library (just doesn't work). I love using the ratings, since I can just play unrated songs (0 or 3 rating) and find rare gems that are in my music collection that I didn't know existed. This works great with the smart playlists. I can just play songs based on how much I like them. This was a lifesaver for my wedding since I could easily locate all of our favorite music to make an awesome mix.