示例#1
0
def downloadvideo(params, api=True):
    global dlproc
    global dlinfo

    if dlproc != None and dlproc.is_alive() == True:
        result = {"result" : 1}
    else:
        title = params["title"]
        vname = params["vname"]
        vid = params["vid"]

        conf = config.readConf()
        mail = conf["mail"]
        passwd = conf["passwd"]

        args = [
            '-u', mail, '-p', passwd,
            '-l', 'html/video/'+title,
            '-n', vname+'.flv',
            vid
        ]

        dlinfo["title"] = title
        dlinfo["vname"] = vname

        dl = downloadflv.DownloadFlv(args)
        dlproc = Process(target=dl.invoke)
        dlproc.start()

        result = {"result" : 0}

    return True, result
示例#2
0
def _dlall_wrapper(params):
    for titleinfo in getrecorded(None, api=False)["titles"]:
        title = titleinfo["title"]
        for storyinfo in getdetail({"title" : title}, api=False)["stories"]:
            try:
                vname = storyinfo["title"].encode("utf-8")
                vid = storyinfo["vid"].encode("utf-8")
                if getvideostate({"title" : title, "vname" : vname}, api=False, masterProc=False)["result"] == 1:
                    conf = config.readConf()
                    mail = conf["mail"]
                    passwd = conf["passwd"]
                
                    args = [
                        '-u', mail, '-p', passwd,
                        '-l', 'html/video/'+title,
                        '-n', vname+'.flv',
                        vid
                    ]

                    dlinfo["title"] = title
                    dlinfo["vname"] = vname

                    downloadflv.DownloadFlv(args).invoke()
            except Exception as e:
                print e

    return True, {"result" : "success"}
示例#3
0
def updatechinfo(params):
    reclst = config.readConf()["recording"]
    for channel in reclst:
        try:
            getchannelinfo.getChannelInfo(channel)
        except Exception as e:
            print "取得失敗", e

    return True, {"result" : "success"}
示例#4
0
def readconf(params):
    return True, {"result" : config.readConf()}
示例#5
0
def getallrecs(params):
    conf = config.readConf()
    return True, {"result" : conf["recording"]}