2018-01-23, 13:04
I want to run a function every time i select a video, but kodi only run the function when i enter the addon, here is the code for addon:
I just wanna know how to run the function every time i select a video?
cpp:import sys
import xbmcgui
import xbmcplugin
import requests
infile=[name1,name2]
addon_handle = int(sys.argv[1])
xbmcplugin.setContent(addon_handle, 'movies')
def buildurl():
#function that return something that change every time i select channel
return c
def addDir(name,url,mode,iconimage):
u = url
li = xbmcgui.ListItem(name, iconImage='DefaultVideo.png')
#xbmc.Player().play(item=url, listitem=li)
ok=xbmcplugin.addDirectoryItem(handle=addon_handle, url=u, listitem=li)
return ok
for line in infile:
name=str(line)
url='http://'+str(line)+buildurl()
addDir(name,url,1,'')
xbmcplugin.endOfDirectory(addon_handle)
I just wanna know how to run the function every time i select a video?