def _ctx_item(template, videoid, params=None): """Create a context menu item based on the given template and videoid""" # Do not move the import to the top of the module header, see context_menu_utils.py from resources.lib.kodi.context_menu_utils import CONTEXT_MENU_ACTIONS return (CONTEXT_MENU_ACTIONS[template]['label'], common.run_plugin_action(CONTEXT_MENU_ACTIONS[template]['url']( videoid, params)))
def _create_profile_item(profile_guid, is_selected): profile_name = G.LOCAL_DB.get_profile_config('profileName', '???', guid=profile_guid) profile_attributes = [] if G.LOCAL_DB.get_profile_config('isPinLocked', False, guid=profile_guid): profile_attributes.append('[COLOR red]' + common.get_local_string(20068) + '[/COLOR]') if G.LOCAL_DB.get_profile_config('isAccountOwner', False, guid=profile_guid): profile_attributes.append(common.get_local_string(30221)) if G.LOCAL_DB.get_profile_config('isKids', False, guid=profile_guid): profile_attributes.append(common.get_local_string(30222)) attributes_desc = '[CR]'.join(profile_attributes) + '[CR]' if profile_attributes else '' description = attributes_desc + '[' + G.LOCAL_DB.get_profile_config('language_desc', '', guid=profile_guid) + ']' menu_action = common.run_plugin_action(common.build_url(pathitems=['autoselect_profile_set'], params={'profile_name': profile_name.encode('utf-8'), 'profile_guid': profile_guid}, mode=G.MODE_ACTION)) dict_item = { 'label': profile_name, 'properties': {'nf_guid': profile_guid, 'nf_description': description.replace('[CR]', ' - ')}, 'art': {'icon': G.LOCAL_DB.get_profile_config('avatar', '', guid=profile_guid)}, 'info': {'plot': description}, # The description 'is_selected': is_selected, 'menu_items': [(common.get_local_string(30056), menu_action)], 'url': common.build_url(pathitems=['home'], params={'switch_profile_guid': profile_guid}, mode=G.MODE_DIRECTORY), 'is_folder': True } return dict_item
def _sync_library(videoid, operation): operation = { 'add': 'export_silent', 'remove': 'remove_silent'}.get(operation) if operation and g.ADDON.getSettingBool('mylist_library_sync'): common.debug('Syncing library due to change of my list') # We need to wait a little before syncing the library to prevent race # conditions with the Container refresh common.schedule_builtin( '00:03', common.run_plugin_action( common.build_url([operation], videoid, mode=g.MODE_LIBRARY)), name='NetflixLibrarySync')
def _sync_library(videoid, operation): operation = { 'add': 'export_silent', 'remove': 'remove_silent' }.get(operation) if operation and g.ADDON.getSettingBool('mylist_library_sync'): # This is a temporary workaround to prevent export from mylist of non owner account profiles # TODO: in the future you can also add the possibility to synchronize from a chosen profile is_account_owner = g.LOCAL_DB.get_profile_config( 'isAccountOwner', False) if not is_account_owner: return common.debug('Syncing library due to change of my list') # We need to wait a little before syncing the library to prevent race # conditions with the Container refresh common.schedule_builtin('00:03', common.run_plugin_action( common.build_url([operation], videoid, mode=g.MODE_LIBRARY)), name='NetflixLibrarySync')
def _create_profile_item(profile_guid, is_active): profile_name = g.LOCAL_DB.get_profile_config('profileName', '???', guid=profile_guid) description = [] if g.LOCAL_DB.get_profile_config('isAccountOwner', False, guid=profile_guid): description.append(common.get_local_string(30221)) if g.LOCAL_DB.get_profile_config('isKids', False, guid=profile_guid): description.append(common.get_local_string(30222)) menu_action = common.run_plugin_action(common.build_url(pathitems=['autoselect_profile_set'], params={'profile_name': profile_name.encode('utf-8'), 'profile_guid': profile_guid}, mode=g.MODE_ACTION)) dict_item = { 'title': profile_name, 'art': {'icon': g.LOCAL_DB.get_profile_config('avatar', '', guid=profile_guid)}, 'info': {'plot': ', '.join(description)}, # The description 'is_selected': is_active, 'menu_items': [(common.get_local_string(30056), menu_action)], 'url': common.build_url(pathitems=['home'], params={'switch_profile_guid': profile_guid}, mode=g.MODE_DIRECTORY), 'is_folder': True } return dict_item
def _ctx_item(template, videoid): """Create a context menu item based on the given template and videoid""" return (CONTEXT_MENU_ACTIONS[template]['label'], common.run_plugin_action( CONTEXT_MENU_ACTIONS[template]['url'](videoid)))