Skip already download tracks
This commit is contained in:
parent
3c6f5e79ab
commit
e1c860a711
1 changed files with 7 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue