diff options
author | 吳俊翰 | 2023-05-05 17:31:09 +0800 |
---|---|---|
committer | GitHub | 2023-05-05 17:31:09 +0800 |
commit | b9c28af9e209a23cee63c8d006ce296283cfd93c (patch) | |
tree | 755af1c0440712f055a1096e3e4724f1abb9aa8c /main.py | |
parent | 5f698e6afefc87bd1a3ccdd1ed6b6401a289c5f9 (diff) |
Update main.py
Diffstat (limited to 'main.py')
-rw-r--r-- | main.py | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -150,6 +150,9 @@ def download_song(session, directory, name, url, song_counter, lock): if downloaded < total: print(f'Download of {name} was incomplete. Retrying...', file=sys.stderr) os.remove(filename) + # Increase song counter + with lock: + song_counter.value += 1 # If file is .wav then export to .flac if source.headers['content-type'] != 'audio/mpeg': @@ -157,11 +160,7 @@ def download_song(session, directory, name, url, song_counter, lock): os.remove(filename) filename = directory + '/' + make_valid(name) + '.flac' filetype = '.flac' - - # Increase song counter - with lock: - song_counter.value += 1 - + return filename, filetype @@ -303,7 +302,7 @@ def main(): song_total = song_counter.value album_total = album_counter.value # Write counter to file - with open("counter.txt", "a") as f: + with open("Statistics.txt", "a") as f: timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") f.write(f'Finish Time: {timestamp}\n') f.write(f'Total albums skipped: {pass_total}\n') |