aboutsummaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
author吳俊翰2023-05-08 15:31:40 +0800
committerGitHub2023-05-08 15:31:40 +0800
commitab7e1d1a2fdb8bef6ff94e2e5577a984acf91b8c (patch)
tree934fe77273d337bc8a51e8a65c4820c72741b9f6 /main.py
parent11bd443808860a69badd69ca30512c8058d586f0 (diff)
Update main.py
Diffstat (limited to 'main.py')
-rw-r--r--main.py7
1 files 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