write description, update on each loop

This commit is contained in:
Cyberes 2023-02-01 13:00:48 -07:00
parent f7024dc0ef
commit 2b52231810
1 changed files with 11 additions and 7 deletions

View File

@ -61,12 +61,15 @@ if not re.match(urlRegex, str(args.file)):
else: else:
url_list = [args.file] url_list = [args.file]
if not args.no_update:
print('Checking if yt-dlp needs to be updated...') def do_update():
updated = ydl.update_ytdlp() if not args.no_update:
if updated: print('Checking if yt-dlp needs to be updated...')
print('Restarting program...') updated = ydl.update_ytdlp()
restart_program() if updated:
print('Restarting program...')
restart_program()
if args.rm_cache: if args.rm_cache:
subprocess.run('yt-dlp --rm-cache-dir', shell=True) subprocess.run('yt-dlp --rm-cache-dir', shell=True)
@ -177,7 +180,7 @@ ydl_opts = {
'subtitlesformat': 'vtt', 'subtitlesformat': 'vtt',
'subtitleslangs': ['en'], 'subtitleslangs': ['en'],
'writeautomaticsub': True, 'writeautomaticsub': True,
# 'writedescription': True, 'writedescription': True,
'ignoreerrors': True, 'ignoreerrors': True,
'continuedl': False, 'continuedl': False,
'addmetadata': True, 'addmetadata': True,
@ -205,6 +208,7 @@ if not args.daemon:
]) ])
while True: while True:
do_update()
for i, target_url in tqdm(enumerate(url_list), total=len(url_list), position=0, desc='Inputs', disable=args.daemon): for i, target_url in tqdm(enumerate(url_list), total=len(url_list), position=0, desc='Inputs', disable=args.daemon):
logger.info('Fetching playlist...') logger.info('Fetching playlist...')
playlist = yt_dlp.playlist_contents(target_url) playlist = yt_dlp.playlist_contents(target_url)