Skip to content

Commit

Permalink
fix #66
Browse files Browse the repository at this point in the history
  • Loading branch information
oskvr37 committed Jan 15, 2025
1 parent 8eaf49c commit 9602b29
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tiddl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,8 @@ def downloadTrack(
playlist="",
cover_data=b"",
) -> tuple[str, str]:
if track.get("status") == 404:
raise ValueError(track)

if not track["allowStreaming"]:
logger.warning(
if track.get("status", 200) != 200 or not track["allowStreaming"]:
raise ValueError(
f"The track is not streamable: {track["title"]} ({track["id"]})"
)

Expand Down Expand Up @@ -240,8 +237,8 @@ def downloadAlbum(album_id: str | int, skip_existing: bool):
if SAVE_COVER:
album_cover.save(f"{download_path}/{file_dir}")

except ValueError:
logger.warning(f"track unavailable")
except ValueError as e:
logger.error(e)

skip_existing = not args.no_skip
failed_input = []
Expand Down Expand Up @@ -269,11 +266,14 @@ def downloadAlbum(album_id: str | int, skip_existing: bool):
logger.warning(f"{e.error['userMessage']} ({e.error['status']})")
continue

downloadTrack(
track,
file_template=track_template,
skip_existing=skip_existing,
)
try:
downloadTrack(
track,
file_template=track_template,
skip_existing=skip_existing,
)
except ValueError as e:
logger.error(e)

continue

Expand Down

0 comments on commit 9602b29

Please sign in to comment.