本文整理匯總了Python中YDStreamExtractor.generateBlacklist方法的典型用法代碼示例。如果您正苦於以下問題:Python YDStreamExtractor.generateBlacklist方法的具體用法?Python YDStreamExtractor.generateBlacklist怎麽用?Python YDStreamExtractor.generateBlacklist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類YDStreamExtractor
的用法示例。
在下文中一共展示了YDStreamExtractor.generateBlacklist方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: resolveURLFile
# 需要導入模塊: import YDStreamExtractor [as 別名]
# 或者: from YDStreamExtractor import generateBlacklist [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 generateBlacklist [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 generateBlacklist [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