Add id key in FOLDER_FORMAT #150

This commit is contained in:
Nathan Thomas 2021-09-06 20:18:50 -07:00
parent acec36801a
commit e49df1e719
4 changed files with 5 additions and 2 deletions

View file

@ -144,7 +144,7 @@ add_singles_to_folder = false
# "container", and "albumcomposer"
folder_format = "{albumartist} - {title} ({year}) [{container}] [{bit_depth}B-{sampling_rate}kHz]"
# Available keys: "tracknumber", "artist", "albumartist", "composer", "title",
# and "albumcomposer"
# "id", and "albumcomposer"
track_format = "{tracknumber}. {artist} - {title}"
# Only allow printable ASCII characters in filenames.
restrict_characters = false

View file

@ -136,6 +136,7 @@ ALBUM_KEYS = (
"sampling_rate",
"container",
"albumcomposer",
"id",
)
# TODO: rename these to DEFAULT_FOLDER_FORMAT etc
FOLDER_FORMAT = "{albumartist} - {title} ({year}) [{container}] [{bit_depth}B-{sampling_rate}kHz]"

View file

@ -515,7 +515,6 @@ class Track(Media):
a dict with the keys allowed in formatter strings, and their values in
the TrackMetadata object.
"""
print(f"{restrict=}")
formatter = self.meta.get_formatter(max_quality=self.quality)
logger.debug("Track meta formatter %s", formatter)
filename = clean_format(self.file_format, formatter, restrict=restrict)

View file

@ -167,6 +167,7 @@ class TrackMetadata:
self.sampling_rate = resp.get("maximum_sampling_rate")
self.quality = get_quality_id(self.bit_depth, self.sampling_rate)
self.booklets = resp.get("goodies")
self.id = resp.get("id")
if self.sampling_rate is not None:
self.sampling_rate *= 1000
@ -188,6 +189,7 @@ class TrackMetadata:
# 80, 160, 320, 640, 1280
self.cover_urls = get_cover_urls(resp, self.__source)
self.streamable = resp.get("allowStreaming", False)
self.id = resp.get("id")
if q := resp.get(
"audioQuality"
@ -220,6 +222,7 @@ class TrackMetadata:
self.cover_urls = get_cover_urls(resp, self.__source)
self.streamable = True
self.id = resp.get("id")
elif self.__source == "soundcloud":
raise NotImplementedError