本文整理汇总了Python中core.decoder.Decoder.decodeLink方法的典型用法代码示例。如果您正苦于以下问题:Python Decoder.decodeLink方法的具体用法?Python Decoder.decodeLink怎么用?Python Decoder.decodeLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.decoder.Decoder
的用法示例。
在下文中一共展示了Decoder.decodeLink方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from core.decoder import Decoder [as 别名]
# 或者: from core.decoder.Decoder import decodeLink [as 别名]
def run(self):
logger.debug("DownloadThread.run")
self.running = True
app = App.get_running_app()
self.progressDialog.value = 0
self.progressDialogLabel.text = "decoding link: "+self.url
decoded_link = Decoder.decodeLink(self.url)
#copy to clipboard
app.copy(decoded_link)
if decoded_link!='' and decoded_link.find("http")>-1:
app.message("Info","Link has been decoded (from "+self.url+"):\n"+decoded_link+" has been decoded and copied to clipboard.\nDownload should be started/resumed.")
app.download_screen.ids.label_text_message.text=decoded_link
elif self.aborted:
app.message("Error","File "+app.target_file+" has not been downloaded, please try again and make sure remote url exists.")
separationChar = '/'
fileName = ''
if self.url.find("/")>-1:
fileName = self.url[self.url.rfind("/")+1:]
if fileName.find(".")==-1 and decoded_link.find("/"):
fileName = decoded_link[decoded_link.rfind("/")+1:]
self.downloadfile(decoded_link,self.folder+separationChar+fileName,[],False,True,self.progressDialog,self.progressDialogLabel)
self.running = False
app.download_screen.ids.loading.opacity=0
if self.aborted:
app.message("Info","Download proccess has been stopped for file: \n "+app.target_file)
示例2: init
# 需要导入模块: from core.decoder import Decoder [as 别名]
# 或者: from core.decoder.Decoder import decodeLink [as 别名]
def init():
params=get_params()
url=""
mode=None
page=""
cookie=""
try:
page=urllib.unquote_plus(params["page"])
except:
pass
try:
url=urllib.unquote_plus(params["url"])
except:
pass
try:
mode=int(params["mode"])
except:
pass
try:
provider=urllib.unquote_plus(params["provider"])
except:
pass
try:
logger.info("cookie was filled with: "+params["cookie"])
cookie=urllib.unquote_plus(params["cookie"])
except:
pass
#print "Mode: "+str(mode)
print "URL: "+str(url)
print "cookie: "+str(cookie)
if mode==None: #init
get_main_dirs()
elif mode==1: #get channels
get_dirs(url, '', page)
elif mode == 2: #open multimedia file in player
open(url,page)
elif mode == 3:
browse_channels(url,page)
elif mode == 4:
browse_channel(url,page,provider,cookie) #main logic
elif mode == 5:
open_channel(url,page)
elif mode == 0: #update
if xbmcgui.Dialog().yesno(addon.getLocalizedString(10011),updater.getUpdateInfo(), "", "", addon.getLocalizedString(11013), addon.getLocalizedString(11014) ):
updater.update()
get_main_dirs()
elif mode == 100: #decode provider link
logger.info("decoding: "+url)
link = Decoder.decodeLink(url)
logger.info("decoded: "+link)
open(link,page)
elif mode == 101:
jsonChannels = R977Musiccom.getChannels(page,cookie)
url = jsonChannels[0]["link"]
logger.info("found link: "+url+", launching...")
open(url,page) #same that 2, but reserved for rtmp
elif mode == 102:
jsonChannels = Radionet.getChannels(page,cookie)
url = jsonChannels[0]["link"]
logger.info("found link: "+url+", launching...")
open(url,page) #same that 2, but reserved for rtmp
elif mode == 103:
jsonChannels = Redmp3cc.getChannels(url,cookie)
url = jsonChannels[0]["link"]
logger.info("found link: "+url+", launching...")
open(url,page) #same that 2, but reserved for rtmp
logger.info("remove temp: "+url)
#os.remove(url)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
示例3: decodeAndOpenLink
# 需要导入模块: from core.decoder import Decoder [as 别名]
# 或者: from core.decoder.Decoder import decodeLink [as 别名]
def decodeAndOpenLink(url, page):
logger.info("decoding: " + url)
link = Decoder.decodeLink(url)
logger.info("decoded: " + link)
open(link, page)
示例4: openYoutubeLink
# 需要导入模块: from core.decoder import Decoder [as 别名]
# 或者: from core.decoder.Decoder import decodeLink [as 别名]
def openYoutubeLink(url, page): # could be replaced by decodeAndOpenLink, traces are the unique difference
logger.info("decoding youtube link... " + url)
link = Decoder.decodeLink(url)
logger.info("decoded youtube link: " + link)
open(link, page)
示例5: open
# 需要导入模块: from core.decoder import Decoder [as 别名]
# 或者: from core.decoder.Decoder import decodeLink [as 别名]
def open(url,page):
if url.find("rtmp://")==-1 and url.find("|Referer=")==-1 and ( url.find("http://privatestream.tv/")>-1 or url.find("http://www.dinostream.pw/")>-1 or url.find("http://www.embeducaster.com/")>-1 or url.find("http://tv.verdirectotv.org/channel.php")>-1 or url.find("http://mamahd.com/")>-1):
logger.info("brute url [referer] is: "+url)
referer = ''
if(url.find("referer: ")>-1):
referer = url[url.find("referer: ")+len("referer: "):]
url = url[0:url.find(",")]
if url.find("http://privatestream.tv/")>-1:
html = Downloader.getContentFromUrl(url,"","",referer)
url = Decoder.decodePrivatestream(html,referer)
elif url.find("http://www.dinostream.pw/")>-1:
url = Decoder.extractDinostreamPart(url,referer)["link"]
elif url.find("http://www.embeducaster.com/")>-1:
#url = url.replace("/membedplayer/","/embedplayer/")
url = Cineestrenostv.getContentFromUrl(url,"","",referer)
elif url.find("http://tv.verdirectotv.org/channel.php")>-1:
html4 = Cineestrenostv.getContentFromUrl(url,"",Cineestrenostv.cookie,referer)
finalIframeUrl = Decoder.extractWithRegex('http://','%3D"',html4)
if finalIframeUrl.find('"')>-1 or finalIframeUrl.find("'")>-1:
finalIframeUrl = finalIframeUrl[0:len(finalIframeUrl)-1]
finalHtml = Cineestrenostv.getContentFromUrl(finalIframeUrl,"",Cineestrenostv.cookie,referer)
url = Decoder.decodeBussinessApp(finalHtml,finalIframeUrl)
elif url.find("http://mamahd.com/")>-1:
url = Mamahdcom.getChannels(url)[0]["link"]
elif url.find("http://showsport-tv.com/")>-1:
url = ShowsportTvCom.getChannels(url)[0]["link"]
elif url.find("rtmp://")==-1:
try:
if url.find(", referer: ")>-1:
page = url[url.find(", referer: ")+len(", referer: "):]
url = url[:url.find(", referer: ")]
logger.debug("changing page to referer: "+page)
logger.debug("trying decoder part for url: "+url)
url = Decoder.decodeLink(url,page)
except:
logger.info("decoder url launched an exception, probably could not be decoded")
pass
#launch redirects to his better addons
if url.find("sop://")>-1 or url.find("acestream://")>-1 or url.find(".acelive")>-1: #required plexus or something similar installed, this dependency is external from this addon so needs to be installed
logger.info("trying to send link to plexus: "+url)
mode = "1"
if url.find("sop://")>-1:
mode = "2"
url = "plugin://program.plexus/?mode="+mode+"&url="+url+"&name=RemoteLink"
elif url.find(".torrent")>-1 or url.find("magnet:")>-1:
logger.info("trying to send link to quasar: "+url)
url = urllib.quote_plus(url)
url = "plugin://plugin.video.quasar/play?uri="+url
elif url.find("youtube.com/")>-1:
id = ""
if url.find("v=")>-1:
id = url[url.find("v=")+len("v="):]
elif url.find("/embed/")>-1:
id = url[url.find("/embed/")+len("/embed/"):]
url = "plugin://plugin.video.youtube/play/?video_id="+id+""
elif url.find("vimeo.com/")>-1:
url = "plugin://plugin.video.vimeo/play/?video_id="+urllib.quote_plus(url)
else:
logger.info("nothing done!")
logger.debug("launching playable url: "+url)
play(url,page)