mirror of
https://github.com/THIS-IS-NOT-A-BACKUP/zspotify.git
synced 2025-07-04 16:34:48 +00:00
fix abort of stream read to avoid to short tracks
This commit is contained in:
parent
438bf47c17
commit
a87017fd3d
@ -118,8 +118,10 @@ def download_episode(episode_id) -> None:
|
||||
unit_divisor=1024
|
||||
) as p_bar:
|
||||
prepare_download_loader.stop()
|
||||
for _ in range(int(total_size / ZSpotify.CONFIG.get_chunk_size()) + 1):
|
||||
last_read = 1
|
||||
while(downloaded < total_size and last_read):
|
||||
data = stream.input_stream.stream().read(ZSpotify.CONFIG.get_chunk_size())
|
||||
last_read = len(data)
|
||||
p_bar.update(file.write(data))
|
||||
downloaded += len(data)
|
||||
if ZSpotify.CONFIG.get_download_real_time():
|
||||
|
@ -199,8 +199,10 @@ def download_track(mode: str, track_id: str, extra_keys=None, disable_progressba
|
||||
unit_divisor=1024,
|
||||
disable=disable_progressbar
|
||||
) as p_bar:
|
||||
for _ in range(int(total_size / ZSpotify.CONFIG.get_chunk_size()) + 1):
|
||||
last_read = 1
|
||||
while(downloaded < total_size and last_read):
|
||||
data = stream.input_stream.stream().read(ZSpotify.CONFIG.get_chunk_size())
|
||||
last_read = len(data)
|
||||
p_bar.update(file.write(data))
|
||||
downloaded += len(data)
|
||||
if ZSpotify.CONFIG.get_download_real_time():
|
||||
|
Loading…
x
Reference in New Issue
Block a user