Skip to content

Commit

Permalink
Merge pull request #65 from oskvr37/1.9
Browse files Browse the repository at this point in the history
1.9
  • Loading branch information
oskvr37 authored Dec 29, 2024
2 parents 5ee70cb + aaaca1b commit 8a31eab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="tiddl",
version="1.9.2",
version="1.9.3",
description="TIDDL (Tidal Downloader) is a Python CLI application that allows downloading Tidal tracks.",
long_description=open("README.md", encoding="utf-8").read(),
long_description_content_type="text/markdown",
Expand Down
5 changes: 5 additions & 0 deletions tiddl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ def downloadAlbum(album_id: str | int, skip_existing: bool):

for item in album_items["items"]:
track = item["item"]

if item["type"] != "track":
logger.warning(f"item is not a track: {track["title"]} ({track["id"]})")
continue

try:
file_dir, file_name = downloadTrack(
track,
Expand Down
4 changes: 4 additions & 0 deletions tiddl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class FormattedTrack(TypedDict):
released: str
year: str
playlist_number: str
version: str


def formatFilename(template: str, track: Track, playlist=""):
Expand All @@ -82,6 +83,8 @@ def formatFilename(template: str, track: Track, playlist=""):
"%Y-%m-%dT%H:%M:%S.000+0000",
)

version = track.get("version", "")

formatted_track: FormattedTrack = {
"album": re.sub(r'[<>:"|?*/\\]', "_", track["album"]["title"].strip()),
"artist": track["artist"]["name"].strip(),
Expand All @@ -94,6 +97,7 @@ def formatFilename(template: str, track: Track, playlist=""):
"released": release_date.strftime("%m-%d-%Y"),
"year": release_date.strftime("%Y"),
"playlist_number": str(track.get("playlistNumber", "")),
"version": f"({version})" if version else "",
}

dirs = template.split("/")
Expand Down

0 comments on commit 8a31eab

Please sign in to comment.