本文整理汇总了Python中addon.common.addon.Addon.build_plugin_url方法的典型用法代码示例。如果您正苦于以下问题:Python Addon.build_plugin_url方法的具体用法?Python Addon.build_plugin_url怎么用?Python Addon.build_plugin_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类addon.common.addon.Addon
的用法示例。
在下文中一共展示了Addon.build_plugin_url方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import build_plugin_url [as 别名]
try:
try: xbmcvfs.mkdirs(os.path.dirname(final_path))
except: os.path.mkdir(os.path.dirname(final_path))
except Exception, e:
try: IW_addon.log('Failed to create directory %s' % final_path)
except: pass
try:
file_desc = xbmcvfs.File(final_path, 'w')
file_desc.write(strm_string)
file_desc.close()
except Exception, e:
IW_addon.log('Failed to create .strm file: %s\n%s' % (final_path, e))
elif video_type == 'movie':
save_path = IW_addon.get_setting('movie-folder')
save_path = xbmc.translatePath(save_path)
strm_string = IW_addon.build_plugin_url(
{'mode': 'DocSubMenu','dialog': '1', 'movie_num': movie_num})
if year: title = '%s (%s)' % (title, year)
filename = filename_from_title(title, 'movie')
title = re.sub(r'[^\w\-_\. ]', '_', title)
final_path = os.path.join(save_path, title, filename)
final_path = xbmc.makeLegalFilename(final_path)
if not xbmcvfs.exists(os.path.dirname(final_path)):
try:
try: xbmcvfs.mkdirs(os.path.dirname(final_path))
except: os.path.mkdir(os.path.dirname(final_path))
except Exception, e:
try: IW_addon.log('Failed to create directory %s' % final_path)
except: pass
try:
file_desc = xbmcvfs.File(final_path, 'w')
file_desc.write(strm_string)
示例2:
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import build_plugin_url [as 别名]
wind = bv.Viewer(title, image=img, text=text)
wind.doModal()
del wind
elif mode[0] == "bblogs":
from resources.lib.modules import blog_viewer as bv
wind = bv.Viewer("My first window")
wind.doModal()
del wind
###########################################################################################
elif mode[0] == "my_lists":
lists = myLists.getLists()
for ls in lists:
delete = addon.build_plugin_url({"mode": "remove_list", "name": ls[0]})
context = [("Remove list", "RunPlugin(%s)" % delete)]
addon.add_item(
{"mode": "open_list", "path": ls[1], "name": ls[0]},
{"title": ls[0]},
img=icon_path("my_lists.jpg"),
fanart=fanart,
is_folder=True,
contextmenu_items=context,
)
addon.add_item(
{"mode": "add_list"},
{"title": "[B][COLOR green]Add list...[/COLOR][/B]"},
img=icon_path("my_lists.jpg"),
fanart=fanart,
is_folder=True,
示例3:
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import build_plugin_url [as 别名]
items = myLists.getItems(path)
for item in items:
addon.add_video_item({'mode': 'play', 'url': item[0],'title':item[1], 'img': item[2]}, {'title': item[1]}, img=item[2], fanart=fanart)
addon.end_of_directory()
##################################################################################################################################
##################################################################################################################################
elif mode[0]=='reddit':
from resources.lib.modules import subreddits
items = subreddits.get_subreddits()
for item in items:
delete = addon.build_plugin_url({'mode':'delete_subreddit','reddit':item})
context = [('Remove subreddit','RunPlugin(%s)'%delete)]
addon.add_item({'mode': 'open_subreddit', 'reddit': item}, {'title': item}, img=icon_path('reddit.jpg'), fanart=fanart,contextmenu_items=context,is_folder=True)
addon.add_item({'mode': 'add_subreddit'}, {'title': '[B][COLOR green]Add a subreddit[/COLOR][/B]'}, img=icon_path('reddit.jpg'), fanart=fanart)
addon.end_of_directory()
elif mode[0]=='add_subreddit':
from resources.lib.modules import subreddits
subreddits.add_subreddit()
control.refresh()
elif mode[0]=='delete_subreddit':
reddit = args['reddit'][0]
from resources.lib.modules import subreddits
subreddits.remove_subreddit(reddit)
control.refresh()