Do not rely on reported file size when downloading stream (fixes #14)
This commit is contained in:
parent
50b545c8f8
commit
baccdad43c
4 changed files with 5 additions and 3 deletions
BIN
dist/spodcast-0.5.1.tar.gz
vendored
BIN
dist/spodcast-0.5.1.tar.gz
vendored
Binary file not shown.
BIN
dist/spodcast-0.5.2.tar.gz
vendored
Normal file
BIN
dist/spodcast-0.5.2.tar.gz
vendored
Normal file
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
[metadata]
|
||||
name = spodcast
|
||||
version = 0.5.1
|
||||
version = 0.5.2
|
||||
description = A caching Spotify podcast to RSS proxy.
|
||||
long_description = file:README.md
|
||||
long_description_content_type = text/markdown
|
||||
|
|
|
@ -122,8 +122,10 @@ def download_stream(stream, filepath):
|
|||
time_start = time.time()
|
||||
downloaded = 0
|
||||
with open(filepath, 'wb') as file:
|
||||
for _ in range(int(size / Spodcast.CONFIG.get_chunk_size()) + 1):
|
||||
data = stream.input_stream.stream().read(Spodcast.CONFIG.get_chunk_size())
|
||||
data = b""
|
||||
while data := stream.input_stream.stream().read(Spodcast.CONFIG.get_chunk_size()):
|
||||
if data == b"":
|
||||
break
|
||||
file.write(data)
|
||||
downloaded += len(data)
|
||||
if Spodcast.CONFIG.get_download_real_time():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue