WIP Media importing and library integration (UPnP, Emby, Plex, ...)
(2022-01-13, 17:01)LongMan Wrote: @jbinkley60,
Thanks for your suggestions. I was recommended deleting the database in this case, because there is a bug that needs to be addressed which concerns removing items from the database.
With regards to syncing, each import already has a manual sync process and a force full synchronization option. If I understand you correctly, your suggestion would be to add a feature to put it on a schedule.

With regards to being able to request changes since a specified time. My understanding is that neither Emby nor Jellyfin server has the feature builtin. The feature is provided by a server plugin, Kodi Companion for Emby  and Kodi Sync Queue for Jellyfin. Maybe a similar type of progarm could be written for a UPnP server. TBH I don't even know if it possible for a UPnP server. What are your thoughts? Is that possible with Mezzmo?

Cheers,
LongMan

I’ll discuss how I do synchronization within the Mezzmo addon, since I wrote all the code for it and am familiar with how it works.  Mezzmo is basically a database driven uPNP server, similar to Plex and others.  When we say syncing I think of the Mezzmo and Kodi databases being fully in sync (i.e. 100% match between the records).  To sync 2 databases like this there are two typical approaches.  First, querying the source database  (either partial or all records) and then comparing it against the target, in this case Kodi.  The second is deleting all of the records for the source database in the target database (in this case deleting all Mezzmo records in the Kodi database) and then querying all of the source records and adding them to the target.  The first requires some lookup table or tracking mechanism in the software doing the sync process (in this case the Mezzmo addon) to look for records no longer in the source (i.e. Mezzmo) but are still on the target (i.e. Kodi).   I never implemented this lookup table approach in the Mezzmo addon since I wrote the full sync 2nd option code first and it seems effective.  I’ve thought about adding it but it wouldn’t add a lot of value at this point.

The Mezzmo addon does a combination of these sync processes.  There is an hourly sync service process which runs in the background.  The user can select how this process runs.   There’s normal option which first checks for the newest 400 Mezzmo records and will add anything new or if something has changed (i.e. updated metadata, codecs etc.. on the Mezzmo server for a given record) and then queries 1/6th of all other Mezzmo records  to do the same comparison (looking for metadata and codec changes).  A counter keeps track of the last record it queried from Mezzmo in the previous hour.  When it gets to the end it starts over at the newest record in the Mezzmo database.  So worst case all records get refreshed every 6 hours.  I didn’t implement a look-up table or tracker which would identify any Kodi records for Mezzmo which weren’t seen (i.e. deleted from Mezzmo server).  That is handled by the daily sync process.  So worst case a stale record will remain in the Kodi database for up to 24 hours but from a user GUI perspective Mezzmo won't present it when browsing the playlists since it was removed from the Mezzmo database.  A user might stumble across a stale record in the 24 hour period if they did an actor search, which queries the Kodi database.  But this is rare since a full sync is done daily, as described below.  The other hourly sync option is called Newest is to just review the newest 400 records each hour which would catch newly added records to the Mezzmo server which can be manually added by the user to the Mezzmo server or automatically discovered and scraped by the Mezzmo server.

For a full sync (i.e. delete all Mezzmo records in Kodi and read them) this is done daily between midnight and 6AM and can be forced manually  (this is great if a Kodi database blows up, Kodi client rebuild etc..).  The daily full sync process will remove all stale Mezzmo records in Kodi since it starts by removing all Mezzmo records and only adds back what is current.  The user can also disable the background sync process altogether and use real time updates (i.e. as they browse the Mezzmo playlists in the GUI new records and changes are detected) or they can set sync to auto which tracks whether Mezzmo and Kodi are in sync and will adjust between normal and the newest 400 records based up the status of sync between the two databases. 

For the last part of your question, querying based upon time.  I am not aware of a uPNP server which tacks deletes and that can be queried by time.  Mezzmo does allow a query of the newest x number of records and there is a uPNP XML field which tracks when a record was added to Mezzmo or you can query any set of records (ii.e. record numbers x to y)  That feature is used by the addon Newest sync process.  It could be used for date type queries / parsing but it wouldn’t have deleted records, just new ones.

Sorry for the long winded answer but I hope this makes sense.

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply


Messages In This Thread
Unexpected Behaviour - by LongMan - 2015-04-20, 23:53
RE: Media importing and library integration (UPnP, Emby, Plex, ...) - by jbinkley60 - 2022-01-13, 18:31
20.2 Generic Builds - by LongMan - 2023-07-20, 04:49
Logout Mark Read Team Forum Stats Members Help
Media importing and library integration (UPnP, Emby, Plex, ...)10