Tikipeter / tikipeter.github.io

81 stars 15 forks source link

just want your thoughts on this please #123

Closed hcgiub001 closed 2 weeks ago

hcgiub001 commented 2 weeks ago

Hey Tikipeter, okay so I don't code but I like patterns. and I think I've noticed a pattern that explains why people think Stremio is faster. In kodi we have a skin and we have addons. In stremio the addon is the skin. the reason why widgets take time to load is because the skin has to communicate with addon and can only get information in sequential order, you can't thread as much. In streamio the widgets get it's information not from addons but directly through api for the metadata. I came across that realization when you added "more like this" and how you told me each widget is threaded and each item in the widget is also threaded. so effectively, every single item across all widgets run at the same time. it won't wait for the slowest. people lament that kodi widgets is a let down but this is just how we use kodi, nothing stopping say a skin developer creating it's own addon, so when it asks for wifget information from the addon you can show it what api calls you are making and the skin will make those api calls instead of communicating with the addon anymore.

but something else hit me, your extra menu is just a widget screen (with other additions) but you limit it to certain things. so got me thinking. Fenlite / Umbrella / POV are all addons that individually could cater for a large majority of users. pretty sure it covers almost everyone's basis so I bet lots of people just use widget location inside Fenlite.

so why do they need to use the skin to access the content in Fenlite. You already have a way to create a structure, your folder system.

why not create another custom window (similar to Extra menu) and call it Widget screen.

so the way it would work is like this. I want to be able to create a folder structure and add the content I want so say I create "movies" folder and have items as latest releases blockbusters most popular.

Now I want to be able to right click the folder and assign it a normal folder or a widget folder. if it's a widget folder I get the widget custom window and each line I have the widgets so it will read like

Latest Releases [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ]

BlockBusters [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ]

Most Popular [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ]

You pretty much have already done most of the codes to load widgets. but you never let people choose what widgets they want to see in their own custom widget screen

I've learnt from you the widget screen loading will be almost instant, and everything could be threaded. we can even have many widget windows this way. and when someone clicks on a widget the extra menu comes up.

so you'll have to maintain window stack from extras menu to widget screen but it really could be amazing to be able to have 10 widgets load instantly , no waiting. and you even have random folders and you have cached folders too.

this has been bugging me and I had to say it. I just wanted your thoughts on the idea. I don't care if it's implemented. I don't even like widgets but I want to know if my understanding of stremio vs kodi is correct. and do you think you can turn Fenlite folders into widgets with not so much coding?

I bet people will use the folders more and you can set it so widgets load when people click Fenlite too

Tikipeter commented 2 weeks ago

Little background first...

Skins have very rudimentary support for what they can do when it comes to loading content. They can provide Kodi with a path. That path could be a common Kodi library node (to display the contents of your Kodi library), or it can be the path to an addon function. If it is a path to an addon function, then Kodi will call the addon, and the addon will make the listitems and return them to Kodi. Kodi will then use them where the skin has the addon path for <content>.

The issue here is that each call for addon content is, as far as I can tell, a new execution of executebuiltin. Executebuiltin will use a new instance of python, and call the addon for info. This is very slow. As an example, clicking a movie from a home screen widget for playback you will see a brief "busy" animation before the scraping window appears. Clicking the same movie from within the addon should provide instantaneous execution of the scraping window. That's because, again, the executebuiltin is being used for Kodi to run the url of the movie and begin the process. Same thing happens when bringing up the Extras window, or even the options dialog from the context menu. There is a delay when using home screen widgets that aren't present when using the addon directly.

I'm sure some of what I wrote above is not 100% correct, I don't know the ins and outs of Kodi so am just relying on years of doing this stuff, but I think it's fairly accurate as to what's going on with home screen widgets.

As an experiment, turn off "Reuse Language Invoker" in Fen Light's Tools menu, and then navigate around Fen Light. That will give you an example of the hit in speed when a new python instance is being used for every command within the addon. Don't forget to turn it back on again though :). That is what all the widgets on the home window are using essentially. We restart with a new python instance for every command from the home window.

Your suggestion

Believe me, I have thought about this many times. If I had a custom Fen Light "home window", that would load when Kodi starts, then I would be able to load all the widgets myself and it would generally be a lot faster. There would be a delay when Kodi first starts as it needs to audit all the addons installed and start all their service modules, but after that the window would load and the widgets would be as fast as they can be.

Every few weeks I think about it, and I have a fair idea in my head of how I could achieve it. The issue is it's quite a big job to implement. There are some issues that I can envision and can't quite get my head around. I can't even remember what they are at this point (I'm getting old), but it's stopped me seriously considering it in the past.

To be honest, I'd not thought of utilizing the Shortcut Folders to achieve this, which is an interesting way of going about it. And might be easier than other methods. I like that idea a lot.

I also thought of having custom windows for the media lists within the addon itself. The other area Kodi is very slow is with simply making a list of media items. You'll have seen how a list of 100 movies takes longer than a list of 20 movies to load. If they loaded into a custom window, it would be almost instantaneous no matter how many list items there were (within reason of course). A 500 item list would load almost as fast as a 50 item list. Kodi is very slow loading media lists itself.

Another potential feature that can be implemented if custom windows were used would be infinite scrolling. That is a Kodi container limitation born mainly by the fact that Kodi is inherently designed to showcase your media library, which isn't paginated.

All these things have gone through my head many times. I'm hoping to have a holiday from work soon (nearly 8 months overdue) at which point I'm sure I'll get bored and knock out some of these other pending requests and then maybe look at something like this. Hopefully.

hcgiub001 commented 2 weeks ago

Thanks for such a detailed and insightful posts. I tried Reuse Language Invoker and indeed it wasn't fun lol the stuff will load into a wall view type then it will take time to change to the view type I wanted, also things loaded fractions slower (because the items weren't many in the first place), yeah I changed that back lol

I bet when people talk about the slowness that itch comes back to you lol Honestly I just wanted to get this out and now I have I'm content with how things are hahaha. I should be more thoughtful of your limited time. Your ideas sound awesome. Your addons are shaping what Kodi is and is becoming.

Don't use your holiday time on kodi. take a break and enjoy your time. Just leave the requests like other Developers are doing, people including me will get the idea, that you'll consider if you have time or the motivation. But I appreciate you talking me though this. now that I've seen some of your ideas I'm content lol

Hope you get your holiday soon and enjoy it :)

hcgiub001 commented 2 weeks ago

do you realise you call your addon Fen Light when it's Fen Lite? LOL

Tikipeter commented 2 weeks ago

Lol.

It's both, so I can get away with calling it either. Addon name is Fen Light, addon icon is Fen Lite.

You're never going to un-see that now. It might drive you mad. :)

hcgiub001 commented 2 weeks ago

So I found a skin that integrates widgets from api calls and not from addons https://forum.kodi.tv/showthread.php?tid=371037

made a post on reddit and wow, I did zero setup for any widgets, its basically an addon that relies on TMDBhelper which relies on addons to get source, but the loading speed is insane

Tikipeter commented 2 weeks ago

Skins can't make api calls. It's just a skin with some default widgets from TMDbHelper.

hcgiub001 commented 2 weeks ago

that makes sense, I thought it was doing something special, thanks