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


Python Utils.download方法代码示例

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


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

示例1: download

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

    folder = Config.tf1Folder

    localName = os.path.join(folder, "news.json")
    f = Utils.download(grabber, progress, newsUrl, localName, downType, "utf-8", True)

    processNews(grabber, f, folder, progress, downType, db)

    localName = os.path.join(folder, "programs.json")
    f = Utils.download(grabber, progress, programsUrl, localName, downType, "utf-8", True)

    processPrograms(grabber, f, folder, progress, downType, db)
开发者ID:audetto,项目名称:raireplay,代码行数:16,代码来源:TF1.py

示例2: download

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

    folder = Config.searchFolder
    localFilename = os.path.join(folder, term + ".json")
    f = Utils.download(grabber, None, dataUrl, localFilename, downType, "utf-8")

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

示例3: download

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import download [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

示例4: processItem

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import download [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

示例5: download

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import download [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

示例6: download

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import download [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

示例7: downloadGroup

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

    # we set it to True as this is a group
    # and subject to continuous changes
    checkTimestamp = True

    # .0
    url_0 = getDataUrl(groupId, 0)
    localName_0 = os.path.join(folder, str(groupId) + ".0.json")
    f_0 = Utils.download(grabber, progress, url_0, localName_0, downType, "utf-8", checkTimestamp)

    if f_0:
        processGroup(grabber, f_0, name, db)

    # .1
    url_1 = getDataUrl(groupId, 1)
    localName_1 = os.path.join(folder, str(groupId) + ".1.json")
    f_1 = Utils.download(grabber, progress, url_1, localName_1, downType, "utf-8", checkTimestamp)

    if f_1:
        processGroup(grabber, f_1, name, db)
开发者ID:audetto,项目名称:raireplay,代码行数:23,代码来源:TF1.py

示例8: download

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import download [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

示例9: processPage

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import download [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

示例10: __init__

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import download [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

示例11: downloadItems

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import download [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

示例12: getTS

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import download [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

示例13: download

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import download [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

示例14: download

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import download [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

示例15: process

# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import download [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


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