Beispiel #1
0
def dl_u2b(cfg):
    if  not cfg.urls[0].find("youtube.com/"):
        return False
    if not util.check_cmd(cfg.u2b_cmd):
        raise Exception( 'command not found:%s' %cfg.u2b_cmd)
    cmd = cfg.u2b_cmd
    cmd += r' --proxy "%s"' % cfg.u2b_proxy
    cmd += r' --o "%s"' % cfg.u2b_tiele_format
    cmd += r' --cache-dir "%s"' % cfg.u2b_cache
    cmd += r' %s' % cfg.urls[0]
    print('==> %s', cmd)
    os.system(cmd)
Beispiel #2
0
def dl_u2b(cfg):
    if not cfg.urls[0].find("youtube.com/"):
        return False
    if not util.check_cmd(cfg.u2b_cmd):
        raise Exception('command not found:%s' % cfg.u2b_cmd)
    cmd = cfg.u2b_cmd
    cmd += r' --proxy "%s"' % cfg.u2b_proxy
    cmd += r' --o "%s"' % cfg.u2b_tiele_format
    cmd += r' --cache-dir "%s"' % cfg.u2b_cache
    cmd += r' %s' % cfg.urls[0]
    print('==> %s', cmd)
    os.system(cmd)
Beispiel #3
0
            for i, dlv in enumerate(dlvs):
                if dlv.isArchived() or dlv.isError():
                    del dlvs[i]
            _sleep(1)
    except Exception as e:
        log.exception(e)
    finally:
        ws.setToStop()
        ws.join()


if __name__ == "__main__":
    cfg = DLVideoConfig().read_cmdline_config('dlvideo.ini', __file__, sys.argv)
    log = cfg.log
    try:
        print sys.argv
        if not dl_u2b(cfg):
            main(cfg, log)
        if util.check_cmd('say'):
            os.system(r'say "download finished!!"')
    except KeyboardInterrupt as e:
        print 'stop by user'
        exit(0)
    except Exception as e:
        log.exception(e)
        if util.check_cmd('say'):
            os.system(r'say "download failed!!"')
        raise


Beispiel #4
0
 def test_check_cmd(self):
     print 'test_check_cmd'
     self.assertTrue(util.check_cmd('ls'))
     self.assertTrue(not util.check_cmd('XXXXX'))
     self.assertTrue(util.check_cmd('ls'))
Beispiel #5
0
        while len(dlvs) > 0:
            for i, dlv in enumerate(dlvs):
                if dlv.isArchived() or dlv.isError():
                    del dlvs[i]
            _sleep(1)
    except Exception as e:
        log.exception(e)
    finally:
        ws.setToStop()
        ws.join()


if __name__ == "__main__":
    cfg = DLVideoConfig().read_cmdline_config('dlvideo.ini', __file__,
                                              sys.argv)
    log = cfg.log
    try:
        print sys.argv
        if not dl_u2b(cfg):
            main(cfg, log)
        if util.check_cmd('say'):
            os.system(r'say "download finished!!"')
    except KeyboardInterrupt as e:
        print 'stop by user'
        exit(0)
    except Exception as e:
        log.exception(e)
        if util.check_cmd('say'):
            os.system(r'say "download failed!!"')
        raise