This commit is contained in:
parent
206fcdebc4
commit
e7fe739b49
|
@ -68,23 +68,23 @@ logging.StreamHandler(stream=sys.stderr)
|
|||
logger.addHandler(fh)
|
||||
|
||||
# since youtube-dl updates so much check for updates
|
||||
if not args.no_update:
|
||||
print('checking for updates...')
|
||||
pipOut = subprocess.run('python3.7 -m pip list --outdated --format json', capture_output=True, encoding="utf-8", shell=True)
|
||||
pipJson = json.loads(pipOut.stdout)
|
||||
updatable = []
|
||||
for x in pipJson:
|
||||
updatable.append(x['name'])
|
||||
logger.info(str(len(updatable)) + ' updatable pip packages')
|
||||
print(str(len(updatable)) + ' updatable pip packages')
|
||||
for x in updatable:
|
||||
sys.stdout.write('\x1b[2K') # erase last line
|
||||
sys.stdout.write('\rupdating ' + x)
|
||||
sys.stdout.flush()
|
||||
logger.info('updating ' + x)
|
||||
process = subprocess.Popen('python3.7 -m pip install --upgrade ' + x, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
process.wait()
|
||||
print()
|
||||
# if not args.no_update:
|
||||
# print('checking for updates...')
|
||||
# pipOut = subprocess.run('python3.7 -m pip list --outdated --format json', capture_output=True, encoding="utf-8", shell=True)
|
||||
# pipJson = json.loads(pipOut.stdout)
|
||||
# updatable = []
|
||||
# for x in pipJson:
|
||||
# updatable.append(x['name'])
|
||||
# logger.info(str(len(updatable)) + ' updatable pip packages')
|
||||
# print(str(len(updatable)) + ' updatable pip packages')
|
||||
# for x in updatable:
|
||||
# sys.stdout.write('\x1b[2K') # erase last line
|
||||
# sys.stdout.write('\rupdating ' + x)
|
||||
# sys.stdout.flush()
|
||||
# logger.info('updating ' + x)
|
||||
# process = subprocess.Popen('python3.7 -m pip install --upgrade ' + x, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
# process.wait()
|
||||
# print()
|
||||
|
||||
|
||||
def doLog(msg, level):
|
||||
|
@ -247,7 +247,10 @@ else:
|
|||
print(x.strip('\n'))
|
||||
else:
|
||||
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
||||
ydl.download([x])
|
||||
try:
|
||||
ydl.download([x])
|
||||
except youtube_dl.utils.DownloadError as e:
|
||||
print(e)
|
||||
print()
|
||||
else:
|
||||
print('[info] Video too big')
|
||||
|
|
Reference in New Issue