Restoring XBMC watched status of Movies and TV Shows Episodes

xbmc-logoMessed up your XBMC video Library? Clean install of XBMC? Moved your Movies and Series database to a different path? Or just want to start with a clean slate? But want to preserve the watched status. This howto provides couple of easy steps to backup and restore your XBMC watched status.

Backup watched status

  1. Backup the Master Profile database located in ~/.xbmc/userdata/Database and the the per User Profile databases located in ~/.xbmc/userdata/profiles/<user-profile-id>/Database.
The instructions below will restore the watched status of TV Shows and movies for the Master Profile. Repeat the steps for all User Profiles you want restored.

Setup a clean database

  1. Remove the entire ~/.xbmc and start all over fresh again
  2. Or remove the ~/.xbmc/userdata/Databases/MyVideos*.db to only delete the Movies and TV Shows Master Profile databases. Repeat per User Profile.
  3. Or remove a User Profile ~/.xbmc/userdata/profiles/<user-profile-id>/
  4. Startup XBMC and login to a Profile
  5. Add your Video Sources for Movies and TV Shows
  6. Assign the correct scrapers to the new Video Sources
  7. Re-scan/update Video Sources to scan for all your TV Shows and Movies. After this step your media libraries in XBMC should be in good shape.
Make sure that you setup the media libraries using the same paths in step “v” as before if you want an easy restore procedure. If your video library used to be on smb://MYSERVER/Videos/, make sure that you re-add that exact same path. Updating wachted status will fail if the media paths differ. However, if you do want to change the library paths: in a later step the paths in the watched.sql file will need to manually patched to match the new library location. Use sed and awk for example.

Restore watched status

  1. Locate the MyVideosN.db (where N=revision number) in your backup and export the watched status:
  2. Convert watched.txt into an SQL bulk update script
    1. Save the following AWK script in ~/watched.awk:
    2. Convert watched.txt into SQL:
  3. Update your watched status in your new library by executing the watched.sql script via sqlite on the MyVideosN.db SQL library.

    Thats All! If the sqlite command exits with a count other then 0, then one or more updates failed. Have a look in /tmp/watched.sql.log to see which records could not be updated. Use sqllite3 command-line tool or sqliteman graphical tool to analyse problems.

 

2 thoughts on “Restoring XBMC watched status of Movies and TV Shows Episodes

  1. Hi Amain. Thanks for your nice post! I would like to use it but can´t get the sql commands/scripts to work somehow (I am not good at sql…). I got my backed up databases and already set up a new database. All went well, I can even switch back by exchanging the files. Installed an sql editor, opened the database and tried to copy and paste the commands out of your post and execute them (well i changed the file name and folder accordingly but i still guess that the mistake is here somewhere). Any help appreciated. Thanks in advance. Best regards

  2. Hi,

    What are you pasting where exactly? Maybe I’m stating the obvious, but all of the commands in the article need to be executed from the commandline. Only the contents of resulting watched.sql could be executed in different SQL interpreters, depending on quoting style and minor language differences.

    Regards,

    Amain

Laat een reactie achter bij amain Reactie annuleren

Het e-mailadres wordt niet gepubliceerd. Verplichte velden zijn gemarkeerd met *

De volgende HTML-tags en -attributen zijn toegestaan: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">