本文整理汇总了Python中urlresolver.resolve函数的典型用法代码示例。如果您正苦于以下问题:Python resolve函数的具体用法?Python resolve怎么用?Python resolve使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resolve函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: download
def download(self, siteResult = False):
#oGui = cGui()
oInputParameterHandler = cInputParameterHandler()
sMediaUrl = oInputParameterHandler.getValue('sMediaUrl')
sFileName = oInputParameterHandler.getValue('sFileName')
sFileName = oInputParameterHandler.getValue('sMovieTitle')
if siteResult:
sMediaUrl = siteResult['streamUrl']
if siteResult['resolved']:
sLink = sMediaUrl
else:
sLink = urlresolver.resolve(sMediaUrl)
else:
sLink = urlresolver.resolve(sMediaUrl)
logger.info('call download: ' + sMediaUrl)
logger.info('file link: ' + str(sLink))
if self.dialog:
self.dialog.close()
if (sLink != False):
oDownload = cDownload()
oDownload.download(sLink, 'Stream')
else:
cGui().showError('Download', 'File deleted or Link could not be resolved', 5);
return False
return True
开发者ID:Lokke,项目名称:plugin.video.xstream,代码行数:26,代码来源:hoster.py
示例2: sendToPyLoad
def sendToPyLoad(self, siteResult = False):
from resources.lib.handler.pyLoadHandler import cPyLoadHandler
import urlresolver
params = ParameterHandler()
sMediaUrl = params.getValue('sMediaUrl')
sFileName = params.getValue('MovieTitle')
if not sFileName:
sFileName = params.getValue('Title')
if not sFileName: #nur vorrübergehend
sFileName = params.getValue('sMovieTitle')
if not sFileName:
sFileName = params.getValue('title')
if siteResult:
sMediaUrl = siteResult['streamUrl']
if siteResult['resolved']:
sLink = sMediaUrl
else:
sLink = urlresolver.resolve(sMediaUrl)
else:
sLink = urlresolver.resolve(sMediaUrl)
try:
msg = sLink.msg
except:
msg = False
if sLink != False and not msg:
logger.info('download with pyLoad: ' + sMediaUrl)
cPyLoadHandler().sendToPyLoad(sFileName,sLink)
return True
else:
cGui().showError('xStream', str(msg), 5)
return False
开发者ID:badwog1,项目名称:kodi-repo-gaymods,代码行数:33,代码来源:hoster.py
示例3: download
def download(self, siteResult=False):
from resources.lib.download import cDownload
import urlresolver
# oGui = cGui()
params = ParameterHandler()
sMediaUrl = params.getValue("sMediaUrl")
sFileName = params.getValue("sFileName")
sFileName = params.getValue("sMovieTitle")
if siteResult:
sMediaUrl = siteResult["streamUrl"]
if siteResult["resolved"]:
sLink = sMediaUrl
else:
sLink = urlresolver.resolve(sMediaUrl)
else:
sLink = urlresolver.resolve(sMediaUrl)
logger.info("call download: " + sMediaUrl)
logger.info("file link: " + str(sLink))
if self.dialog:
self.dialog.close()
if sLink != False:
oDownload = cDownload()
oDownload.download(sLink, "Stream")
else:
# cGui().showError('Download', 'File deleted or Link could not be resolved', 5);
return False
return True
开发者ID:AlexBander,项目名称:plugin.video.xstream,代码行数:29,代码来源:hoster.py
示例4: _getInfoAndResolve
def _getInfoAndResolve(self, siteResult):
import urlresolver
oGui = cGui()
params = ParameterHandler()
# get data
data = {}
mediaUrl = params.getValue('sMediaUrl')
fileName = params.getValue('MovieTitle')
if not fileName:
fileName = params.getValue('Title')
if not fileName: #only temporary
fileName = params.getValue('sMovieTitle')
if not fileName:
fileName = params.getValue('title')
data['title'] = fileName
data['season'] = params.getValue('season')
data['episode'] = params.getValue('episode')
data['showTitle'] = params.getValue('TVShowTitle')
data['thumb'] = params.getValue('thumb')
# resolve
if siteResult:
mediaUrl = siteResult['streamUrl']
logger.info('resolve: ' + mediaUrl)
if siteResult['resolved']:
link = mediaUrl
else:
link = urlresolver.resolve(mediaUrl)
elif mediaUrl:
logger.info('resolve: ' + mediaUrl)
link = urlresolver.resolve(mediaUrl)
else:
oGui.showError('xStream', 'kein Hosterlink übergeben', 5)
return False
#resolver response
if hasattr(link, 'msg'):
msg = link.msg
else: msg = False
if link != False and not msg:
data['link'] = link
return data
# error during resolving
if not msg:
msg = 'Stream nicht mehr verfügbar oder Link fehlerhaft'
oGui.showError('xStream',str(msg),7)
if hasattr(link, 'code'):
logger.info(str(msg) +' UnresolveableCode: '+ str(link.code))
else:
logger.info(str(msg) +' UnresolveableCode: - ')
'''
UnresolveableCode
0: Unknown Error
1: The url was resolved, but the file has been permanantly
removed
2: The file is temporarily unavailable for example due to
planned site maintenance
3. There was an error contacting the site for example a
connection attempt timed out
'''
return False
开发者ID:BIade86,项目名称:plugin.video.xstream,代码行数:60,代码来源:hoster.py
示例5: resolve
def resolve(url):
html = client.request(url)
links = re.findall('id=[\"\']([^\"\']+)[\"\']><a href=[\"\']#\d+[\"\']><div.+?>([^<]+)<',html)
if len(links)<2:
urls = re.findall('<iframe.+?src=[\'"](.+?)[\'"]',html)
import urlresolver
for url in urls:
resolved = urlresolver.resolve(url)
if resolved:
return resolved
break
else:
import requests
choices = [x[1] for x in links]
i = control.selectDialog(choices,heading='Choose a link:')
ref = url
headers = {'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8','X-Requested-With':'XMLHttpRequest','Referer':ref, 'Origin':'http://fullmatchtv.com', 'Host':'fullmatchtv.com'}
s = requests.Session()
acp_pid = re.findall("id=[\"\']acp_post[\"\'].+?value=[\"\'](\d+)[\"\']",html)[0]
post_data = {'acp_currpage' : int(i)+1,
'acp_pid' : acp_pid,
'acp_shortcode' : 'acp_shortcode',
'action' : 'pp_with_ajax'
}
result = s.post('http://fullmatchtv.com/wp-admin/admin-ajax.php', data=post_data, headers=headers).content
url = re.findall('<iframe.+?src=[\'"](.+?)[\'"]',result)[0]
import urlresolver
return urlresolver.resolve(url)
开发者ID:hieuhienvn,项目名称:hieuhien.vn,代码行数:32,代码来源:fullmatchtv.py
示例6: play
def play(url):
if url.find('linkOut') != -1:
urlout = url.split('?id=')[-1]
url = base64.b64decode(urlout)
plugin.notify(msg=urlout, title=url)
resolved = ''
stream_url = ''
item = None
try:
import urlresolver
resolved = urlresolver.HostedMediaFile(url).resolve()
if not resolved or resolved == False or len(resolved) < 1:
resolved = urlresolver.resolve(url)
if resolved is None or len(resolved) < 1:
resolved = urlresolver.resolve(urllib.unquote(url))
if len(resolved) > 1:
plugin.notify(msg="PLAY {0}".format(resolved.partition('.')[-1]), title="URLRESOLVER", delay=1000)
plugin.set_resolved_url(resolved)
item = ListItem.from_dict(path=resolved)
item.add_stream_info('video', stream_values={})
item.set_is_playable(True)
plugin.play_video(item)
return None
except:
resolved = ''
plugin.notify(msg="FAILED {0}".format(url.partition('.')[-1]), title="URLRESOLVER", delay=1000)
try:
import YDStreamExtractor
info = YDStreamExtractor.getVideoInfo(url, resolve_redirects=True)
resolved = info.streamURL()
for s in info.streams():
try:
stream_url = s['xbmc_url'].encode('utf-8', 'ignore')
xbmc.log(msg="**YOUTUBE-DL Stream found: {0}".format(stream_url))
except:
pass
if len(stream_url) > 1:
resolved = stream_url
if len(resolved) > 1:
plugin.notify(msg="Playing: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)
plugin.set_resolved_url(resolved)
item = ListItem.from_dict(path=resolved)
item.add_stream_info('video', stream_values={})
item.set_is_playable(True)
plugin.play_video(item)
return None
except:
plugin.notify(msg="Failed: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)
if len(resolved) > 1:
plugin.set_resolved_url(resolved)
item = ListItem.from_dict(path=resolved)
plugin.play_video(item)
return None
else:
plugin.set_resolved_url(url)
plugin.play_video(url)
return None
开发者ID:moedje,项目名称:kodi-repo-gaymods,代码行数:57,代码来源:addon.py
示例7: VIDEOLINKS
def VIDEOLINKS(url,name):
name = name.replace('[COLOR green]Lektor','')
name = name.replace('[COLOR orange]Napisy','')
name = name.replace('[/COLOR]','')
link = getHtml (url)
soup = BeautifulSoup(link, 'html.parser')
divTag = soup.find_all("a" ,{"class":"watch"})
print divTag
for tag in divTag:
#match=re.compile('<a class="watch" data-iframe="(.+?)" data-short="(.+?)" data-size="width: (.+?)px; height: (.+?)px;" data-urlhost="(.+?)" data-version="(.+?)" href="#!">Og').findall(str(tag))
match=re.compile('<a class="watch" data-iframe="(.+?)" data-short="(.+?)" data-size="width: (.+?)px; height: (.+?)px;" data-urlhost="(.+?)" data-version="(.+?)"').findall(str(tag))
for cos,lang_short,x,y,url,lang in match:
print url + " linki"
match= re.compile('(http|https):\/\/(.+?)\/').findall(url)
for cos ,host in match:
host = host.replace('embed.','')
host = host.replace('www.','')
if "openload" in host:
#print "cosco " + host
ref = url.replace('video/','f/')
ref = ref.replace('http://','https://')
media_url = url.replace("http://openload.co/video/","https://openload.co/f/")
img_source = utils.getHtml(media_url, '', utils.openloadhdr)
match = re.compile('<meta name="og:image" content="(.+?)">').findall(img_source)
try:
poster_url = match[0]
except Exception:
pass
media_url = utils.playvideo(media_url, 'name', '', '')
media_url = media_url+'|User-Agent=Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0&Referer='+ref
print media_url + ' referer'
#media_url = urlresolver.resolve(media_url)
#poster_url = 'http://alltube.tv/static/host/play.png'
print media_url
elif "cda" in host:
media_url, poster_url = CDA(url)
if media_url:
#media_url = media_url+'|referer=http://static.cda.pl/flowplayer/flash/flowplayer.commercial-3.2.18.swf'
media_url = media_url+'|Cookie=PHPSESSID=1&Referer=http://static.cda.pl/flowplayer/flash/flowplayer.commercial-3.2.18.swf'
print media_url
elif "streamin" in host:
media_url = url.replace("video/","")
media_url = urlresolver.resolve(media_url)
poster_url = 'http://alltube.tv/static/host/play.png'
elif "vidto" in host:
media_url = url.replace("/v/","/")
media_url = urlresolver.resolve(media_url)
poster_url = 'http://alltube.tv/static/host/play.png'
else:
media_url = urlresolver.resolve(url)
poster_url = 'http://alltube.tv/static/host/play.png'
if media_url:
print media_url + " xxx"
#print lang
if media_url:
addLink(name+'[COLOR blue] '+lang+'[/COLOR]( '+host+' )',media_url,poster_url)
开发者ID:crazytv,项目名称:alakamba,代码行数:56,代码来源:default.py
示例8: PLAYEP
def PLAYEP(name,url,iconimage):
if urlresolver.HostedMediaFile(url).valid_url():
stream_url = urlresolver.resolve(url)
else:
link = open_url(url)
match=re.compile('src="(.+?)"></iframe>').findall(link)[0]
stream_url = urlresolver.resolve(match)
liz = xbmcgui.ListItem(name, iconImage='DefaultVideo.png', thumbnailImage=iconimage)
liz.setPath(stream_url)
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:10,代码来源:default.py
示例9: play
def play(url):
resolved = ''
stream_url = ''
item = None
try:
import urlresolver
resolved = urlresolver.HostedMediaFile(url).resolve()
if not resolved or resolved == False or len(resolved) < 1:
resolved = urlresolver.resolve(url)
if resolved is None or len(resolved) < 1:
resolved = urlresolver.resolve(urllib.unquote(url))
if len(resolved) > 1:
plugin.notify(msg="PLAY {0}".format(resolved.partition('.')[-1]), title="URLRESOLVER", delay=1000)
plugin.set_resolved_url(resolved)
item = ListItem.from_dict(path=resolved)
item.add_stream_info('video', stream_values={})
item.set_is_playable(True)
return item
except:
resolved = ''
plugin.notify(msg="FAILED {0}".format(url.partition('.')[-1]), title="URLRESOLVER", delay=1000)
try:
import YDStreamExtractor
info = YDStreamExtractor.getVideoInfo(url, resolve_redirects=True)
resolved = info.streamURL()
for s in info.streams():
try:
stream_url = s['xbmc_url'].encode('utf-8', 'ignore')
xbmc.log(msg="**YOUTUBE-DL Stream found: {0}".format(stream_url))
except:
pass
if len(stream_url) > 1:
resolved = stream_url
if len(resolved) > 1:
plugin.notify(msg="Playing: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)
plugin.set_resolved_url(resolved)
item = ListItem.from_dict(path=resolved)
item.add_stream_info('video', stream_values={})
item.set_is_playable(True)
return item
except:
plugin.notify(msg="Failed: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)
if len(resolved) > 1:
plugin.set_resolved_url(resolved)
item = ListItem.from_dict(path=resolved)
return item
else:
plugin.set_resolved_url(url) #url)
#plugurl = 'plugin://plugin.video.live.streamspro/?url={0}'.format(urllib.quote_plus(url))
#item = ListItem.from_dict(path=plugurl)
#item.add_stream_info('video', stream_values={})
#item.set_is_playable(True)
#plugin.notify(msg="RESOLVE FAIL: {0}".format(url.split('.', 1)[-1]),title="Trying {0}".format(item.path.split('.', 1)[-1]), delay=2000)
return None
开发者ID:moedje,项目名称:kodi-repo-gaymods,代码行数:55,代码来源:old_addon.py
示例10: addToPlaylist
def addToPlaylist(self, siteResult=False):
import urlresolver
oGui = cGui()
params = ParameterHandler()
sMediaUrl = params.getValue("sMediaUrl")
sFileName = params.getValue("MovieTitle")
if not sFileName:
sFileName = params.getValue("title")
if not sFileName:
sFileName = params.getValue("Title")
if not sFileName: # nur vorrübergehend
sFileName = params.getValue("sMovieTitle")
if not sFileName:
sFileName = params.getValue("title")
sSeason = params.getValue("season")
sEpisode = params.getValue("episode")
sShowTitle = params.getValue("TvShowTitle")
sThumbnail = params.getValue("thumb")
if siteResult:
sMediaUrl = siteResult["streamUrl"]
if siteResult["resolved"]:
sLink = sMediaUrl
else:
sLink = urlresolver.resolve(sMediaUrl)
else:
sLink = urlresolver.resolve(sMediaUrl)
logger.info("call addToPlaylist: " + sMediaUrl)
logger.info("file link: " + str(sLink))
if sLink != False:
oGuiElement = cGuiElement()
oGuiElement.setSiteName(self.SITE_NAME)
oGuiElement.setMediaUrl(sLink)
oGuiElement.setTitle(sFileName)
if sThumbnail:
oGuiElement.setThumbnail(sThumbnail)
if sShowTitle:
oGuiElement.addItemProperties("Episode", sEpisode)
oGuiElement.addItemProperties("Season", sSeason)
oGuiElement.addItemProperties("TvShowTitle", sShowTitle)
if self.dialog:
self.dialog.close()
oPlayer = cPlayer()
oPlayer.addItemToPlaylist(oGuiElement)
oGui.showInfo("Playlist", "Stream wurde hinzugefügt", 5)
else:
# oGui.showError('Playlist', 'File deleted or Link could not be resolved', 5);
return False
return True
开发者ID:AlexBander,项目名称:plugin.video.xstream,代码行数:50,代码来源:hoster.py
示例11: PLAY
def PLAY(url,name):
html = net().http_GET(url).content
link=re.compile('<iframe width=.+?src="(.+?)".+?<',re.DOTALL).findall(html)
if not link: link = re.compile('<a target="_blank" href="(.+?)"><img border=0').findall(html)
if not link: link = re.compile("src='(.+?)'").findall(html)
if not link: link = re.compile('<div id="emptydiv"><iframe src="(.+?)"',re.DOTALL).findall(html)
if not link: link = re.compile('scrolling="no" src="(.+?)">').findall(html)
print link[0]
if name.strip() == 'VIDEOWEED': stream=urlresolver.resolve(link[0].replace('file','video'))
else: stream=urlresolver.resolve(link[0])
liz=xbmcgui.ListItem(label = name,label2 = name, iconImage="%s/art/video.png"%local.getAddonInfo("path"), thumbnailImage = "%s/art/video.png"%local.getAddonInfo("path") )
liz.setInfo( type="Video", infoLabels = {'title' : name}); liz.setProperty('fanart_image', fanart)
liz.setProperty('IsPlayable', 'true'); addon.resolve_url(stream)
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=stream,listitem=liz)
开发者ID:DarrenRainey,项目名称:voinage-xbmc-plugins,代码行数:14,代码来源:default.py
示例12: addToPlaylist
def addToPlaylist(self, siteResult = False):
import urlresolver
oGui = cGui()
params = ParameterHandler()
sMediaUrl = params.getValue('sMediaUrl')
sFileName = params.getValue('MovieTitle')
if not sFileName:
sFileName = params.getValue('title')
if not sFileName:
sFileName = params.getValue('Title')
if not sFileName: #nur vorrübergehend
sFileName = params.getValue('sMovieTitle')
if not sFileName:
sFileName = params.getValue('title')
sSeason = params.getValue('season')
sEpisode = params.getValue('episode')
sShowTitle = params.getValue('TvShowTitle')
sThumbnail = params.getValue('thumb')
if siteResult:
sMediaUrl = siteResult['streamUrl']
if siteResult['resolved']:
sLink = sMediaUrl
else:
sLink = urlresolver.resolve(sMediaUrl)
else:
sLink = urlresolver.resolve(sMediaUrl)
logger.info('call addToPlaylist: ' + sMediaUrl)
logger.info('file link: ' + str(sLink))
if (sLink != False):
oGuiElement = cGuiElement()
oGuiElement.setSiteName(self.SITE_NAME)
oGuiElement.setMediaUrl(sLink)
oGuiElement.setTitle(sFileName)
if sThumbnail:
oGuiElement.setThumbnail(sThumbnail)
if sShowTitle:
oGuiElement.addItemProperties('Episode',sEpisode)
oGuiElement.addItemProperties('Season',sSeason)
oGuiElement.addItemProperties('TvShowTitle',sShowTitle)
if self.dialog:
self.dialog.close()
oPlayer = cPlayer()
oPlayer.addItemToPlaylist(oGuiElement)
oGui.showInfo('Playlist', 'Stream wurde hinzugefügt', 5);
else:
#oGui.showError('Playlist', 'File deleted or Link could not be resolved', 5);
return False
return True
开发者ID:badwog1,项目名称:kodi-repo-gaymods,代码行数:49,代码来源:hoster.py
示例13: request
def request(url):
try:
if '</regex>' in url:
import regex ; url = regex.resolve(url)
rd = realdebrid.resolve(url)
if not rd == None: return rd
pz = premiumize.resolve(url)
if not pz == None: return pz
if url.startswith('rtmp'):
if len(re.compile('\s*timeout=(\d*)').findall(url)) == 0: url += ' timeout=10'
return url
u = urlparse.urlparse(url).netloc
u = u.replace('www.', '').replace('embed.', '').replace('config.','')
u = u.lower()
r = [i['class'] for i in info() if u in i['netloc']][0]
r = __import__(r, globals(), locals(), [], -1)
r = r.resolve(url)
if r == None:
import urlresolver
r = urlresolver.resolve(url)
if not r:
r = None
if r == None: return r
elif type(r) == list: return r
elif not r.startswith('http'): return r
try: h = dict(urlparse.parse_qsl(r.rsplit('|', 1)[1]))
except: h = dict('')
if not 'User-Agent' in h: h['User-Agent'] = client.agent()
if not 'Referer' in h: h['Referer'] = url
r = '%s|%s' % (r.split('|')[0], urllib.urlencode(h))
return r
except:
try :
import urlresolver
r = urlresolver.resolve(url)
if not r :
url = r
except:
pass
return url
开发者ID:macblizzard,项目名称:aftershock-repo,代码行数:49,代码来源:__init__.py
示例14: playURLRVideo
def playURLRVideo(url, name, type_):
dialog_progress_title='URL Resolver'
dialog_progress_YTDL = xbmcgui.DialogProgressBG()
dialog_progress_YTDL.create(dialog_progress_title )
dialog_progress_YTDL.update(10,dialog_progress_title,translation(32014) )
from urlparse import urlparse
parsed_uri = urlparse( url )
domain = '{uri.netloc}'.format(uri=parsed_uri)
try:
import urlresolver
#hmf = urlresolver.HostedMediaFile(url)
dialog_progress_YTDL.update(20,dialog_progress_title,translation(32012) )
media_url = urlresolver.resolve(url)
dialog_progress_YTDL.update(80,dialog_progress_title,translation(32013) )
if media_url:
log( ' URLResolver stream url=' + repr(media_url ))
pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
pl.clear()
pl.add(media_url, xbmcgui.ListItem(name))
xbmc.Player().play(pl, windowed=False) #scripts play video like this.
else:
log( " Can't URL Resolve:" + repr(url))
xbmc_notify('URLresolver', translation(32192),icon="type_urlr.png" ) #Failed to get playable url
except Exception as e:
xbmc_notify('URLresolver:'+domain, str(e),icon="type_urlr.png" )
dialog_progress_YTDL.close()
开发者ID:gedisony,项目名称:script.reddit.reader,代码行数:29,代码来源:actions.py
示例15: RESOLVETVDL
def RESOLVETVDL(name, url, thumb):
data = 0
try:
data = GRABMETA(movie_name, year)
except:
data = 0
hmf = urlresolver.HostedMediaFile(url)
host = ""
if hmf:
url = urlresolver.resolve(url)
host = hmf.get_host()
if ".mp4" in url:
ext = ".mp4"
elif ".flv" in url:
ext = ".flv"
elif ".avi" in url:
ext = ".avi"
if not ext == "":
console = "Downloads/TV Shows/" + dlfoldername
params = {"url": url, "name": name, "thumb": thumb, "dlfoldername": dlfoldername}
xbmc.sleep(1000)
addToQueue(name, url, thumb, ext, console)
开发者ID:bialagary,项目名称:mw,代码行数:26,代码来源:main.py
示例16: PLAY
def PLAY(name,url):
ok=True
hname=name
name = name.split('[COLOR blue]')[0]
name = name.split('[COLOR red]')[0]
infoLabels = main.GETMETAT(name,'','','')
video_type='movie'
season=''
episode=''
img=infoLabels['cover_url']
fanart =infoLabels['backdrop_url']
imdb_id=infoLabels['imdb_id']
infolabels = { 'supports_meta' : 'true', 'video_type':video_type, 'name':str(infoLabels['title']), 'imdb_id':str(infoLabels['imdb_id']), 'season':str(season), 'episode':str(episode), 'year':str(infoLabels['year']) }
try:
xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
stream_url = urlresolver.resolve(url)
infoL={'Title': infoLabels['metaName'], 'Plot': infoLabels['plot'], 'Genre': infoLabels['genre']}
from resources.universal import playbackengine
player = playbackengine.PlayWithoutQueueSupport(resolved_url=stream_url, addon_id=addon_id, video_type=video_type, title=str(infoLabels['title']),season=str(season), episode=str(episode), year=str(infoLabels['year']),img=img,infolabels=infoL, watchedCallbackwithParams=main.WatchedCallbackwithParams,imdb_id=imdb_id)
player.KeepAlive()
return ok
except Exception, e:
if stream_url != False:
main.ErrorReport(e)
return ok
开发者ID:rjt2,项目名称:Kasiks-Repo,代码行数:27,代码来源:couchtuner.py
示例17: resolve
def resolve(self,url):
html=client.request(url)
soup=webutils.bs(html)
try:
link=soup.find('iframe',{'frameborder':'0'})['src']
except:
sd = re.findall('<source src="(.+?)" type=\'video/mp4\' data-res="360p">',html)[0]
try:
hd = re.findall('<source src="(.+?)" type=\'video/mp4\' data-res="720p">',html)[0]
except:
hd = sd
return hd
if 'http' not in link:
link = 'http://nbahd.com' + link
try:
html = client.request(link)
urls = re.findall('src="(.+?)" type="video/mp4"',html)
try: url = urls[1]
except: url = urls[0]
return url
except:
try:
import urlresolver
resolved = urlresolver.resolve(link)
return resolved
except:
return
开发者ID:Kawakiw,项目名称:kawakodi,代码行数:28,代码来源:nbahd.py
示例18: setup_download
def setup_download(name,url,thumb,medias,movie_title):
hmf = urlresolver.HostedMediaFile(url)
host = ''
if hmf:
urls = urlresolver.resolve(url)
else: urls = url
if '.mp4' in urls:
ext = '.mp4'
elif '.flv' in urls:
ext = '.flv'
elif '.avi' in urls:
ext = '.avi'
elif '.mkv' in urls:
ext = '.mkv'
elif '.m3u8' in urls:
ext = '.m3u8'
else:
ext = '.flv'
if medias =='movies':
media = 'Movies'
elif medias == 'shows':
media = 'TV Shows/'+movie_title+'/'
xbmc.sleep(1000)
add_to_queue(name,urls,thumb,ext,media)
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:32,代码来源:dl_control.py
示例19: getUnzipped
def getUnzipped(theurl, thedir, thename, generalid):
"""Args:
* theurl: The URL where the zip can be downloaded
* thedir: The directory where the zipfile should be saved into
* thename: The complete filename of the zipfile
Function:
Retrieves the zipfile from the URL location given, using urlresolver.
The function then unzips the file.
WORKAROUND INCLUDED:
xbmc.extract can't handle a comma in the filename ( up to v12: Frodo)
The script will remove any comma's in the name of the filename
"""
theoldname = thename
name = os.path.join(thedir, thename)
try:
if not os.path.exists(thedir):
os.makedirs(thedir)
except Exception:
buggalo.onExceptionRaised()
#buggalo.onExceptionRaised(thedir)
print 'can\'t create directory (' + thedir + ')'
return
#try:
print theurl[0:25]
if urlresolver.HostedMediaFile(theurl).valid_url() or theurl[0:25] == "http://www.mediafire.com/":
try:
if theurl[0:25] == "http://www.mediafire.com/":
url = theurl
else:
url = urlresolver.resolve(theurl)
print 'translated link: ' + url
if download_karaoke_file(url, name, name):
# Code to circumvent a bug in URIUtils::HasExtension
thenewname = theoldname.replace(",", "")
if thenewname != theoldname:
newname = os.path.join(thedir, thenewname)
os.rename(name, newname)
name = newname
# Python unzip is rubbish!!! gave me corrupted unzips every time
xbmc.executebuiltin('xbmc.extract(' + name + ')', True)
# Remove the zip file
os.unlink(name)
return 1
else:
reportFile('brokenlink', generalid, thename, theurl);
xbmcgui.Dialog().ok(__addonname__, __language__(70120), __language__(70121), '')
return 0
except:
xbmcgui.Dialog().ok(__addonname__, __language__(70126), __language__(70127), __language__(70121))
return 0
else:
reportFile('brokenlink', generalid, thename, theurl);
xbmcgui.Dialog().ok(__addonname__, __language__(70122), __language__(70121), '')
return 0
return 0
开发者ID:azumimuo,项目名称:family-xbmc-addon,代码行数:60,代码来源:Default.py
示例20: PLAYMEDIA
def PLAYMEDIA(name,url):
ok = True
r = re.findall(r'(.+?)\[COLOR', name)
name = r[0]
r=re.findall('Season(.+?)Episode([^<]+)',name)
if r:
infoLabels =main.GETMETAEpiT(name,'','')
video_type='episode'
season=infoLabels['season']
episode=infoLabels['episode']
else:
infoLabels =main.GETMETAT(name,'','','')
video_type='movie'
season=''
episode=''
img=infoLabels['cover_url']
fanart =infoLabels['backdrop_url']
imdb_id=infoLabels['imdb_id']
infolabels = { 'supports_meta' : 'true', 'video_type':video_type, 'name':str(infoLabels['title']), 'imdb_id':str(infoLabels['imdb_id']), 'season':str(season), 'episode':str(episode), 'year':str(infoLabels['year']) }
try:
stream_url = urlresolver.resolve(url)
infoL={'Title': infoLabels['title'], 'Plot': infoLabels['plot'], 'Genre': infoLabels['genre']}
# play with bookmark
player = playbackengine.PlayWithoutQueueSupport(resolved_url=stream_url, addon_id=addon_id, video_type=video_type, title=str(infoLabels['title']),season=str(season), episode=str(episode), year=str(infoLabels['year']),img=img,infolabels=infoL, watchedCallbackwithParams=main.WatchedCallbackwithParams,imdb_id=imdb_id)
#WatchHistory
if selfAddon.getSetting("whistory") == "true":
wh.add_item(hname+' '+'[COLOR=FF67cc33]TvRelease[/COLOR]', sys.argv[0]+sys.argv[2], infolabels=infolabels, img=str(img), fanart=str(fanart), is_folder=False)
player.KeepAlive()
return ok
except:
return ok
开发者ID:the-one-,项目名称:MashUp,代码行数:31,代码来源:tvrelease.py
注:本文中的urlresolver.resolve函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论