本文整理汇总了Python中YDStreamExtractor.overrideParam方法的典型用法代码示例。如果您正苦于以下问题:Python YDStreamExtractor.overrideParam方法的具体用法?Python YDStreamExtractor.overrideParam怎么用?Python YDStreamExtractor.overrideParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YDStreamExtractor
的用法示例。
在下文中一共展示了YDStreamExtractor.overrideParam方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resolveURLFile
# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import overrideParam [as 别名]
def resolveURLFile(path):
import YDStreamExtractor as StreamExtractor
StreamExtractor.overrideParam('noplaylist', True)
StreamExtractor.generateBlacklist(('.*:(?:user|channel|search)$', '(?i)generic.*'))
import xbmcvfs
f = xbmcvfs.File(path, 'r')
try:
url = f.read().strip()
except:
kodiutil.ERROR()
return
finally:
f.close()
vid = StreamExtractor.getVideoInfo(url)
if not vid:
return None
return vid.streamURL()
示例2: getURLMediaType
# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import overrideParam [as 别名]
# -*- coding: utf-8 -*-
import xbmc, xbmcgui
import urllib
import YDStreamExtractor as StreamExtractor
import YDStreamUtils as StreamUtils
import common
StreamExtractor.overrideParam("noplaylist", True)
StreamExtractor.generateBlacklist((".*:(?:user|channel|search)$", "(?i)generic.*"))
def getURLMediaType(url):
if url.startswith("http"):
videoTypes = xbmc.getSupportedMedia("video")
musicTypes = xbmc.getSupportedMedia("music")
imageTypes = xbmc.getSupportedMedia("picture")
ext = url.rsplit(".", 1)[-1]
if ext in videoTypes:
return "video"
elif ext in musicTypes:
return "audio"
elif ext in imageTypes:
return "image"
return protocolMediaType(url)
def canHandle(data):
if data.get("type") == "link":
url = data.get("url", "")
if StreamExtractor.mightHaveVideo(url):
return "video"
示例3: getURLMediaType
# 需要导入模块: import YDStreamExtractor [as 别名]
# 或者: from YDStreamExtractor import overrideParam [as 别名]
# -*- coding: utf-8 -*-
import xbmc, xbmcgui
import urllib
import YDStreamExtractor as StreamExtractor
import YDStreamUtils as StreamUtils
import common
StreamExtractor.overrideParam('noplaylist',True)
StreamExtractor.generateBlacklist(('.*:(?:user|channel|search)$','(?i)generic.*'))
def getURLMediaType(url):
if url.startswith('http'):
videoTypes = xbmc.getSupportedMedia('video')
musicTypes = xbmc.getSupportedMedia('music')
imageTypes = xbmc.getSupportedMedia('picture')
ext = url.rsplit('.',1)[-1]
if ext in videoTypes:
return 'video'
elif ext in musicTypes:
return 'audio'
elif ext in imageTypes:
return 'image'
return protocolMediaType(url)
def canHandle(data):
if data.get('type') == 'link':
url = data.get('url','')
if StreamExtractor.mightHaveVideo(url): return 'video'
mediaType = getURLMediaType(url)
if mediaType: return mediaType
return canPlayURL(url) and 'video' or None