예제 #1
0
def update_cache_videoid_runtime(window_cls):
    """Try to update the bookmarkPosition value in cache data in order to get a updated watched status/resume time"""
    # Other details in:
    # progress_manager.py method: _save_resume_time()
    # infolabels.py method: _set_progress_status()
    runtime = window_cls.getProperty('nf_playback_resume_time')
    if runtime and runtime.isdigit():
        from resources.lib.api.data_types import VideoList, VideoListSorted, EpisodeList, SearchVideoList
        from resources.lib.cache import CacheMiss
        from resources.lib.database.db_utils import TABLE_SESSION
        from resources.lib.common import VideoId
        cache_last_dir_call = g.LOCAL_DB.get_value('cache_last_directory_call', {}, table=TABLE_SESSION)
        if not cache_last_dir_call:
            return
        videoid = VideoId.from_dict(g.LOCAL_DB.get_value('last_videoid_played', {}, table=TABLE_SESSION))
        try:
            data_object = g.CACHE.get(cache_last_dir_call['bucket'], cache_last_dir_call['identifier'])
            if isinstance(data_object, (VideoList, VideoListSorted, SearchVideoList)):
                data_object.videos[str(videoid.value)]['bookmarkPosition'] = int(runtime)
            elif isinstance(data_object, EpisodeList):
                data_object.episodes[str(videoid.value)]['bookmarkPosition'] = int(runtime)
            else:
                error('update_cache_videoid_runtime: cache object not mapped, bookmarkPosition not updated')
            g.CACHE.update(cache_last_dir_call['bucket'], cache_last_dir_call['identifier'], data_object,
                           cache_last_dir_call['to_disk'])
        except CacheMiss:
            # No more valid cache, manual update not needed
            pass
        window_cls.setProperty('nf_playback_resume_time', '')
예제 #2
0
 def get_episodes(self, pathitems, seasonid_dict, perpetual_range_start):
     seasonid = VideoId.from_dict(seasonid_dict)
     episodes_list = self.req_episodes(
         seasonid, perpetual_range_start=perpetual_range_start)
     return build_episode_listing(episodes_list, seasonid, pathitems)
예제 #3
0
 def get_seasons(self, pathitems, tvshowid_dict, perpetual_range_start):
     tvshowid = VideoId.from_dict(tvshowid_dict)
     season_list = self.req_seasons(
         tvshowid, perpetual_range_start=perpetual_range_start)
     return build_season_listing(season_list, tvshowid, pathitems)
예제 #4
0
 def get_video_list_supplemental(self, menu_data, video_id_dict,
                                 supplemental_type):
     video_list = self.req_video_list_supplemental(
         VideoId.from_dict(video_id_dict),
         supplemental_type=supplemental_type)
     return build_video_listing(video_list, menu_data, mylist_items=[])