2016-11-25, 17:59
hi, i have my own api site with just two streams and I made a little plugin in kodi for this, so is it possible to refresh the list every 5 seconds or so?
ive tried
curSeconds = time.time()
while (time.time() - curSeconds <= 10):
#do some serial sending here
getdata()
time.sleep(2.0)
and I can see in the nginx log thats its connection every 2 seconds, but the list doesnt get updated
function looks like this
def getdata():
url = "https://mysits.net/live.php"
ssurl = "https://mysits.net/stream.mp4"
response = urllib.urlopen(url)
data = json.loads(response.read())
listing = []
for kanal in data:
list_item = xbmcgui.ListItem(label=showme)
list_item.setProperty('fanart_image', img)
list_item.setInfo('video', {'title': showme, 'genre': 'TV', 'plot': plot})
list_item.setProperty('IsPlayable', 'true')
url = stream
is_folder = False
listing.append((url, list_item, is_folder))
xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
xbmcplugin.endOfDirectory(_handle)
ive tried
curSeconds = time.time()
while (time.time() - curSeconds <= 10):
#do some serial sending here
getdata()
time.sleep(2.0)
and I can see in the nginx log thats its connection every 2 seconds, but the list doesnt get updated
function looks like this
def getdata():
url = "https://mysits.net/live.php"
ssurl = "https://mysits.net/stream.mp4"
response = urllib.urlopen(url)
data = json.loads(response.read())
listing = []
for kanal in data:
list_item = xbmcgui.ListItem(label=showme)
list_item.setProperty('fanart_image', img)
list_item.setInfo('video', {'title': showme, 'genre': 'TV', 'plot': plot})
list_item.setProperty('IsPlayable', 'true')
url = stream
is_folder = False
listing.append((url, list_item, is_folder))
xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
xbmcplugin.endOfDirectory(_handle)