(2021-03-12, 16:12)Montellese Wrote: OK I spent some time profiling the add-on code and the interface to Kodi. For mediaimporter.emby
retrieving all items from the Emby server using the REST API is very fast and~90% of the time is spent on putting together ListItem
s. For mediaimporter.plex
retrieving all items from the Plex Media Server (using python-plexapi
is rather slow.
So I'm currently focusing on the python interface to Kodi because it benefits all media importer add-ons.- With some basic modifications to the code which generates the python bindings I can improve the performance of putting together
ListItem
s by ~25%. As a bonus these changes should also speed up any other python add-on / plugin which operates on ListItem
s.
- By introducing more specific interface methods (instead of using methods like
ListItem.setInfo()
which takes a huge dict
and has to take it apart again) I managed to gain another 25%. The problem with this is that they are not save to use for python plugins and other add-ons directly modifying ListItem
s which have been retrieved from Kodi core. So now the question is whether I should introduce new classes / structures to represent items coming from media importer add-ons to be able to freely improve performance or not. If I would do this it would be a lot more difficult for existing add-ons already using ListItem
s to integrate media import. Or maybe there is a third way which I haven't figured out yet.
Hi, I have been working on add-ons for Emby->Kodi for a few years now with my current active dev going into (
https://github.com/faush01/plugin.video.embycon), this comment here:
"With some basic modifications to the code which generates the python bindings I can improve the performance of putting together
ListItem
s by ~25%. As a bonus these changes should also speed up any other python add-on / plugin which operates on
ListItem
s."
Is WOW, if this helps ans speeds up dynamic ListItem generation for displaying items that is great. The Add-on I created (EmbyCon) just uses dynamic ListItem creation to show items, it does not sync to the local DB at all so if this helps displaying list of ListItems by 25% that is very welcome :-)
We had a big jump in performance when we could create ListItems in offsecreen mode (xbmcgui.ListItem(list_item_name, offscreen=True)) which helped a great deal as it did not need to sync the display refreshes.
"So now the question is whether I should introduce new classes / structures to represent items coming from media importer add-ons to be able to freely improve performance or not."
Whatever changes you make for performance please also make them for dynamic ListItem video add-ons as well, populating ListItems has always been the bottle neck for EmbyCon in displaying large movie lists.
On the REST API front, are you retrieving ALL the data in one request or are you having to make multiple calls for each movie? Multiple calls is going to be very slow.