def get_upnext_info(videoid, current_episode, metadata): """Determine next episode and send an AddonSignal to UpNext addon""" try: next_episode_id = _find_next_episode(videoid, metadata) except (TypeError, KeyError): # import traceback # common.debug(traceback.format_exc()) common.debug('There is no next episode, not setting up Up Next') return {} common.debug('Next episode is {}', next_episode_id) next_episode = infolabels.get_info_for_playback(next_episode_id, True) next_info = { 'current_episode': _upnext_info(videoid, *current_episode), 'next_episode': _upnext_info(next_episode_id, *next_episode) } if (xbmc.getInfoLabel('Container.PluginName') != g.ADDON.getAddonInfo('id') and library.is_in_library(next_episode_id)): filepath = g.SHARED_DB.get_episode_filepath(next_episode_id.tvshowid, next_episode_id.seasonid, next_episode_id.episodeid) # next_info['play_info'] = {'play_path': g.py2_decode(xbmc.translatePath(filepath))} next_info['play_url'] = g.py2_decode(xbmc.translatePath(filepath)) else: # next_info['play_info'] = {'play_path': common.build_url(videoid=next_episode_id, # mode=g.MODE_PLAY)} next_info['play_url'] = common.build_url(videoid=next_episode_id, mode=g.MODE_PLAY) if 'creditsOffset' in metadata[0]: next_info['notification_offset'] = metadata[0]['creditsOffset'] return next_info
def _generate_library_ctx_items(videoid, lib_auto_upd_mode): library_actions = [] allow_lib_operations = True lib_is_sync_with_mylist = (g.ADDON.getSettingBool('lib_sync_mylist') and lib_auto_upd_mode == 2) if lib_is_sync_with_mylist: # If the synchronization of Netflix "My List" with the Kodi library is enabled # only in the chosen profile allow to do operations in the Kodi library otherwise # it creates inconsistency to the exported elements and increases the work for sync sync_mylist_profile_guid = g.SHARED_DB.get_value( 'sync_mylist_profile_guid', g.LOCAL_DB.get_guid_owner_profile()) allow_lib_operations = sync_mylist_profile_guid == g.LOCAL_DB.get_active_profile_guid( ) if allow_lib_operations: _is_in_library = is_in_library(videoid) if lib_is_sync_with_mylist: if _is_in_library: library_actions = ['update'] else: library_actions = ['remove', 'update' ] if _is_in_library else ['export'] if videoid.mediatype == common.VideoId.SHOW and _is_in_library: library_actions.append('export_new_episodes') if show_excluded_from_auto_update(videoid): library_actions.append('include_in_auto_update') else: library_actions.append('exclude_from_auto_update') return [_ctx_item(action, videoid) for action in library_actions]
def _generate_library_ctx_items(videoid): library_actions = [] if videoid.mediatype == common.VideoId.SUPPLEMENTAL: return library_actions allow_lib_operations = True lib_is_sync_with_mylist = g.ADDON.getSettingBool('lib_sync_mylist') if lib_is_sync_with_mylist: # If the synchronization of Netflix "My List" with the Kodi library is enabled # only in the chosen profile allow to do operations in the Kodi library otherwise # it creates inconsistency to the exported elements and increases the work for sync sync_mylist_profile_guid = g.SHARED_DB.get_value('sync_mylist_profile_guid', g.LOCAL_DB.get_guid_owner_profile()) allow_lib_operations = sync_mylist_profile_guid == g.LOCAL_DB.get_active_profile_guid() if allow_lib_operations: is_in_library = library.is_in_library(videoid) if lib_is_sync_with_mylist: if is_in_library: library_actions = ['update'] else: library_actions = ['remove', 'update'] if is_in_library else ['export'] # If auto-update mode is Manual and mediatype is season/episode do not allow operations if g.ADDON.getSettingInt('lib_auto_upd_mode') == 0 and \ videoid.mediatype in [common.VideoId.SEASON, common.VideoId.EPISODE]: library_actions = [] if videoid.mediatype == common.VideoId.SHOW and is_in_library: library_actions.append('export_new_episodes') if library.show_excluded_from_auto_update(videoid): library_actions.append('include_in_auto_update') else: library_actions.append('exclude_from_auto_update') return [_ctx_item(action, videoid) for action in library_actions]
def _generate_library_ctx_items(videoid): library_actions = [] if videoid.mediatype == common.VideoId.SUPPLEMENTAL: return library_actions is_in_library = library.is_in_library(videoid) library_actions = ['remove', 'update'] if is_in_library else ['export'] if g.ADDON.getSettingInt('auto_update') and \ videoid.mediatype in [common.VideoId.SEASON, common.VideoId.EPISODE]: library_actions = [] if videoid.mediatype == common.VideoId.SHOW and is_in_library: library_actions.append('export_new_episodes') if library.show_excluded_from_auto_update(videoid): library_actions.append('include_in_auto_update') else: library_actions.append('exclude_from_auto_update') return [_ctx_item(action, videoid) for action in library_actions]
def _generate_library_ctx_items(videoid): if videoid.mediatype == common.VideoId.SUPPLEMENTAL: return [] library_actions = (['remove', 'update'] if library.is_in_library(videoid) else ['export']) return [_ctx_item(action, videoid) for action in library_actions]
def _generate_library_ctx_items(videoid): library_actions = (['remove', 'update'] if library.is_in_library(videoid) else ['export']) return [_ctx_item(action, videoid) for action in library_actions]