This commit is contained in:
Cyberes 2023-01-21 15:26:00 -07:00
parent f02133deca
commit 08f911e20f
No known key found for this signature in database
GPG Key ID: 194A1C358AACFC39
1 changed files with 4 additions and 9 deletions

View File

@ -46,8 +46,8 @@ def download_video(args) -> dict:
yt_dlp = ydl.YDL(ydl_opts)
# Get a bar
locked = False
if len(bars):
locked = False
# We're going to wait until a bar is available for us to use.
while not locked:
for item in bars:
@ -57,10 +57,9 @@ def download_video(args) -> dict:
bar_lock = item[1]
break
width, _ = os.get_terminal_size()
desc_with = int(np.round(width * (1 / 4)))
desc_with = int(np.round(os.get_terminal_size()[0] * (1 / 4)))
bar = tqdm(total=100, position=(offset if len(bars) else None), desc=video['title'].ljust(desc_with)[:desc_with], bar_format='{l_bar}{bar}| {n_fmt}/{total_fmt} [{elapsed}<{remaining}{postfix}]', leave=False, disable=not len(bars))
output_dict = {'downloaded_video_id': None, 'video_error_logger_msg': [], 'status_msg': [], 'logger_msg': []} # empty object
output_dict = {'downloaded_video_id': None, 'blacklist_video_id': None, 'video_error_logger_msg': [], 'status_msg': [], 'logger_msg': []} # empty object
start_time = time.time()
try:
@ -76,10 +75,6 @@ def download_video(args) -> dict:
except Exception as e:
output_dict['video_error_logger_msg'].append(f"{video['id']} {video['title']} -> {e}")
bar.close()
try:
if locked:
bar_lock.release()
except UnboundLocalError:
pass
except NameError:
pass
return output_dict