Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enables the use of the {albumtitle} field in the [filepaths] section of the config.toml file #826

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions streamrip/metadata/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class TrackMetadata:
title: str
album: AlbumMetadata
artist: str
albumtitle: str
tracknumber: int
discnumber: int
composer: str | None
Expand All @@ -53,6 +54,8 @@ def from_qobuz(cls, album: AlbumMetadata, resp: dict) -> TrackMetadata | None:
composer = typed(resp.get("composer", {}).get("name"), str | None)
tracknumber = typed(resp.get("track_number", 1), int)
discnumber = typed(resp.get("media_number", 1), int)
albumtitle = typed(resp.get("album", {}).get("title"), str | None)

artist = typed(
safe_get(
resp,
Expand Down Expand Up @@ -80,6 +83,7 @@ def from_qobuz(cls, album: AlbumMetadata, resp: dict) -> TrackMetadata | None:
title=title,
album=album,
artist=artist,
albumtitle=albumtitle,
tracknumber=tracknumber,
discnumber=discnumber,
composer=composer,
Expand Down Expand Up @@ -235,9 +239,11 @@ def format_track_path(self, format_string: str) -> str:
"title": self.title,
"tracknumber": self.tracknumber,
"artist": self.artist,
"albumtitle": self.albumtitle,
"albumartist": self.album.albumartist,
"albumcomposer": self.album.albumcomposer or none_text,
"composer": self.composer or none_text,
"explicit": " (Explicit) " if self.info.explicit else "",
}
return format_string.format(**info)