Goldenfreddy0703 / Otaku

Repository for Otaku Development
GNU General Public License v3.0
113 stars 22 forks source link

Pagination for Long Shows #264

Open jrh03 opened 5 months ago

jrh03 commented 5 months ago

When running Kodi on my Fire TV and watching long shows, sometimes it can take a long time to get the episode list to show. I was wondering if it might be possible to add some kind of pagination or if this has been considered before?

I'm not entirely sure how the Kodi codebase works. I played around with adding a limit and offset to the SQL in the get_episode_list function in database.py.

I have some logic for simple pagination, but I actually wouldn't be sure of how to add previous/next page buttons. Further, it might be better to initially get the count of episodes and display groups of episodes 1-100, 101-200 etc. This would make it easier for people to find later episodes I guess.

If there was any guidance on how to do this, especially without breaking anything (as I can see get_episode_list is called in five places) or overcomplicating the code then I might be interested in implementing it myself.

Is this a feature you'd find valuable?

Goldenfreddy0703 commented 5 months ago

Ahh I see what you mean, it would be a good idea to add so loading is faster for episodes but would probably break one of our useful features called Smart Episode Scrolling where it would Scroll to the Episode you were on, It's very useful.

Also if I recall, episode meta should be cached in order to load faster. Will probably look into it and see what we can do.

jrh03 commented 5 months ago

Yeah thinking about the cache, it does help, I think it's just on a fresh start I sometimes have to scroll a lot of episodes.

I'm guessing it could be a lot to change the smart scrolling to go to whatever the correct page would be- not something I'd considered.

Again, would be happy to explore with it myself too once I get my head around the codebase.

Goldenfreddy0703 commented 5 months ago

Oh of course, please feel free to look in our code, we would be happy to accept new contributors to help us.

Goldenfreddy0703 commented 5 months ago

@Gujal00 sorry to ping you but have a big question for you? I know episode meta is being cached which is great and all but if a new episodes comes out, does that mean the whole thing would have to be cached again or does the new episode get cached?

If i can get a response, that would be great thank you.

Gujal00 commented 5 months ago

show meta table is different from episode table. There was some stuff done on every Kodi startup by database_sync,py which is supposed to pull any new episodes for currently airing series in the metadb but dont think it has ever worked properly. Show meta is not pulled each time as that is independent of the seasons/episodes.

Goldenfreddy0703 commented 5 months ago

show meta table is different from episode table. There was some stuff done on every Kodi startup by database_sync,py which is supposed to pull any new episodes for currently airing series in the metadb but dont think it has ever worked properly. Show meta is not pulled each time as that is independent of the seasons/episodes.

Interesting I may wanna look into that and see how that works, if it needs extra information like episode count or airdata, I can probably help with that. Thank you

joezito129 commented 5 months ago

when a new episode comes out it re-caches every episode again in the series which is why it is so slow. also when creating xbmcgui.listitem you can set offscreen=true this will speed up the code greatly i dont know why its not set to true by default.

Goldenfreddy0703 commented 5 months ago

Tbh, I kinda forgot to set that when I was making previous changes. Will have that set to true instead of false. 😅

Thank you for pointing that out.

jewbmx commented 4 months ago

While yall are talking speed id suggest moving the auto update code that we use to check for updates or adding a setting to disable it. It seems to get triggered alot on my end which slows things down a lil.

joezito129 commented 4 months ago

in the simkl.py in the indexer folder line 127: result_ep = database.get(self.get_anilist_meta, 6, anilist_id) if diff > 0 else {}

you can change the 0 to a higher number this is how many days it will check for updates I usually set mine to 6 or 7 so it only checks for new episodes once a week not everyday