From ab7e1d1a2fdb8bef6ff94e2e5577a984acf91b8c Mon Sep 17 00:00:00 2001 From: 吳俊翰 Date: Mon, 8 May 2023 15:31:40 +0800 Subject: Update main.py --- main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 3404474..b73b728 100644 --- a/main.py +++ b/main.py @@ -134,21 +134,22 @@ def download_song(session, directory, name, url, song_counter, lock,file_format) if downloaded >= total: break if retry_count > 0: - print(f'Retry successful. Downloading {name}...') + tqdm.write(f'Retry successful. Downloading [{name}]...') retry_count = 0 + tqdm.write(f'{name} : Download complete.') except (requests.exceptions.RequestException, IOError) as e: if retry_count >= retries: raise e else: retry_count += 1 - print(f"Download of {name} failed. Retrying in 3 seconds ({retry_count}/{retries})", file=sys.stderr) + tqdm.write(f"Download of [{name}] failed. Retrying in 3 seconds ({retry_count}/{retries})", file=sys.stderr) time.sleep(3) source = session.get(url, stream=True, timeout=timeout) total = int(source.headers.get('content-length', 0)) downloaded = f.tell() if downloaded < total: - print(f'Download of {name} was incomplete. Retrying...', file=sys.stderr) + tqdm.write(f'Download of [{name}] was incomplete. Retrying...', file=sys.stderr) os.remove(filename) # Increase song counter -- cgit v1.2.3-70-g09d2