本文整理汇总了Python中asi.Utils.addH264Url方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.addH264Url方法的具体用法?Python Utils.addH264Url怎么用?Python Utils.addH264Url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类asi.Utils
的用法示例。
在下文中一共展示了Utils.addH264Url方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import addH264Url [as 别名]
def __init__(self, pid, grabber, data):
super(Elem, self).__init__()
self.pid = pid
self.title = data.findtext("titolo")
self.description = data.findtext("descrizione")
self.channel = data.findtext("dominio")
self.grabber = grabber
strTime = data.findtext("datapubblicazione")
strTime = strTime.replace("-", "/")
self.datetime = datetime.datetime.strptime(strTime, "%d/%m/%Y")
# extra experimental data
h264 = data.findtext("h264")
Utils.addH264Url(self.h264, 0, h264)
self.ts = data.findtext("m3u8")
self.id = data.findtext("localid")
self.length = data.findtext("durata")
web = data.findtext("web")
if not web:
web = RAIUrls.getWebFromID(self.id)
self.url = RAIUrls.base + web
self.filename = Utils.makeFilename(self.title)
self.canFollow = True
示例2: __init__
# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import addH264Url [as 别名]
def __init__(self, grabber, url, channel, date, pid, title, desc, h264, m3u8, wmv):
super(Program, self).__init__()
self.url = url
self.pid = pid
self.title = title
self.description = desc
self.channel = channel
if date:
self.datetime = datetime.datetime.strptime(date, "%d/%m/%Y")
else:
self.datetime = datetime.datetime.now()
Utils.addH264Url(self.h264, 0, h264)
if m3u8:
self.ts = m3u8
if wmv:
self.mms = wmv
self.grabber = grabber
self.filename = Utils.makeFilename(self.title)
self.canFollow = True
示例3: getH264
# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import addH264Url [as 别名]
def getH264(self):
if self.h264:
return self.h264
content = Utils.getStringFromUrl(self.grabber, self.url)
root = ElementTree.fromstring(content)
if root.tag == "smil":
url = root.find("body").find("switch").find("video").attrib.get("src")
Utils.addH264Url(self.h264, 0, url)
return self.h264
示例4: extractH264Ext
# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import addH264Url [as 别名]
def extractH264Ext(value):
res = {}
reg = "^h264_(\d+)"
for k in value:
m = re.match(reg, k)
url = value[k]
if m and url:
bwidth = int(m.group(1))
Utils.addH264Url(res, bwidth, url)
return res
示例5: __init__
# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import addH264Url [as 别名]
def __init__(self, grabber, url, downType, pid):
super(Demand, self).__init__()
self.grabber = grabber
parts = urllib.parse.urlparse(url)
if not parts.scheme:
url = RAIUrls.getItemUrl(url)
self.url = url
self.pid = pid
folder = Config.itemFolder
localFilename = os.path.join(folder, Utils.httpFilename(self.url))
f = Utils.download(grabber, None, self.url, localFilename, downType, "utf-8")
parser = VideoHTMLParser()
parser.feed(f.read())
self.values = parser.values
self.channel = "item"
self.title = self.values.title
self.ts = self.values.videoUrlM3U8
Utils.addH264Url(self.h264, 0, self.values.videoUrlH264)
if self.values.date:
self.datetime = datetime.datetime.strptime(self.values.date, "%d/%m/%Y")
self.mms = None
if self.values.type and self.values.type != "Video":
# this is a case of a Photogallery
self.url = None
self.filename = None
return
if not self.values.videoUrl:
self.values.videoUrl = self.values.videoPath
#sometimes we get .mp4 which does not work
self.values.videoUrl = self.values.videoUrl.replace("relinkerServlet.mp4", "relinkerServlet.htm")
#make a nice filename
self.filename = Utils.makeFilename(self.title)
self.mms = self.values.videoUrl
示例6: __init__
# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import addH264Url [as 别名]
def __init__(self, pid, grabber, title, description, date, length, url, h264, ts, mms):
super(Episode, self).__init__()
self.pid = pid
self.grabber = grabber
self.title = title
self.description = description
self.url = url
self.datetime = datetime.datetime.strptime(date, "%d-%m-%Y")
self.length = length
Utils.addH264Url(self.h264, 0, h264)
self.ts = ts
self.mms = mms
self.filename = Utils.makeFilename(self.title)
示例7: __init__
# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import addH264Url [as 别名]
def __init__(self, grabber, url, channel, date, pid, title, desc, h264, m3u8):
super(Program, self).__init__()
self.url = url
self.pid = pid
self.title = title
self.description = desc
self.channel = channel
strtime = date.replace("-", "/")
self.datetime = datetime.datetime.strptime(strtime, "%d/%m/%Y %H:%M")
Utils.addH264Url(self.h264, 0, h264)
if m3u8:
self.ts = m3u8
self.grabber = grabber
name = Utils.makeFilename(self.title)
self.filename = name + "-" + self.datetime.strftime("%Y-%m-%d")
self.canFollow = True
示例8: parseItem
# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import addH264Url [as 别名]
def parseItem(grabber, channel, date, time, value, db):
name = value["t"]
desc = value["d"]
secs = value["l"]
length = None
if secs != "":
length = datetime.timedelta(seconds = int(secs))
h264 = extractH264Ext(value)
# if the detailed h264 is not found, try with "h264"
if not h264:
single = value["h264"]
Utils.addH264Url(h264, 0, single)
# sometimes RAI puts the same url for h264 and TS
# normally this is only a valid h264,
# so we skip it in TS
h264Urls = h264.values()
tablet = value["urlTablet"]
if tablet in h264Urls:
tablet = None
smartPhone = value["urlSmartPhone"]
if smartPhone in h264Urls:
smartPhone = None
pid = value["i"]
if h264 or tablet or smartPhone:
pid = Utils.getNewPID(db, pid)
p = Program(grabber, channels[channel], date, time, pid, length, name, desc, h264, tablet, smartPhone)
Utils.addToDB(db, p)