diff options
author | 吳俊翰 | 2023-05-08 15:31:40 +0800 |
---|---|---|
committer | GitHub | 2023-05-08 15:31:40 +0800 |
commit | ab7e1d1a2fdb8bef6ff94e2e5577a984acf91b8c (patch) | |
tree | 934fe77273d337bc8a51e8a65c4820c72741b9f6 | |
parent | 11bd443808860a69badd69ca30512c8058d586f0 (diff) |
Update main.py
-rw-r--r-- | main.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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 |