Importing to OSMC a damaged SD Raspbmc Kodi v14.* /.kodi library?

I had an unlucky event that damaged my SD card where Raspbmc/Kodi was installed. Not sure about the version, could be 14.2 or 14.1.
I managed to backup the Kodi folder ./kodi, with all the Sqlite3 database files, xml, settings and the like.
Since I couldn’t find any legacy Raspbmc image on the OSMC website to try to replace from a fresh install the .kodi folder (and eventually use the export library function), I had to switch to OSMC, installed on my Pi1, substituted the .kodi folder and is not “obviously” running (getting the sad face image). I believe I have read somewhere the db schema changed in the new OSMC and all this mess makes certainly sense to me.

Do you guys know how could I manage a manual import from Raspbc to OSMC by using some script on the .db files and manually editing any xml? I don’t care about the watched states, but just want to import the library because after the scraping I had to do a lot of manual corrections of wrongly interpreted movie titles.

I am also assuming that all the sqlite database files are not corrupted (I can view their content and open them via any viewer).

Thanks in advance.


That is correct but they would be automatically upgraded.
Suggest you:

  1. Stop mediacenter sudo systemctl stop mediacenter
  2. Remove your .kodi folder (assuming that you still have your old backup)
  3. Copy just the database folder over
  4. Start mediacenter sudo systemctl start mediacenter

Give it some time it should do the upgrade otherwise check the kodi.log file

You could try the following

mv /home/osmc/.kodi/userdata/Database /home/osmc/kodi.userdata.Database.osmc
cp -R /path/to/raspbmc/.kodi/userdata/Database /home/osmc/.kodi/userdata/Database

and see if kodi will auto convert the databases. In theory Kodi checks first for it’s native database and then for any dtabases from previous kodi versions and update them to the newer version automatically.

However there has been quite a step from 14 to 16!

If this doesn’t work then you can get your working v16 data back by running the opposite of the first command…

rm -rf /home/osmc/.kodi/userdata/Database/*
rmdir /home/osmc/.kodi/userdata/Database
mv /home/osmc/kodi.userdata.Database.osmc /home/osmc/.kodi/userdata/Database

Hope this helps.

Or just do what @fzinken said - he types quicker than me :slight_smile:

Wow, thanks guys. I really appreciate your promptness.
I will let you know and psot the kodi.log file if needed.
I think I should also change the xml settings for the “Sources” sources.xml right? (media files are on a SMB folder)

Have a great day

Yes correct that would be helpful while it should boot and convert the database even if you don’t have the sources.
Anyhow better to put them in.
BTW depending on the size of your database this can take quite some time without any display on the screen

Thanks guys, it worked like a charm!

Thanks for the follow up.

Glad it worked out :slight_smile: