当前位置: 首页>>代码示例>>Python>>正文


Python Utils.httpFilename方法代码示例

本文整理汇总了Python中asi.Utils.httpFilename方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.httpFilename方法的具体用法?Python Utils.httpFilename怎么用?Python Utils.httpFilename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在asi.Utils的用法示例。


在下文中一共展示了Utils.httpFilename方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: download

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import httpFilename [as 别名]
def download(db, grabber, downType):
    progress = Utils.getProgress()
    name = Utils.httpFilename(RAIUrls.info)

    folder = Config.tgFolder
    localName = os.path.join(folder, name)

    f = Utils.download(grabber, progress, RAIUrls.info, localName, downType, "utf-8", True)
    process(grabber, progress, downType, f, db)
开发者ID:audetto,项目名称:andsoft,代码行数:11,代码来源:TG.py

示例2: processItem

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import httpFilename [as 别名]
def processItem(grabber, progress, downType, title, time, url, db):
    folder = Config.tgFolder

    name = Utils.httpFilename(url)
    localName = os.path.join(folder, name)

    f = Utils.download(grabber, progress, url, localName, downType, "utf-8", True)

    if f:
        processSet(grabber, title, time, f, db)
开发者ID:audetto,项目名称:andsoft,代码行数:12,代码来源:TG.py

示例3: download

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import httpFilename [as 别名]
def download(db, grabber, downType):
    page = Utils.httpFilename(RAIUrls.junior)

    folder = Config.juniorFolder
    localFilename = os.path.join(folder, page)

    progress = Utils.getProgress()
    f = Utils.download(grabber, progress, RAIUrls.junior, localFilename, downType, None, True)

    process(grabber, progress, folder, f, db, downType)
开发者ID:audetto,项目名称:andsoft,代码行数:12,代码来源:Junior.py

示例4: download

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import httpFilename [as 别名]
def download(db, grabber, downType):
    page = Utils.httpFilename(RAIUrls.onDemand)

    folder = Config.demandFolder
    localFilename = os.path.join(folder, page)

    progress = Utils.getProgress()

    f = Utils.download(grabber, progress, RAIUrls.onDemand, localFilename, downType, "raw-unicode-escape", True)

    process(grabber, f, db)
开发者ID:audetto,项目名称:andsoft,代码行数:13,代码来源:Demand.py

示例5: download

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import httpFilename [as 别名]
def download(db, grabber, downType):
    progress = Utils.getProgress()

    for channel in channels:
        url = getCatalogueUrl(channel)
        name = Utils.httpFilename(url) + "." + channel

        folder = Config.m6Folder
        localName = os.path.join(folder, name)

        f = Utils.download(grabber, progress, url, localName, downType, "utf-8", True)
        if (f):
            process(grabber, downType, f, channel, db)
开发者ID:audetto,项目名称:andsoft,代码行数:15,代码来源:M6.py

示例6: processPage

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import httpFilename [as 别名]
def processPage(grabber, progress, folder, f, db, downType):
    root = ElementTree.parse(f).getroot().find('menu')
    for e in root:
        if e.tag == "item" and e.attrib.get("id") == "video":
            path = e.find("src").attrib.get("path")
            url = RAIUrls.getJuniorBlock(path)

            name = Utils.httpFilename(url)
            localFilename = os.path.join(folder, name)

            g = Utils.download(grabber, progress, url, localFilename, downType, None, True)

            if g:
                processBlock(grabber, progress, folder, g, db, downType)
开发者ID:audetto,项目名称:andsoft,代码行数:16,代码来源:Junior.py

示例7: __init__

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import httpFilename [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
开发者ID:audetto,项目名称:andsoft,代码行数:51,代码来源:Item.py

示例8: downloadItems

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import httpFilename [as 别名]
def downloadItems(grabber, url, which, conf, folder, progress, downType, db):
    name = Utils.httpFilename(url)
    localName = os.path.join(folder, name)

    f = Utils.download(grabber, progress, url, localName, downType, "utf-8", True)

    if f:
        if which == FULL_VIDEO:
            processFullVideo(grabber, f, "episodi_interi", conf, folder, progress, downType, db)
        elif which == PROGRAM_LIST:
            processProgramList(grabber, f, conf, folder, progress, downType, db)
        elif which == PROGRAM:
            processProgram(grabber, f, conf, folder, progress, downType, db)
        elif which == PROGRAM_VIDEO:
            processFullVideo(grabber, f, "brand", conf, folder, progress, downType, db)
开发者ID:audetto,项目名称:andsoft,代码行数:17,代码来源:Mediaset.py

示例9: download

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import httpFilename [as 别名]
def download(db, grabber, downType):
    progress = Utils.getProgress()
    name = Utils.httpFilename(infoUrl)

    folder = Config.pluzzFolder
    localName = os.path.join(folder, name)

    f = Utils.download(grabber, progress, infoUrl, localName, downType, None, True)

    z = zipfile.ZipFile(f, "r")

    decoder = codecs.getreader("ascii")

    for a in z.namelist():
        if a.find("catch_up_") == 0:
            with z.open(a) as f:
                process(grabber, decoder(f), db)
开发者ID:audetto,项目名称:andsoft,代码行数:19,代码来源:Pluzz.py

示例10: getTS

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import httpFilename [as 别名]
    def getTS(self):
        if self.ts:
            return self.ts

        folder = Config.m6Folder
        name = Utils.httpFilename(self.url)
        localName = os.path.join(folder, name)
        progress = Utils.getProgress()

        f = Utils.download(self.grabber, progress, self.url, localName, self.downType, "utf-8", True)
        if (f):
            root = ElementTree.parse(f).getroot()
            asset = root.find("asset")
            for v in asset.findall("assetItem"):
                u = v.find("url").text
                self.ts = getTSUrl(u)
                return self.ts
开发者ID:audetto,项目名称:andsoft,代码行数:19,代码来源:M6.py

示例11: download

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import httpFilename [as 别名]
def download(db, grabber, downType, mediasetType):
    progress = Utils.getProgress()
    name = Utils.httpFilename(configUrl)

    folder = Config.mediasetFolder
    localName = os.path.join(folder, name)

    f = Utils.download(grabber, progress, configUrl, localName, downType, None, True)
    s = f.read().strip()
    root = ElementTree.fromstring(s)
    conf = parseConfig(root)

    if mediasetType == "tg5":
        url = conf["FullVideoRequestUrl"].replace("http://ww.", "http://www.")
        downloadItems(grabber, url, FULL_VIDEO, conf, folder, progress, downType, db)
    else:
        url = conf["ProgramListRequestUrl"]
        downloadItems(grabber, url, PROGRAM_LIST, conf, folder, progress, downType, db)
开发者ID:audetto,项目名称:andsoft,代码行数:20,代码来源:Mediaset.py

示例12: process

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import httpFilename [as 别名]
def process(grabber, progress, folder, f, db, downType):
    root = ElementTree.parse(f).getroot()

    for e in root:
        if e.tag == "elemento":
            uniqueNameNode = e.find("uniqueName")
            if uniqueNameNode is not None:
                uniqueName = uniqueNameNode.text
                if uniqueName:
                    url = RAIUrls.getJuniorPage(uniqueName)
                    name = Utils.httpFilename(url)

                    localFilename = os.path.join(folder, name)

                    g = Utils.download(grabber, progress, url, localFilename, downType, None, True)

                    if g:
                        processPage(grabber, progress, folder, g, db, downType)
开发者ID:audetto,项目名称:andsoft,代码行数:20,代码来源:Junior.py

示例13: download

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import httpFilename [as 别名]
def download(db, grabber, url, downType):
    page = Utils.httpFilename(url)
    page = os.path.splitext(page)[0]

    dataUrl = RAIUrls.getPageDataUrl(page)

    folder = Config.pageFolder
    localFilename = os.path.join(folder, page + ".xml")
    f = Utils.download(grabber, None, dataUrl, localFilename, downType, "utf-8")

    # ElementTree does not like unicode, it prefers byte strings
    s = f.read().strip()
    s = Utils.removeInvalidXMLCharacters(s)
    root = ElementTree.fromstring(s)

    for child in root.findall("content"):
        pid = Utils.getNewPID(db, None)
        it = Elem(pid, grabber, child)
        Utils.addToDB(db, it)
开发者ID:audetto,项目名称:andsoft,代码行数:21,代码来源:Page.py

示例14: follow

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import httpFilename [as 别名]
    def follow(self, db, downType):
        folder = Config.juniorFolder
        progress = Utils.getProgress()

        again = True
        url = self.url

        while again:
            name = Utils.httpFilename(url)
            localFilename = os.path.join(folder, name)

            f = Utils.download(self.grabber, progress, url, localFilename, downType, None, True)
            (index, total) = processSet(self.grabber, progress, folder, f, db, downType)
            if index + 1 == total:
                again = False
            else:
                # replace -V-0.xml -> -V-1.xml and so on
                pos = url.rfind("-V-")
                if pos == -1:
                    again = False
                else:
                    base = url[:pos]
                    url = "{0}-V-{1}.xml".format(base, index + 1)
开发者ID:audetto,项目名称:andsoft,代码行数:25,代码来源:Junior.py


注:本文中的asi.Utils.httpFilename方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。