2014-12-19, 09:54
I am looking for a way to load the URLs of DirectoryItems in my addon when they are selected, rather than when loading the directory.
My addon currently loads the URLs of 20 livestreams in succession when the addon is loaded (when the addon name is selected in the ‘Video Add-ons’ menu), which takes a considerable length of time. I would like for this not to happen, by fetching the URL of each livestream only when it is accessed.
Is there any way I can do this, aside from putting each DirectoryItem into its own directory?
My code currently looks like this:
My addon currently loads the URLs of 20 livestreams in succession when the addon is loaded (when the addon name is selected in the ‘Video Add-ons’ menu), which takes a considerable length of time. I would like for this not to happen, by fetching the URL of each livestream only when it is accessed.
Is there any way I can do this, aside from putting each DirectoryItem into its own directory?
My code currently looks like this:
Code:
def addStream(channelID, channelName):
#Fetch the stream URL from the server.
...
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
addStream(...)
addStream(...)
addStream(...)
addStream(...)
addStream(...)
addStream(...)
addStream(...)
addStream(...)
addStream(...)
...
xbmcplugin.endOfDirectory(addon_handle)