fixed nextepisodes updating by removing the caching

This commit is contained in:
Marcel van der Veldt 2015-08-06 13:01:33 +02:00
parent c7c35fd442
commit aacd72486e

View file

@ -437,20 +437,7 @@ def BrowseChannels(id, folderid=None):
##### GET NEXTUP EPISODES FOR TAGNAME ##### ##### GET NEXTUP EPISODES FOR TAGNAME #####
def getNextUpEpisodes(tagname,limit): def getNextUpEpisodes(tagname,limit):
count=0 count=0
#try to load from cache first
win = xbmcgui.Window( 10000 )
data = win.getProperty("emby.widget.nextup." + tagname)
if data and not win.getProperty("clearwidgetcache") == "clear":
data = json.loads(data)
for item in data:
liz = createListItem(item)
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=item['file'], listitem=liz)
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
else:
episodes = list()
addonSettings = xbmcaddon.Addon(id='plugin.video.emby') addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
win.clearProperty("clearwidgetcache")
#if the addon is called with nextup parameter, we return the nextepisodes list of the given tagname #if the addon is called with nextup parameter, we return the nextepisodes list of the given tagname
xbmcplugin.setContent(int(sys.argv[1]), 'episodes') xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
# First we get a list of all the in-progress TV shows - filtered by tag # First we get a list of all the in-progress TV shows - filtered by tag
@ -472,13 +459,10 @@ def getNextUpEpisodes(tagname,limit):
if json_query2.has_key('result') and json_query2['result'].has_key('episodes'): if json_query2.has_key('result') and json_query2['result'].has_key('episodes'):
for item in json_query2['result']['episodes']: for item in json_query2['result']['episodes']:
liz = createListItem(item) liz = createListItem(item)
episodes.append(item)
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=item['file'], listitem=liz) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=item['file'], listitem=liz)
count +=1 count +=1
if count == limit: if count == limit:
break break
#use window prop as cache
win.setProperty("emby.widget.nextup." + tagname, json.dumps(episodes))
xbmcplugin.endOfDirectory(handle=int(sys.argv[1])) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
def getInProgressEpisodes(tagname,limit): def getInProgressEpisodes(tagname,limit):