diff --git a/dist/spodcast-0.5.1.tar.gz b/dist/spodcast-0.5.1.tar.gz deleted file mode 100644 index 04dae3a..0000000 Binary files a/dist/spodcast-0.5.1.tar.gz and /dev/null differ diff --git a/dist/spodcast-0.5.2.tar.gz b/dist/spodcast-0.5.2.tar.gz new file mode 100644 index 0000000..0043e79 Binary files /dev/null and b/dist/spodcast-0.5.2.tar.gz differ diff --git a/setup.cfg b/setup.cfg index 45a1eba..1eab455 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/spodcast/podcast.py b/spodcast/podcast.py index edb3370..9a8da7a 100644 --- a/spodcast/podcast.py +++ b/spodcast/podcast.py @@ -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():