refresh list of items by loop
#1
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)
Reply
#2
Kodi content plugins are by design stateless. It means that after xbmcplugin.endOfDirectory() plugin's work is done and control is passed to Kodi which handles the routine stuff: displaying text and graphics, user interaction etc. I'm not saying that what you want is impossible, but the solution must be non-trivial. I also have some doubts about user experience. A content list refreshing every 5 seconds will probably be very annoying.

BTW, please use forum tools to format your code properly. With Python being indentation-sensitive language, your code sample is unreadable mess.
Reply

Logout Mark Read Team Forum Stats Members Help
refresh list of items by loop0