Real-time sync of kodi watched status add-on

After months of using a collection of hacked-together scripts I’ve made a kodi add-on that synchronises the kodi library watched status between devices

At home we use a couple of OSMC devices, plus occasionally the computer, to play back TV recordings and with the add-on it allows us to stop play back in one room and within seconds it appears on the kodi home screen ready to continue watching in another room.

It doesn’t require mysql setup. It doesn’t require all the devices to be powered on 24/7 either. It works with devices that use the standard sqlite database (support to refresh the home screen for mysql databases is coming if there is interest)

To install the add-on please follow the installation instructions on Github

Hope you find it useful

2 Likes

When I did my Xwindows/chromium addon, I got a recommendation of Sam to up it to github, The zip and the files seperate, for people to see/read the works before downloading and installing it. It might also bring in other devlopers to work on your script to improve and perhaps add functionality.

It’s really simple to make a GitHub account, create a repository, make a file structure for your addon, and upload the zip in the root of that repository.

1 Like

+1 for the github repo, you could add the instructions to group the devices to either the readme which is conveniently displayed below the repo files or create a wiki page.

Keeping the process private will certainly hinder testing.

I was waiting for a similar addon since I always wanted to find a way to sync watched status between devices but the requirements to use the sql approach (same kodi version) and the fact that the db could break anytime sql server is updated is a no go for me.

Tried trakt.tv addon? It does this easily.

Yup, but having to use an external platform to just sync the watched status is not ideal for me, if there’s an easier way to do it I’m willing to test it :slightly_smiling_face:

I’ve tried trakt.tv but, unless I’m using it wrong, it:

  • Requires performing a full sync with Trakt to pull updates. For large libraries this takes a few mins each time
  • Doesn’t seem to sync episodes that are partially watched
  • Doesn’t seem to sync tv shows that are not on tvdb or themoviedb

I’d be interested to hear how you get it to work otherwise

Hi

Can you please move this to GitHub or another collaborative code sharing website? This is the usual method for development and distribution of Kodi add-ons.

Sam

Thanks for feedback. Will need to have a look as I haven’t used github to upload previously.

I’ve now added to Github. More information and instructions on how to install can be found here.

1 Like

I’d suggest editing the first post in this thread to reflect this change.

Good suggestion, thank you. I’ve updated the first post.

1 Like

I am interested in this as a way to keep a Kodi 18 and a Kodi 19 (and therefore different database table versions) in sync.
Not so much for the Watched status (although that is useful) but more to avoid having to scan the same files in more than one place.

In my case, today, two systems share a remote MySQL database (and tables since they are on same Kodi version).

So after I record something from TV and store it on LAN I scan it in on one system and it is visible le from both.

Sometimes the scan process prompts to choose between competing matches.

In the end I correct it once and both systems see it.

From what I could see, from reading the script, it kicks off a scan on the secondary system rather than try to copy over the master data … so what happens if the secondary system makes an incorrect match?

Also, I saw that you have opened a ticket to add support for Kodi 19 support.
Are you expecting it to be straight-forward?

That is not going to be possible as the the databases for each major Kodi version is completely separate. When Kodi is launched it looks for the correct db. If it doesn’t find it then it looks for the db from the last Kodi version. When it finds the older version it makes a copy to a new database and then never touches the old one again. So Kodi 18 will keep reading the old version and Kodi 19 will only read the new version and the two db have no links between them.

I understand … that is why I have questions about how your add-on would work in the scenarios that I described.

If starting from scratch it would be preferable to use the standard sqlite database. However, if you already have a working mysql setup, you should be able to run 18 and 19 concurrently using the add-on to sync the watched statuses. As darwindesign mentioned they will operate from separate tables so neither system will have shared access to the same mysql data.

I’m not familiar with that to know what is happening behind the scenes in Kodi. If you can turn on debug logging and upload logs files when you go through that process I could review to see if that is a possibility to sync.

Yes, it should be pretty straight forward. It’s mainly nomenclature changes between python 2 & 3.

I thought KODI already had this feature and stored the watched states in the nfo files.
You just need to define it in the advancedsettings.xml file in the .kodi/userdata folder.

The .kodi/userdata folder is local to each machine in my case … so such a solution would require syncing of the such files (which is possible) … however, I use MySQL do not have any .nfo files.

That feature is only used for initial scraping into a library. Its use is for a situation such as exporting your library to nfo files and then rebuilding a new library that your scraping in with the help of said nfo files, optionally with watched status if you enable that in advancedsettings. When Kodi updates its library it does not attempt to search for changes to nfo files from items that already exist in the library.

Yeah I’ve used the sql method before, I abandoned it after several database corruptions.
Was using MariaDB. Every run into this, what db u using?

Now I use Emby Kodi plugin, and emby server as my back end to sync all my boxes.

I’m using MySQL on a Windows PC.
Been there for years and not had any problems with it.
The PC is always on … but I am thinking of moving some of the tasks off it and onto another Raspberry Pi if I can port the code … in which case it would not need to be on all of the time so would then look into other ways of doing it.