plugin.program.autowidget icon indicating copy to clipboard operation
plugin.program.autowidget copied to clipboard

[Request] Faster startup when using usb disk (by doing library sync)

Open djay opened this issue 1 year ago • 0 comments

Problem

Low end systems, esp sticks using USB really go slow when you have lots of widgets. Why? Most likely because Kodi loads a new instance of the plugin for every widget, all at the same time. Not sure if it's memory/swap or just all the imports or a GIL problem with all the file IO this creats. but the end result is 1+min to see all widgets even if they all come from the same plugin and even if that plugin is caching those lists like AutoWidget can.

Proposed solution

based on ideas from https://github.com/jurialmunkey/skin.arctic.horizon.2/issues/847

AutoWidget Library Sync

  1. Setting to sync all autowidget groups to a library path
  2. On refresh and updating cache after playback write out each AW group as a set of .strm files and a smart playlist file.
  3. do library reindex
  4. in skin widgets point to smart playlist instead of plugin AW group.

note: Seems like its possible to have plugin urls in the strm file but only if it ends up playing episode or movie etc not showing a menu? You can have a dir and .nfo file for a show and just have a single episode in it to speed things up but now the sync process has to open up all the paths to work out what goes to a video and what goes to a menu?

Why?

  • avoids loading any addons at startup which should speedup things considerably. 10 widgets = 10 AW loads even with current caching.
  • doesn't require syncing large numbers of .strm files so library updates time and library ram size should be small
  • updates now involve library update step but is that any less slow than calling AW?
  • better than TMDB helper library sync since you what you sync doesn't have to be on a specific trakt list.
    • smart playlists reflect any path out of any plugin or AW mixing of those.
  • should work for other addons other than video ones? like games?

Solutions considered

TMDBHelpers Library Sync

Syncs your trakt collection + specific trakt lists you specify

  • you then use kodis smart lists to workout your nextup etc? cons:
  • you need to sync all episodes on all shows which takes a lot of time. esp to keep up to date.
  • how to get it to work for IAGL or non tv/movie paths?

Wait for subinterpreters speedup in python

https://peps.python.org/pep-0684/

  • may or may not solve the problem?

Kodi should do the caching

It would be super nice if this was a core kodi feature that it just remembered the contents of the widgets and displayed that on start up instead of displaying nothing while waiting for all the addons to return data.

Context

  • how skins and skin shortcuts work - https://www.reddit.com/r/Addons4Kodi/comments/fosi2r/is_there_any_way_we_could_make_home_screen/
  • discussion on options. mainly pointing to autowidget existing caching - https://www.reddit.com/r/Addons4Kodi/comments/rldbgf/best_way_to_load_widgets/
  • or is https://github.com/kodi-community-addons/script.skin.helper.service involved in rendering widgets so could be a better place to add caching?
  • this seems to recommend TMDB helper but I can't see how that solves the problem as it only seems to sync a single dir with a single track list. Not all the lists that might be interesting to show as widgets.

djay avatar Mar 03 '23 04:03 djay