From e1c860a711c477df63f355d7b7a0ab577d58fd83 Mon Sep 17 00:00:00 2001 From: Christoph Stahl Date: Sun, 10 Aug 2025 22:38:40 +0200 Subject: [PATCH] Skip already download tracks --- src/qobuz_dl_remote/main.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/qobuz_dl_remote/main.py b/src/qobuz_dl_remote/main.py index dc5e234..5a6aca6 100755 --- a/src/qobuz_dl_remote/main.py +++ b/src/qobuz_dl_remote/main.py @@ -111,6 +111,11 @@ class Qobuz: def download_track(self, track: Track, filename: str, dest: str) -> None: download_url = self.get_download_url(track.id) dest_path = os.path.join(dest, filename) + if os.path.exists(dest_path): + skip = input(f"File {dest_path} already exists, skip download? [Y/n] ") + if skip.strip().lower() != "n": + print("Skipping download.") + return response = requests.get(download_url, stream=True) if response.status_code == 200: total_size = int(response.headers.get("content-length", 0)) @@ -158,8 +163,8 @@ class Qobuz: album_title = album.title tracks = album.tracks if album.tracks is not None else [] if os.path.exists(dest): - input(f"Destination {dest} already exists, skip download? [Y/n] ") - if input().strip().lower() != "n": + skip = input(f"Destination {dest} already exists, skip download? [Y/n] ") + if skip.strip().lower() != "n": print("Skipping download.") return