X-Git-Url: http://git.code-monkey.de/?p=plugin.video.netflix.git;a=blobdiff_plain;f=resources%2Flib%2FKodiHelper.py;h=0e5b6617de3696a9ba009cee73df3dcf1b84184c;hp=c468330f81cb66298813989a2224ad4503db4d09;hb=885d0084883d67d0c9a58669baebb25f097b47dc;hpb=2923983f7fa35da85af850617cf6399353c86dc8 diff --git a/resources/lib/KodiHelper.py b/resources/lib/KodiHelper.py index c468330..0e5b661 100644 --- a/resources/lib/KodiHelper.py +++ b/resources/lib/KodiHelper.py @@ -282,22 +282,6 @@ class KodiHelper: """Invalidates the memory cache""" xbmcgui.Window(xbmcgui.getCurrentWindowId()).setProperty('memcache', pickle.dumps({})) - def has_cached_item (self, cache_id): - """Checks if the requested item is in memory cache - - Parameters - ---------- - cache_id : :obj:`str` - ID of the cache entry - - Returns - ------- - bool - Item is cached - """ - cached_items = pickle.loads(xbmcgui.Window(xbmcgui.getCurrentWindowId()).getProperty('memcache')) - return cache_id in cached_items.keys() - def get_cached_item (self, cache_id): """Returns an item from the in memory cache @@ -312,9 +296,8 @@ class KodiHelper: Contents of the requested cache item or none """ cached_items = pickle.loads(xbmcgui.Window(xbmcgui.getCurrentWindowId()).getProperty('memcache')) - if self.has_cached_item(cache_id) != True: - return None - return cached_items[cache_id] + + return cached_items.get(cache_id) def add_cached_item (self, cache_id, contents): """Adds an item to the in memory cache @@ -476,7 +459,7 @@ class KodiHelper: if video_list[video_list_id]['type'] == 'movie': # it´s a movie, so we need no subfolder & a route to play it isFolder = False - url = build_url({'action': 'play_video', 'video_id': video_list_id}) + url = build_url({'action': 'play_video', 'video_id': video_list_id, 'infoLabels': infos}) else: # it´s a show, so we need a subfolder & route (for seasons) isFolder = True @@ -650,7 +633,7 @@ class KodiHelper: # add list item info li, infos = self._generate_entry_info(entry=episode, li=li, base_info={'mediatype': 'episode'}) li = self._generate_context_menu_items(entry=episode, li=li) - url = build_url({'action': 'play_video', 'video_id': episode_id, 'start_offset': episode['bookmark']}) + url = build_url({'action': 'play_video', 'video_id': episode_id, 'start_offset': episode['bookmark'], 'infoLabels': infos}) xbmcplugin.addDirectoryItem(handle=self.plugin_handle, url=url, listitem=li, isFolder=False) xbmcplugin.addSortMethod(handle=self.plugin_handle, sortMethod=xbmcplugin.SORT_METHOD_EPISODE) @@ -663,7 +646,7 @@ class KodiHelper: xbmcplugin.endOfDirectory(self.plugin_handle) return True - def play_item (self, esn, video_id, start_offset=-1): + def play_item (self, esn, video_id, start_offset=-1, infoLabels={}): """Plays a video Parameters @@ -676,6 +659,9 @@ class KodiHelper: start_offset : :obj:`str` Offset to resume playback from (in seconds) + + infoLabels : :obj:`str` + the listitem's infoLabels Returns ------- @@ -713,6 +699,9 @@ class KodiHelper: # check if we have a bookmark e.g. start offset position if int(start_offset) > 0: play_item.setProperty('StartOffset', str(start_offset) + '.0') + # set infoLabels + if len(infoLabels) > 0: + play_item.setInfo('video', infoLabels) return xbmcplugin.setResolvedUrl(self.plugin_handle, True, listitem=play_item) def _generate_art_info (self, entry, li):