本文整理汇总了Python中resources.utility.generic_utility.get_string函数的典型用法代码示例。如果您正苦于以下问题:Python get_string函数的具体用法?Python get_string怎么用?Python get_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cookies
def cookies():
if xbmcvfs.exists(generic_utility.cookies_file()):
xbmcvfs.delete(generic_utility.cookies_file())
generic_utility.notification(generic_utility.get_string(30301))
if xbmcvfs.exists(generic_utility.headers_file()):
xbmcvfs.delete(generic_utility.headers_file())
generic_utility.notification(generic_utility.get_string(30302))
示例2: 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)
示例3: addon
def addon():
dialog = xbmcgui.Dialog()
if dialog.yesno(generic_utility.addon_name + ':', generic_utility.get_string(30307)):
try:
xbmcvfs.rmdir(generic_utility.data_dir(), force=True)
generic_utility.log('Addon userdata folder deleted.')
generic_utility.notification(generic_utility.get_string(30308))
except Exception:
pass
示例4: main
def main(video_type):
add.directory(generic_utility.get_string(30105), '', 'list_viewing_activity', '', video_type)
add_dynamic_lists(video_type)
if video_type == 'tv':
add.directory(generic_utility.get_string(30107), 'genre?83', 'list_videos', '', video_type)
add.directory(generic_utility.get_string(30108), '', 'list_genres', '', video_type)
else:
add.directory(generic_utility.get_string(30108), '', 'list_genres', '', video_type)
add.directory(generic_utility.get_string(30109), '', 'search', '', video_type)
xbmcplugin.endOfDirectory(plugin_handle)
示例5: cache
def cache():
try:
xbmcvfs.rmdir(generic_utility.cache_dir(), force=True)
generic_utility.log('Cache folder deleted.')
generic_utility.notification(generic_utility.get_string(30309))
except Exception:
pass
示例6: directory
def directory(name, url, mode, thumb, type='', context_enable=True, login_context = False):
entries = []
name = generic_utility.unescape(name)
u = sys.argv[0]
u += '?url=' + urllib.quote_plus(url)
u += '&mode=' + mode
u += '&thumb=' + urllib.quote_plus(thumb)
u += '&type=' + type
list_item = xbmcgui.ListItem(name)
list_item.setArt({'icon': 'DefaultTVShows.png', 'thumb': thumb})
list_item.setInfo(type='video', infoLabels={'title': name})
if "/my-list" in url:
entries.append(
(generic_utility.get_string(30150), 'RunPlugin(plugin://%s/?mode=add_my_list_to_library)' % generic_utility.addon_id))
list_item.setProperty('fanart_image', generic_utility.addon_fanart())
if context_enable:
if login_context == True:
entries.append(('Relogin',
'RunPlugin(plugin://%s/?mode=relogin)' % (
generic_utility.addon_id)))
list_item.addContextMenuItems(entries)
else:
list_item.addContextMenuItems([], replaceItems=True)
directory_item = xbmcplugin.addDirectoryItem(handle=plugin_handle, url=u, listitem=list_item, isFolder=True)
return directory_item
示例7: read_lists
def read_lists(falkor_cache):
mylist_id = extract_mylist_id(falkor_cache)
lists = falkor_cache['lists']
lists = filter_size(lists)
rets = []
videos=[]
list_contains_mylist = False
for list_key in lists:
list = lists[list_key]
list = filter_size(list)
if 'displayName' in list:
if list_key == mylist_id:
list_contains_mylist = True
display_name = unicode(list['displayName']['value'])
ret = {'id': list_key, 'name': display_name}
rets.append(ret)
if not list_contains_mylist:
ret = {'id': mylist_id, 'name': generic_utility.get_string(30104)}
rets.append(ret)
return rets
示例8: add_videos_to_directory
def add_videos_to_directory(loading_progress, run_as_widget, video_metadatas, video_type, page = None, url=None, viewing_activity = False):
removable = url != None and 'mylist' in url
if not viewing_activity:
sorted_video_metadata = sorted(video_metadatas, key=lambda t: t['title'], reverse = viewing_activity)
else:
sorted_video_metadata = video_metadatas
allowed_types = calc_allowed_types(video_type, viewing_activity)
filtered_video_metadata = []
for video_metadata in sorted_video_metadata:
if video_metadata['type'] in allowed_types:
filtered_video_metadata.append(video_metadata)
add.videos(filtered_video_metadata, removable, viewing_activity=viewing_activity)
items_per_page = int(generic_utility.get_setting('items_per_page'))
if (not url or 'list_viewing_activity' not in url) and len(video_metadatas) == items_per_page:
add.add_next_item('zzz[Next]zzz', page + 1, url, video_type, 'list_videos', '')
if len(video_metadatas) == 0:
generic_utility.notification(generic_utility.get_string(30306))
if not viewing_activity:
add_sort_methods()
示例9: show_loading_progress
def show_loading_progress(run_as_widget):
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, '...')
return loading_progress
示例10: read_browser
def read_browser(self):
self.browser = generic_utility.get_setting('browser')
if self.browser not in(BROWSER_CHROME, BROWSER_CHROME_LAUNCHER, BROWSER_EDGE, BROWSER_INTERNET_EXPLORER, BROWSER_SAFARI, BROWSER_CHROMIUM, BROWSER_ANDROID):
generic_utility.notification(generic_utility.get_string(50001))
xbmc.sleep(2000)
self.valid_browser = False
generic_utility.open_setting()
self.valid_browser = True
示例11: add_context_menu_movie
def add_context_menu_movie(entries, removable, title, type, video_id, year):
entries.append((
generic_utility.get_string(30153), 'RunPlugin(plugin://%s/?mode=play_trailer&url=%s&type=%s)' % (
generic_utility.addon_id, urllib.quote_plus(generic_utility.encode(title)), type)))
entries.append((generic_utility.get_string(30156),
'Container.Update(plugin://%s/?mode=list_videos&url=%s&type=movie)' % (
generic_utility.addon_id, urllib.quote_plus(
generic_utility.main_url + 'WiMovie/' + video_id))))
entries.append(
(generic_utility.get_string(30157), 'Container.Update(plugin://%s/?mode=list_videos&url=%s&type=tv)' % (
generic_utility.addon_id, urllib.quote_plus(generic_utility.main_url + 'WiMovie/' + video_id))))
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))))
title_utf8 = title.strip() + ' (' + str(year) + ')'
title = urllib.quote_plus(title_utf8.encode('utf-8'))
movie_dir = library.get_movie_dir(title_utf8)[0]
if xbmcvfs.exists(movie_dir + os.sep) == False:
entries.append((generic_utility.get_string(30150),
'RunPlugin(plugin://%s/?mode=add_movie_to_library&url=%s&name=%s)' % (
generic_utility.addon_id, urllib.quote_plus(video_id),
title)))
else:
entries.append((generic_utility.get_string(301501),
'RunPlugin(plugin://%s/?mode=remove_movie_from_library&url=&name=%s)' % (
generic_utility.addon_id, title)))
示例12: __init__
def __init__(self):
global addon_path
self.read_browser()
self.strActionInfo = xbmcgui.ControlLabel(180, 60, 1200, 400, '', 'font14', '0xFFBBBBFF')
self.addControl(self.strActionInfo)
self.strActionInfo.setLabel(generic_utility.get_string(50005))
addon_path = xbmcaddon.Addon().getAddonInfo("path")
示例13: main
def main(video_type):
add.directory(generic_utility.get_string(30105), '', 'list_viewing_activity', '', video_type)
if video_type == 'show':
add.directory(generic_utility.get_string(30107), 'genre?83', 'list_videos', '', video_type)
add.directory(generic_utility.get_string(30108), '', 'list_genres', '', video_type)
elif video_type == 'movie':
add.directory(generic_utility.get_string(30108), '', 'list_genres', '', video_type)
elif video_type == 'dynamic':
add_dynamic_lists()
if video_type != 'dynamic':
root_list = lolomos.get_root_list()
mylist = lolomos.get_mylist(root_list)
add.directory(child('displayName', mylist[1]), 'list?&mylist', 'list_videos', '', video_type)
add.directory(generic_utility.get_string(30109), '', 'search', '', video_type)
xbmcplugin.endOfDirectory(plugin_handle, cacheToDisc=False)
示例14: trailer
def trailer(video_type, title):
content = search.tmdb(video_type, title)
if content['total_results'] > 0:
content = content['results'][0]
tmdb_id = content['id']
content = search.trailer(video_type, tmdb_id)
else:
generic_utility.notification(generic_utility.get_string(30305))
content = None
return content
示例15: 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