Basic fault tolerance

This commit is contained in:
logykk 2022-03-23 20:01:26 +13:00
parent 7c315da6f4
commit e052e13584
1 changed files with 3 additions and 3 deletions

View File

@ -221,13 +221,13 @@ def download_track(mode: str, track_id: str, extra_keys=None, disable_progressba
unit_divisor=1024,
disable=disable_progressbar
) as p_bar:
while True:
b = 0
while b < 5:
#for _ in range(int(total_size / Zotify.CONFIG.get_chunk_size()) + 2):
data = stream.input_stream.stream().read(Zotify.CONFIG.get_chunk_size())
p_bar.update(file.write(data))
downloaded += len(data)
if data == b'':
break
b += 1 if data == b'' else 0
if Zotify.CONFIG.get_download_real_time():
delta_real = time.time() - time_start
delta_want = (downloaded / total_size) * (duration_ms/1000)