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.
This commit is contained in:
Jonathan Barratt 2021-10-22 09:20:42 +07:00
parent aeec7c8fc4
commit 3b20c437db

View File

@ -573,7 +573,7 @@ def download_track(track_id_str: str, extra_paths=""):
print("### SKIPPING:", song_name, print("### SKIPPING:", song_name,
"(SONG IS UNAVAILABLE) ###") "(SONG IS UNAVAILABLE) ###")
else: 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, print("### SKIPPING:", song_name,
"(SONG ALREADY EXISTS) ###") "(SONG ALREADY EXISTS) ###")
else: else: