本文整理汇总了Python中resources.utility.generic_utility.get_setting函数的典型用法代码示例。如果您正苦于以下问题:Python get_setting函数的具体用法?Python get_setting怎么用?Python get_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: videos
def videos(url, video_type, offset, run_as_widget=False):
if '' == offset:
page = 0
else:
page = int(offset)
loading_progress = show_loading_progress(run_as_widget)
xbmcplugin.setContent(plugin_handle, 'movies')
list_id = None
genre_id = None
if 'genre' in url:
genre_id = url.split('?')[1]
elif 'list?' in url:
data = url.split('?')[1]
if 'mylist' in data:
root_list = lolomos.get_root_list()
list_id = lolomos.get_mylist(root_list)[0]
else:
list_id = data
video_metadata = None
if list_id:
video_metadata = get.videos_in_list(list_id, page)
elif genre_id:
video_metadata = get.videos_in_genre(genre_id, page)
if video_metadata:
add_videos_to_directory(loading_progress, run_as_widget, video_metadata, video_type, page, url)
if generic_utility.get_setting('force_view') == 'true' and not run_as_widget:
xbmc.executebuiltin('Container.SetViewMode(' + generic_utility.get_setting('view_id_videos') + ')')
xbmcplugin.endOfDirectory(plugin_handle)
示例2: playInternal
def playInternal (self, video_id, series_id):
xbmc.audioSuspend()
self.disable_screensaver()
if generic_utility.get_setting('disable_lirc') == 'true':
xbmc.executebuiltin('LIRC.Stop')
try:
self.launch_browser('http://netflix.com/watch/%s' % video_id)
except:
generic_utility.log(traceback.format_exc(), xbmc.LOGERROR)
generic_utility.notification('Error launching browser. See logfile')
self.enable_screensaver()
xbmc.audioResume()
if generic_utility.get_setting('disable_lirc') == 'true':
xbmc.executebuiltin('LIRC.Start')
if generic_utility.get_setting('sync_viewstate') == 'true':
try:
self.update_playcount(video_id)
except:
generic_utility.log(traceback.format_exc(), xbmc.LOGERROR)
generic_utility.notification('Cannot update playcount. See logfile')
self.close()
示例3: add_context_menu_show
def add_context_menu_show(entries, removable, thumb_url, title, video_id):
if generic_utility.get_setting('browse_tv_shows') == 'true':
entries.append((generic_utility.get_string(30151),
'RunPlugin(plugin://%s/?mode=play_video_main&url=%s&thumb=%s)' % (
generic_utility.addon_id, urllib.quote_plus(video_id), urllib.quote_plus(thumb_url))))
else:
entries.append((generic_utility.get_string(30152),
'Container.Update(plugin://%s/?mode=list_seasons&url=%s&thumb=%s)' % (
generic_utility.addon_id, urllib.quote_plus(video_id), urllib.quote_plus(thumb_url))))
if generic_utility.get_setting('is_kid') == 'false':
if removable:
entries.append((generic_utility.get_string(30154), 'RunPlugin(plugin://%s/?mode=remove_from_queue&url=%s)' % (
generic_utility.addon_id, urllib.quote_plus(video_id))))
else:
entries.append((generic_utility.get_string(30155), 'RunPlugin(plugin://%s/?mode=add_to_queue&url=%s)' % (
generic_utility.addon_id, urllib.quote_plus(video_id))))
series_dir = library.get_series_dir(title.strip())
# generic_utility.log('series-dir: '+series_dir)
if xbmcvfs.exists(series_dir + os.sep) == False:
entries.append((generic_utility.get_string(30150),
'RunPlugin(plugin://%s/?mode=add_series_to_library&url=&name=%s&series_id=%s)' % (
generic_utility.addon_id, urllib.quote_plus(generic_utility.encode(title.strip())),
urllib.quote_plus(video_id))))
else:
entries.append((generic_utility.get_string(301501),
'RunPlugin(plugin://%s/?mode=remove_series_from_library&url=&name=%s)' % (
generic_utility.addon_id, urllib.quote_plus(generic_utility.encode(title.strip())))))
示例4: profile_selection
def profile_selection():
if generic_utility.get_setting('single_profile') == 'false':
if not generic_utility.get_setting('selected_profile') or generic_utility.get_setting('show_profiles') == 'true':
profiles.choose()
else:
profiles.load()
profiles.update_displayed()
示例5: index
def index():
add.directory(generic_utility.get_string(30100), '', 'main', '', 'movie', login_context=True)
add.directory(generic_utility.get_string(30101), '', 'main', '', 'tv', login_context=True)
add.directory(generic_utility.get_string(30102), '', 'wi_home', '', 'both', login_context=True)
if not generic_utility.get_setting('single_profile') == 'true':
add.item(
generic_utility.get_string(30103) + ' - [COLOR FF8E0000]' + generic_utility.get_setting('profile_name') + '[/COLOR]',
'choose_profile', login_context=True)
xbmcplugin.endOfDirectory(plugin_handle)
示例6: login
def login():
if not test:
login_progress = xbmcgui.DialogProgress()
login_progress.create('Netflix', generic_utility.get_string(30200) + '...')
generic_utility.progress_window(login_progress, 25, generic_utility.get_string(30201))
content = connect.load_netflix_site(generic_utility.main_url + 'Login', new_session=True, login_process=True)
if not 'Sorry, Netflix ' in content:
match = re.compile('locale: "(.+?)"', re.DOTALL|re.UNICODE).findall(content)
locale = None
if(len(match)) == 0:
match = re.compile('"pageName":"login","locale":"(.+?)"', re.DOTALL|re.UNICODE).findall(content)
if(len(match)) == 0:
generic_utility.error('Cannot find locale on page. content: '+content)
login_url = 'Login'
else:
locale = match[0]
login_url = 'Login?locale=' + locale
else:
locale = match[0]
login_url = 'Login?locale=' + locale
generic_utility.set_setting('language', locale)
post_data = {'authURL': generic_utility.get_setting('authorization_url'), 'email': generic_utility.get_setting('username'),
'password': generic_utility.get_setting('password'), 'RememberMe': 'on'}
if not test:
generic_utility.progress_window(login_progress, 50, generic_utility.get_string(30202))
content = connect.load_netflix_site(
generic_utility.main_url + login_url,
post=post_data, login_process=True)
if 'id="page-LOGIN"' in content:
if not test:
generic_utility.notification(generic_utility.get_string(30303))
return False
parse_data_set_cookies(content)
if not test:
generic_utility.progress_window(login_progress, 75, generic_utility.get_string(30203))
profile_selection()
if login_progress:
if not test:
if not generic_utility.progress_window(login_progress, 100, generic_utility.get_string(30204)):
return False
xbmc.sleep(500)
login_progress.close()
return True
else:
if not test:
generic_utility.notification(generic_utility.get_string(30300))
if login_progress:
login_progress.close()
return False
示例7: genre_info
def genre_info(video_type):
post_data = ''
if video_type == 'tv':
post_data = generic_utility.series_genre % generic_utility.get_setting('authorization_url')
elif video_type == 'movie':
post_data = generic_utility.movie_genre % generic_utility.get_setting('authorization_url')
else:
pass
content = connect.load_netflix_site(generic_utility.evaluator(), post=post_data)
return content
示例8: episodes
def episodes(series_id, season):
xbmcplugin.setContent(plugin_handle, 'episodes')
episodes = get.episodes_data(season, series_id)
for episode in episodes:
add.episode(episode)
if generic_utility.get_setting('force_view'):
xbmc.executebuiltin('Container.SetViewMode(' + generic_utility.get_setting('view_id_episodes') + ')')
xbmcplugin.addSortMethod(plugin_handle, xbmcplugin.SORT_METHOD_EPISODE)
xbmcplugin.endOfDirectory(plugin_handle)
示例9: profile_selection
def profile_selection():
if generic_utility.get_setting("single_profile") == "false":
if (
not generic_utility.get_setting("selected_profile")
or generic_utility.get_setting("show_profiles") == "true"
):
profiles.choose()
else:
profiles.load()
profiles.update_displayed()
示例10: viewing_activity
def viewing_activity(video_type, run_as_widget=False):
loading_progress = show_loading_progress(run_as_widget)
xbmcplugin.setContent(plugin_handle, 'movies')
metadata = get.viewing_activity_matches(video_type)
if len(metadata) > 0:
add_videos_to_directory(loading_progress, run_as_widget, metadata, video_type, viewing_activity=True)
else:
generic_utility.notification(generic_utility.get_string(30306))
if generic_utility.get_setting('force_view') and not run_as_widget:
xbmc.executebuiltin('Container.SetViewMode(' + generic_utility.get_setting('view_id_activity') + ')')
xbmcplugin.endOfDirectory(plugin_handle)
示例11: videos
def videos(url, video_type, offset, run_as_widget=False):
if '' == offset:
page = 0
else:
page = int(offset)
loading_progress = show_loading_progress(run_as_widget)
xbmcplugin.setContent(plugin_handle, 'movies')
video_ids = get.videos_matches(video_type, page, url)
load_videos_to_directory(loading_progress, run_as_widget, video_ids, video_type, page, url)
if generic_utility.get_setting('force_view') == 'true' and not run_as_widget:
xbmc.executebuiltin('Container.SetViewMode(' + generic_utility.get_setting('view_id_videos') + ')')
xbmcplugin.endOfDirectory(plugin_handle)
示例12: search
def search(search_string, video_type, run_as_widget=False):
loading_progress = None
if not run_as_widget:
loading_progress = xbmcgui.DialogProgress()
loading_progress.create('Netflix', generic_utility.get_string(30205) + '...')
generic_utility.progress_window(loading_progress, 0, '...')
xbmcplugin.setContent(plugin_handle, 'movies')
metadatas = get.videos_in_search(search_string)
# video_ids = get.search_matches(search_string, video_type)
add_videos_to_directory(loading_progress, run_as_widget, metadatas, video_type, 0, '')
if generic_utility.get_setting('force_view') and not run_as_widget:
xbmc.executebuiltin('Container.SetViewMode(' + generic_utility.get_setting('view_id_videos') + ')')
xbmcplugin.endOfDirectory(plugin_handle)
示例13: remove_series
def remove_series(series_title):
series_file = get_series_dir(series_title)
xbmcvfs.rmdir(series_file+os.sep, force=True)
if generic_utility.get_setting('update_db') == 'true':
xbmc.executebuiltin('CleanLibrary(video)')
else:
xbmc.executebuiltin("Container.Refresh")
示例14: read_lists
def read_lists(jsn, root_list):
filter_empty(jsn)
rets = []
llms = child('lolomos', jsn)
rlst = child(root_list, llms)
if generic_utility.get_setting('is_kid') == 'false':
mylist = child('mylist', rlst)
mylist_idx = deref(mylist, jsn)[0]
else:
mylist_idx = -1
mylist_id = None
for list_ref_idx in rlst:
list_ref = rlst[list_ref_idx]
idx, elem = deref(list_ref, jsn)
if list_ref_idx == mylist_idx:
mylist_id = idx
if 'displayName' in elem:
display_name = unicode(elem['displayName'])
ret = {'id': idx, 'name': display_name}
rets.append(ret)
return mylist_id, rets
示例15: add_or_remove
def add_or_remove(video_id, is_add):
root_list = get_root_list()
my_list = get_mylist(root_list)[0]
auth = generic_utility.get_setting('authorization_url')
track_id = get.track_id_list(my_list)
if is_add:
add_or_remove_str = 'addToList'
add_or_remove_msg = 'added'
else:
add_or_remove_str = 'removeFromList'
add_or_remove_msg = 'removed'
post = ('{"callPath":["lolomos","%s","%s"],"params":["%s",2,["videos",%s],%s,null,null],' +
'"authURL":"%s"}') % (root_list, add_or_remove_str, my_list, video_id, track_id, auth)
content = connect.load_netflix_site(generic_utility.evaluator()+'&method=call', post, options=True)
jsn = json.loads(content)
generic_utility.log('mylist: '+my_list)
generic_utility.log(str(jsn))
if '"invalidated"' in content:
generic_utility.notification('Successfully '+add_or_remove_msg)
elif 'already exists' in content:
generic_utility.notification('already exists')
generic_utility.debug('add to mylist content: '+content)