本文整理汇总了Python中addon.common.addon.Addon.resolve_url方法的典型用法代码示例。如果您正苦于以下问题:Python Addon.resolve_url方法的具体用法?Python Addon.resolve_url怎么用?Python Addon.resolve_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类addon.common.addon.Addon
的用法示例。
在下文中一共展示了Addon.resolve_url方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: media_item_list
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import resolve_url [as 别名]
title="NRA General Operations",
url="plugin://plugin.video.youtube/user/GOnraMedia/",
thumbnail="https://yt3.ggpht.com/-c0JMaaNvfWE/AAAAAAAAAAI/AAAAAAAAAAA/PAP-cswAjPw/s288-c-k-no-mo-rj-c0xffffff/photo.jpg",
fanart=fanart,
folder=True )
# Create media items list
def media_item_list(name,url,plot,img,fanart):
addon.add_video_item({'url': url}, {'title': name, 'plot': plot}, img = icon, fanart = fanart, playlist=False)
# Query play, mode, url and name
play = addon.queries.get('play', None)
mode = addon.queries['mode']
url = addon.queries.get('url', '')
name = addon.queries.get('name', '')
# Program flow control
if play:
addon.resolve_url(url.encode('UTF-8')) # <<< Play resolved media url
if mode=='main':
print ""
CATEGORIES()
elif mode=='youtube1':
print ""+url
IDX_YOUTUBE1()
if not play:
addon.end_of_directory()
示例2: get_url
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import resolve_url [as 别名]
#html = re.sub('(?s)<!--.*?-->', '', html).strip()
if re.search('http://tgun.tv/embed/', embedcode):
link = re.search('src="(.+?)"', embedcode).group(1)
embedcode = get_url(link)
embedcode = re.sub('(?s)<!--.*?-->', '', embedcode).strip()
stream_url = determine_stream(embedcode, url)
if not stream_url:
raise Exception('Channel is using an unknown stream type')
stream_url = None
#Play the stream
if stream_url and stream_url <> "Offline":
addon.resolve_url(stream_url)
except Exception, e:
traceback.print_exc()
Notify('small','TGUN', str(e),'')
def tvchannels(turl = url, tpage = page_num):
#turl = turl % tpage
html = get_url(turl)
#Remove any commented out sources to we don't try to use them
html = re.sub('(?s)<!--.*?-->', '', html).strip()
match = re.compile('<a Title="(.+?)" href="#" onClick="Chat=window.open\(\'(.+?)\',\'vid_z\',\'\'\); return false;"><img src="(.+?)" border="1" width=[0-9]+ height=[0-9]+ /></a>').findall(html)
if not match:
示例3: range
# 需要导入模块: from addon.common.addon import Addon [as 别名]
# 或者: from addon.common.addon.Addon import resolve_url [as 别名]
for i in range(len(links)):
url=links[i]
try:
sources.append(url)
except:pass
for link in links: randomitem.append([link])
index = random.randrange(1, len(links))
playrandom = randomitem[index][0]
if listmode=='true':
dialog = xbmcgui.Dialog()
index = dialog.select('Choose a source:', sources)
if index>-1:
url=sources[index]
import urlresolver
resolved=urlresolver.HostedMediaFile(url).resolve()
addon.resolve_url(resolved)
elif autoplay=='true':
for i in range(len(links)):
count+=1
progress = float(count) / float(len(links)) * 100
try:
index = random.randrange(1, len(links))
playrandom = randomitem[index][0]
dp.update(int(progress), 'TRYING (random on): ', playrandom)
resolved=urlresolver.HostedMediaFile(playrandom).resolve()
if resolved:
addon.resolve_url(resolved)
break
else:
Notify('small', 'Link down: ', playrandom,'')
except: pass