WIP Media importing and library integration (UPnP, Emby, Plex, ...)
(2021-03-01, 12:13)Montellese Wrote: Media import would take care of this for you. You wouldn't have to write directly to the Kodi database (which is not well received when it comes to support) and you wouldn't have to take care of separating your media data from the rest of Kodi's database / library. The idea is that the add-on provides a way to connect to the media provider (Mezzmo server) through some custom settings and then the user can specify which media types (movies, tvshows, musicvideos) to import. Then Kodi calls the add-on to provide all media items of a specific media type. The add-on retrieves the items and passes them back to Kodi which takes care of synchronizing them into the database. Obviously there are some advanced concepts like partial synchronization etc. but this should give you a general idea.

Media import has nothing to do with JSON-RPC.

I haven't used the UPnP import for a while but the main problem with non-Kodi UPnP servers is that they often don't implement the Search functionality which is necessary to retrieve all media items of a specific media type. I had to add this functionality to Kodi when I started with media import because it didn't support it either. Furthermore UPnP is limited in the type of metadata it can provide.


When I say separate in the Kodi database I simply mean I track records belonging to Mezzmo vs. not.  As far as the user goes, if they are displaying data from the native Kodi front end vs. using the Mezzmo addon GUI, they won't be able to tell the difference.  I believe this is similar to how it looks like MediaImport operates.  The Mezzmo addon just simply plays nice with other data and is a good citizen.  The JSON RPC comment was simply looking at moving from the current direct SQL access to JSON RPC to populate / maintain data which is what the Wiki says is preferred.  I've had minimal luck finding any documentation on this and would have concerns about performance.  This was just part of a conversation LongMan and I were having and not really related to MediaImporter other than I originally thought that is how MediaImprotter was updating the database.    

I've done some additional reading on the Wiki page and looking at the other importer addon code.  I have a better understanding of MediaImport in that it is native to the Kodi code and not another addon.  It uses an extension point for media provider addons.  I looked through some of the Emby code and many of the various functions it has Discovery, Import etc..  are already written in the Mezzmo addon but operate a bit differently due to having a GUI, leveraging some Mezzmo specific functions and similar.  In addition there are a number of features in the Mezmo addon which are unique or operate differently.  Playcounts, bookmarks and such are passed back to the Mezzmo server for all clients to leverage.  Likewise you can mark watched and unwatched via the GUI and it sets it in the Mezzmo database for all clients.  The GUI has view over rides so the user can remap a view to their preference overriding the default view for the media type.  The bookmarks are user adjustable for 0-30 seconds behind where you stop in case you want to rewatch the last few seconds.  As mentioned earlier, full synchronization is built-in including detecting Mezzmo database metadata changes, a daily sync process and more.  Because of all of this and other integrated functionality it would likely be better to write a new addon for MediaImporter and leverage code from the existing addon.  It's going to be a piece of work and I have a number of questions on how MediaImporter works and the interface to an addon.

I don't have time to tackle this amount of coding right now but I can pick away at it as time permits.  I'd also only do a Matrix version and not maintain 2 code versions.  I have a couple of questions which I am curious about. 

First, how are you handling uPNP server record deletions ?  I handle it in Mezzmo via a daily sync process which runs between midnight and 6AM.   The sync processes detects when nothing is playing and runs in the background.  The daily sync removes all Mezzmo records from the Kodi database and then does a new bulk import.  This takes care of deleted records.  I also detect duplicate records in the Mezzmo database.  I am unaware of uPNP servers having the ability to let you know of a deleted record so a full sync seemed to be the best option.  It also makes it nice if a client needs to be rebuilt or the Kodi DB goes haywire.  The addon rebuilds it as soon as it starts.  I am curious how you handle this ?

Second, does MediaImporter take all of the metadata from the addon vs. rescraping the data ?  If so, what format is needed from the addon ?  The Mezzmo addon gets an XML response and parses it prior to adding to the Kodi database.  In looking at the Emby importer code it looks like you might be doing a field mapping but I can't tall what the exact structure is of the uPNP metadata going to MediaImporter.


Thanks,

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 - 2021-03-01, 23:20
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