2021-03-12, 16:12
OK I spent some time profiling the add-on code and the interface to Kodi. For
So I'm currently focusing on the python interface to Kodi because it benefits all media importer add-ons.
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 onListItem
s.
- By introducing more specific interface methods (instead of using methods like
ListItem.setInfo()
which takes a hugedict
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 modifyingListItem
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 usingListItem
s to integrate media import. Or maybe there is a third way which I haven't figured out yet.