Ejemplo n.º 1
0
def main(cfg):
    liveurl = cfg.liveurl
    if cfg.interactive:
        liveurl = interact(cfg)
    elif cfg.favorite:
        for f in cfg.favorites:
            if f[0] == cfg.favorite:
                liveurl = f[1]
    elif cfg.channellist:
        spath = _util.script_path(__file__)
        os.system('python %s/xbmc_5ivdo.py -t 直播 > %s'%(spath, cfg.address_file))
        return
    recode(url=liveurl, duration=cfg.duration, vfmt=cfg.vfmt, outpath=cfg.outpath, npf=cfg.npf,
           freq=cfg.freq, tmin=cfg.tmin, tmax=cfg.tmax, proxy=cfg.proxyaddr, log=cfg.log)
Ejemplo n.º 2
0
def main(cfg):
    liveurl = cfg.liveurl
    if cfg.interactive:
        liveurl = interact(cfg)
    elif cfg.favorite:
        for f in cfg.favorites:
            if f[0] == cfg.favorite:
                liveurl = f[1]
    elif cfg.channellist:
        spath = _util.script_path(__file__)
        os.system('python %s/xbmc_5ivdo.py -t 直播 > %s' %
                  (spath, cfg.address_file))
        return
    recode(url=liveurl,
           duration=cfg.duration,
           vfmt=cfg.vfmt,
           outpath=cfg.outpath,
           npf=cfg.npf,
           freq=cfg.freq,
           tmin=cfg.tmin,
           tmax=cfg.tmax,
           proxy=cfg.proxyaddr,
           log=cfg.log)
Ejemplo n.º 3
0
def main():
    import getopt

    dir_json = util.script_path(__file__)
    cfg_json = os.path.join(dir_json, "backup2dp.json")
    debug = None
    opts, args = getopt.getopt(argv[1:], "c:d")
    for k, v in opts:
        if k in ("-c"):
            cfg_json = os.path.abspath(v)
            dir_json = os.path.split(cfg_json)[0]
        elif k in ("-d"):
            debug = True
    if not os.path.exists(cfg_json):
        print_json_fomat(dir_json)
        return
    config = json.load(open(cfg_json))
    outpath = config["outpath"].replace("%(home)", home)
    outpath = os.path.join(outpath, curr_time())
    if debug is None:
        debug = config["debug"] if "debug" in config else False
    for inc in config["includes"]:
        config["settings"] += _find_settings_json(inc, dir_json)
    for setting in config["settings"]:
        name = setting["name"]
        path = setting["path"].replace("%(home)", home)
        ignores = setting["ignore"] if "ignore" in setting else None
        selects = setting["selects"] if "selects" in setting else None
        linkfile = setting["linkfile"] if "linkfile" in setting else False
        if not os.path.isdir(outpath):
            os.mkdir(outpath)
        out = os.path.join(outpath, name + ".zip")
        plog("backuping %s" % path)
        files = zipit(path, out, ignores, selects, linkfile)
        if debug:
            print files
        plog("%d file backuped for %s" % (len(files), path))
Ejemplo n.º 4
0
def main():
    import getopt
    dir_json = util.script_path(__file__)
    cfg_json = os.path.join(dir_json, 'backup2dp.json')
    debug = None
    opts, args = getopt.getopt(argv[1:], "c:d")
    for k, v in opts:
        if k in ("-c"):
            cfg_json = os.path.abspath(v)
            dir_json = os.path.split(cfg_json)[0]
        elif k in ("-d"):
            debug = True
    if not os.path.exists(cfg_json):
        print_json_fomat(dir_json)
        return
    config = json.load(open(cfg_json))
    outpath = config["outpath"].replace("%(home)", home)
    outpath = os.path.join(outpath, curr_time())
    if debug is None:
        debug = config["debug"] if "debug" in config else False
    for inc in config["includes"]:
        config["settings"] += _find_settings_json(inc, dir_json)
    for setting in config['settings']:
        name = setting['name']
        path = setting['path'].replace("%(home)", home)
        ignores = setting['ignore'] if 'ignore' in setting else None
        selects = setting['selects'] if 'selects' in setting else None
        linkfile = setting['linkfile'] if 'linkfile' in setting else False
        if not os.path.isdir(outpath):
            os.mkdir(outpath)
        out = os.path.join(outpath, name + ".zip")
        plog('backuping %s' % path)
        files = zipit(path, out, ignores, selects, linkfile)
        if debug:
            print files
        plog('%d file backuped for %s' % (len(files), path))