From 08ece45ae9edfe16c40403428a2375f78fa860a1 Mon Sep 17 00:00:00 2001 From: logykk Date: Tue, 22 Mar 2022 21:35:38 +1300 Subject: [PATCH] Fix tracks getting cutoff --- CHANGELOG.md | 3 +++ zotify/config.py | 2 +- zotify/podcast.py | 2 +- zotify/track.py | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65266e0..70294d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## v0.6.4 +- Fixed upstream bug causing tracks to not download fully + ## 0.6.3 - Less stupid single format - Fixed error in json fetching diff --git a/zotify/config.py b/zotify/config.py index 7385580..b56581d 100644 --- a/zotify/config.py +++ b/zotify/config.py @@ -57,7 +57,7 @@ CONFIG_VALUES = { RETRY_ATTEMPTS: { 'default': '1', 'type': int, 'arg': '--retry-attemps' }, BULK_WAIT_TIME: { 'default': '1', 'type': int, 'arg': '--bulk-wait-time' }, OVERRIDE_AUTO_WAIT: { 'default': 'False', 'type': bool, 'arg': '--override-auto-wait' }, - CHUNK_SIZE: { 'default': '50000', 'type': int, 'arg': '--chunk-size' }, + CHUNK_SIZE: { 'default': '20000', 'type': int, 'arg': '--chunk-size' }, DOWNLOAD_REAL_TIME: { 'default': 'False', 'type': bool, 'arg': '--download-real-time' }, LANGUAGE: { 'default': 'en', 'type': str, 'arg': '--language' }, PRINT_SPLASH: { 'default': 'False', 'type': bool, 'arg': '--print-splash' }, diff --git a/zotify/podcast.py b/zotify/podcast.py index e630184..adabc4a 100644 --- a/zotify/podcast.py +++ b/zotify/podcast.py @@ -118,7 +118,7 @@ def download_episode(episode_id) -> None: unit_divisor=1024 ) as p_bar: prepare_download_loader.stop() - for _ in range(int(total_size / Zotify.CONFIG.get_chunk_size()) + 1): + 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) diff --git a/zotify/track.py b/zotify/track.py index 777b9cb..e031378 100644 --- a/zotify/track.py +++ b/zotify/track.py @@ -221,7 +221,7 @@ 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 / Zotify.CONFIG.get_chunk_size()) + 1): + 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)