nice to hear someone is actively working on this.
a few weeks ago I decided to start working on something similar myself. I don't know if you remember my 2013 GSOC proposal, but the initial idea was to have a Database that stores changesets of the metadata tables. Those changesets could then be exchanged.
I have a working Proof of Concept of such a Database "framework". It basically has triggers that automatically store the changes in a spereate table.
(2014-08-26, 00:10)Montellese Wrote: You can then manually trigger synchronising the items from the remote library
I have registered a commit hook with sqlite, that gets called whenever something has changed. (that could be used to trigger the sync automatically).
I don't know if mysql has some similar function, but worst case would be to poll for changes in a background task.
And since we can easily query the db (well the query right now has lots of joins
) for new changesets, we do not need to sync all items in our DB.
Those changesets also have a Timestamp, so if the value changed on both devices, we could use the newest value.
The changesets also have the old and the new value. That could be useful to apply deltas (on some fields). Let's say you have a new movie and you watched it once on your tablet and once on your HTPC but both devices haven't synced yet. If we sync now and just override the values by the values the partner gives us, we will end up with a play count of 1 on both devices. By using deltas, we could figure out that the user has actually watched it twice. (Don't know if kodi actually stores a play count for movies, but for music it does).
The framework is really easy to use: You just need to implement Two functions in the CDatabase derivates (one function that returns true and one that returns an array of tables that should have changesets). I have already done that for music and video dbs but it would be no big deal to add that functionality to future dbs.
TODO: Rewrite the triggers and get it to work with MySQL (sqlite only for now).
On top of that, I started to implement the 'UPnP Content Sync Service' which is ment for sharing and updating files (optional) and their metadata (that's what I'm trying to do). I have to admint that the specs are a little sketchy on some key points and it disallows the syncing of the same item with more than two devices. So I was going to loosely follow that spec and make some alterations along the way, but we might be able to keep interoperability with non Kodi devices that implement that spec (To be fair, I don't know any that do, so that has rather low priority). I'm still fighting with libUPnP (great documentation they have) but I'm getting there.
TODO: well... nothing to show for yet, so quite a lot of work to be done.
@Montellese: Might you be interested in joining forces on that one? I've looked at your
media_import branch (only in the network/upnp folder) and it seems you implemented some custom behaviour for the syncing. Are you interested in using my work on the Sync Service UPnP Specs?
My git history on my branch is nowhere near usefull (I fucked up two squashes and then decided to just don't care about a clean commit history anymore), but if you want I could atleast clean up the DB changes and provide them if you want.
EDIT: just cleaned up my branch a bit and pushed it:
syncService