-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUESTION] Use Cache when starting Kodi #1039
Comments
@leverageinventions elementum does use cache :-) otherwise it would be super slow to get all your data every time, like content of all your lists, all watched movies/episodes and etc. so before making any changes to code, can you please do some tests?
and then write results here. |
@antonsoroko thanks for the insights. Here are my findings:
Now my question is the following, is there a way that Elementum uses the caches BEFORE it looks for changes in the lists? So that when I start Kodi the movies and shows are already populated instead of being an empty canvas? And another question, does Elementum does the triggering for the lists updates or the triggering of the updates is done by kodi or the skin or skinshortcuts? Thanks for your help. |
then it will not do any sync in background or during startup! i really mean ANY. from your initial message i thought that you heavily use trakt, like many of us: huge watchlist, many own lists, collection. looks like you thought that we get info about public list during kodi start:
but these lists are not synced/cached in background/startup. their content is gathered only when you open them.
both these questions are interconnected so the answer is one: as i said, public list content is gathered only when you open them. (about "always check if list was changed" - we will not change that b/c it makes perfect sense. we use quick api call to see if list was changed, this call is quick so it does not slow down anything but gives a lot of benefits, like we always give you updated list content, but if list was not changed - we also give you valid list content from cache).
actually YOU do when you open list. read above for details. so in the end: cache or trakt is not your issue. maybe you just think that elementum's start time is big, but maybe for your device it is actually normal start time. you should not compare elementum with tmdb helper. elementum not only show you data from trakt/tmdb sites, but also is a bittorrent engine. so it takes time to start it. provide proper debug log file (see issue template for guide) so maybe we can see if there is something that slows down your elementum. |
JFYI: on my quite old home pc ( Intel NUC Kit BOXNUC8i5BEH2 ) elementum is readly immediately if w/o tratk+library and it is still immediately ready with trakt+lib (i mean i do not see difference). btw
it simply means "wait X seconds and only then start elementum". thus obviously you can't open elementum immediately. to give you background info:
so kodi launch python plugin, and then plugin launch binary. |
Thanks for the explanation. I have been seeing a little of the code since I have been debugging this issue, mainly the navigation.py file which seems to be the one that gets and processes all the calls. You got it exactly right when you said the following:
Basically I have 3 pages with 2 to 3 lists of top/popular movies/shows on Kodi's main page which are part of the interface. So, when Kodi starts the skin loads the lists as you said (automatically since they are in the main page) and shows all the posters when the data is ready, then I can just enjoy and browse and use the torrenting part. The problem is that it takes some time to show everything, from the kodi launch to elementum checking/updating the lists. In the meanwhile I only see an empty canvas with loading indicators until Elementum gets the lists to be displayed. This process happens every time I open Kodi since it is an android tv box and not a dedicated kodi system. I have been debugging and reducing the overhead by disabling/uninstallng things I don't use in Kodi but still there is some wait for the canvas to be populated with the posters. That's why I wanted a way to show the cached data instantly and later (when elementum was ready or manually) to update that data. |
@leverageinventions
i mean, waiting 1 week (or any other amount of time) before update cache is not ok. this is not what i as a user want to have, i want to have accurate info, not outdated info. it is possible to implement an option like "never update list content cache until cache is expired or user asked for update", but personally I do not know how valuable this would be. and again, to update cache you need to implement either button in settings or menu item. anyway, let's wait for @elgatito opinion about this. (btw, if you know some coding - feel free to add such option :-D ) |
Well, for a regular user I think the way it works right now should be the default. I was not thinking on changing that behavior but in adding it as an option, like the ones you gave me at the beginning (don't synchronize kodi library, don't synchronize trakt). I was thinking it could work like this: an option in settings to use caches on the start of kodi and update while on playback. That's it. About the coding stuff, I know basic coding, I am also looking to see if I could just add that but I am missing some stuff, for example I don't know how to extract the lists from the caches. Currently what I was thinking was in adding a condition in the navigation.py code so that if the url is for example "plugin://plugin.video.elementum/movies/popular" (which is one of the lists I am using) and kodi or elementum have just started then immediately send back the list in the cache. |
please elaborate. i do not see a good way to do that, apart from ugly ways i described above. cache is in golang part, so unfortunately to make any real fix you need to change golang part and compile it. |
Well I just meant to add an option in settings to delay (or turn off) the update of the lists like there are options already to turn off tract or library synchronization. So the default behavior would continue to be as is but this option will allow other users to delay it. By playback I just meant what this setting does:
Got it, I don't know golang just some basic python so I cant go there, unfortunately. Thanks for the insights, now at least I know what does what and what can and cannot be done. |
It means that if you do not disable it then we do background synchronization even if you play video which means that on very slow device video can stutter.
Those options are about the background synchronization, but for public lists we don't do background synchronization, as a I already mentioned.
I do not see a way to delay update (because there's is nothing to delay, we do not do background update for public list), only to disable update at all and then you have to manually update every list by clicking some button/menu (like I described above). Probably it is possible to create some hack, like if Elementum started less than 1 minute ago and user opened list then do not update this list even if list was changed on trakt side. But this dirty hack for a very specific situation. |
I don't see any way to speed-up loading. Trakt sync or library sync is not affecting list rendering, unless you have a massive Kodi library and a single core on the device. @leverageinventions You can enable debugging in Kodi and share a log after you start Kodi, so that I could see what is done and how long - https://elementum.surge.sh/contribute/log/ |
Every time I open Kodi it says the Elementum daemon is starting and the catalog begins loading and takes some time to finish.
Is there a way to use the cached data and not update the catalog until I do it manually?
I wasn't sure if it was Elementum or TheMovieDBHelper which updates everythin at the start of Kodi but I tried the option in Elementum to delay the start, and when I did then no Catalog is loaded whatsoever so I think it has to do with it.
Checking the log when starting Kodi these lines appear:
`
2024-05-11 17:28:14.099 T:27275 DEBUG : CDirectoryProvider[plugin://plugin.video.elementum/movies/popular]: refreshing..
2024-05-11 17:28:14.099 T:27275 DEBUG : CDirectoryProvider[plugin://plugin.video.elementum/movies/top]: refreshing..`
Thanks.
The text was updated successfully, but these errors were encountered: