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 = lib_utils.is_videoid_in_db(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 lib_utils.is_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 lib_export(self, pathitems, videoid=None): # pylint: disable=unused-argument """Export or update an item to the Kodi library""" if videoid.mediatype in [common.VideoId.SUPPLEMENTAL, common.VideoId.EPISODE]: return if lib_utils.is_videoid_in_db(videoid): get_library_cls().update_library(videoid) else: get_library_cls().export_to_library(videoid) common.container_refresh()