2019-12-09, 15:38
Hi!
I've spent a couple of days tinkering with the Plugin API (specifically, Video Plugin), looked at examples and wrote my own one that's already very functional and useful to me. Thanks to everyone who is and was involved in building Kodi and documenting the APIs!
But there are just some things I cannot make sense of and hope that you can help me with that.
Right now, for all the list items that are supposed to behave like folders (like a tvshow entry in a list of tvshows and a season entry in a list of tvshow seasons) I use
where mediatype is `tvshow` for a directory of seasons and `season` for a directory of episodes. Is this right? I noticed that when I select such an entry in Kodi and hit the info butten, I get presented with what I expect to see: A dialog with a lot of meta information about a show/season. I also see a "browse" button at the bottom. But klicking this "browse" button somehow tries to "play" the directory instead of just "openening" it. I can see in kodi.log that a Video player is trying to play the directory 5 times before it gives up. Am I doing something wrong here or is this a known bug? The Youtube plugin seems to have the same problem.
Then, I'm also trying to optimize things. I have a list that is kind of large (around 250 entries but with a lot of meta information like cast, studio, art etc) and it takes the Raspberry PI 3 with Kodi 18.4 a couple of seconds to load it. Is there a way to speed this up? I'm almost sure most of the time is spent transforming the JSON data and feeding it to kodi. Is it possible feed Kodi with the data in multiple passes? Like first pass = only the labels, 2nd pass = the remainder of the metadata? I also tried to feed Kodi with multiple chunks by calling addDirectoryItems more than once with a correctly set totalItems parameter. I kind of expected this to make Kodi show the first couple of entries to the user immediately before endOfDirectory is invoked. But this does not seem to happen and I still see the turning wheels for a couple of seconds. Any other ideas? Is this perhaps related to the "resume:false" argument that my plugin always receives? What's the meaning of that? In what situations could it be 'resume:true'? How do I control that? I did not find the documentation for a plugin's arguments.
Also, I don't really understand caching. endDirectory accepts a cacheToDisc parameter. In the documentation it says "[opt] bool - True=Folder will cache if extended time(default)/False=this folder will never cache to disc." What does "if extended time" mean? Does the Kodi Python Plugin API support something like the HTTP if-modified-since header with which Kodi could ask the Plugin whether the old list is still valid or it should expect to receive a new one?
Thank you in advance!
I've spent a couple of days tinkering with the Plugin API (specifically, Video Plugin), looked at examples and wrote my own one that's already very functional and useful to me. Thanks to everyone who is and was involved in building Kodi and documenting the APIs!
But there are just some things I cannot make sense of and hope that you can help me with that.
Right now, for all the list items that are supposed to behave like folders (like a tvshow entry in a list of tvshows and a season entry in a list of tvshow seasons) I use
python:
item = xbmcgui.ListItem(...)
...
item.setIsFolder(true)
item.setProperty('isPlayable',false)
item.setInfo('video',{
...
'mediatype': mediatype
...
})
where mediatype is `tvshow` for a directory of seasons and `season` for a directory of episodes. Is this right? I noticed that when I select such an entry in Kodi and hit the info butten, I get presented with what I expect to see: A dialog with a lot of meta information about a show/season. I also see a "browse" button at the bottom. But klicking this "browse" button somehow tries to "play" the directory instead of just "openening" it. I can see in kodi.log that a Video player is trying to play the directory 5 times before it gives up. Am I doing something wrong here or is this a known bug? The Youtube plugin seems to have the same problem.
Then, I'm also trying to optimize things. I have a list that is kind of large (around 250 entries but with a lot of meta information like cast, studio, art etc) and it takes the Raspberry PI 3 with Kodi 18.4 a couple of seconds to load it. Is there a way to speed this up? I'm almost sure most of the time is spent transforming the JSON data and feeding it to kodi. Is it possible feed Kodi with the data in multiple passes? Like first pass = only the labels, 2nd pass = the remainder of the metadata? I also tried to feed Kodi with multiple chunks by calling addDirectoryItems more than once with a correctly set totalItems parameter. I kind of expected this to make Kodi show the first couple of entries to the user immediately before endOfDirectory is invoked. But this does not seem to happen and I still see the turning wheels for a couple of seconds. Any other ideas? Is this perhaps related to the "resume:false" argument that my plugin always receives? What's the meaning of that? In what situations could it be 'resume:true'? How do I control that? I did not find the documentation for a plugin's arguments.
Also, I don't really understand caching. endDirectory accepts a cacheToDisc parameter. In the documentation it says "[opt] bool - True=Folder will cache if extended time(default)/False=this folder will never cache to disc." What does "if extended time" mean? Does the Kodi Python Plugin API support something like the HTTP if-modified-since header with which Kodi could ask the Plugin whether the old list is still valid or it should expect to receive a new one?
Thank you in advance!