From 3b20c437db519f1fb0506eb28ea772a743813864 Mon Sep 17 00:00:00 2001 From: Jonathan Barratt Date: Fri, 22 Oct 2021 09:20:42 +0700 Subject: [PATCH] Don't skip download if local file is empty. If a download gets aborted for some reasons, zspotify left behind a 0 length file which caused the song to be skipped on the next run. This commit checks for a non-zero filesize before deciding whether to skip the download of an "existing" file or not. --- zspotify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zspotify.py b/zspotify.py index ce96c9df..29867b5d 100755 --- a/zspotify.py +++ b/zspotify.py @@ -573,7 +573,7 @@ def download_track(track_id_str: str, extra_paths=""): print("### SKIPPING:", song_name, "(SONG IS UNAVAILABLE) ###") else: - if os.path.isfile(filename) and SKIP_EXISTING_FILES: + if os.path.isfile(filename) and os.path.getsize(filename) and SKIP_EXISTING_FILES: print("### SKIPPING:", song_name, "(SONG ALREADY EXISTS) ###") else: