diff --git a/rip/config.toml b/rip/config.toml index 4f8816d..667c11b 100644 --- a/rip/config.toml +++ b/rip/config.toml @@ -150,7 +150,7 @@ add_singles_to_folder = false folder_format = "{albumartist} - {title} ({year}) [{container}] [{bit_depth}B-{sampling_rate}kHz]" # Available keys: "tracknumber", "artist", "albumartist", "composer", "title", # and "albumcomposer" -track_format = "{tracknumber}. {artist} - {title}" +track_format = "{tracknumber}. {artist} - {title}{explicit}" # Only allow printable ASCII characters in filenames. restrict_characters = false diff --git a/streamrip/constants.py b/streamrip/constants.py index bce45d7..d70d949 100644 --- a/streamrip/constants.py +++ b/streamrip/constants.py @@ -128,6 +128,7 @@ TRACK_KEYS = ( "composer", "title", "albumcomposer", + "explicit", ) ALBUM_KEYS = ( "albumartist", diff --git a/streamrip/media.py b/streamrip/media.py index d6afc3d..090c38c 100644 --- a/streamrip/media.py +++ b/streamrip/media.py @@ -1,9 +1,4 @@ -"""Bases that handle parsing and downloading media. - -These are the lower level classes that are handled by Album, Playlist, -and the other objects. They can also be downloaded individually, for example, -as a single track. -""" +"""Bases that handle parsing and downloading media. """ import abc import concurrent.futures diff --git a/streamrip/metadata.py b/streamrip/metadata.py index 23c8b82..dba05be 100644 --- a/streamrip/metadata.py +++ b/streamrip/metadata.py @@ -67,7 +67,7 @@ class TrackMetadata: disctotal: Optional[int] = None # not included in tags - explicit: Optional[bool] = False + explicit: bool = False quality: Optional[int] = None sampling_rate: Optional[int] = None bit_depth: Optional[int] = None @@ -200,7 +200,7 @@ class TrackMetadata: self.albumartist = safe_get(resp, "artist", "name") self.label = resp.get("label") self.url = resp.get("link") - self.explicit = bool(resp.get("parental_warning")) + self.explicit = resp.get("parental_warning", False) # not embedded self.quality = 2 @@ -290,8 +290,8 @@ class TrackMetadata: if not hasattr(self, "_title"): return None - if self.explicit: - return f"{self._title} (Explicit)" + # if self.explicit: + # return f"{self._title} (Explicit)" return self._title diff --git a/streamrip/utils.py b/streamrip/utils.py index 0ae90e3..4bcdb01 100644 --- a/streamrip/utils.py +++ b/streamrip/utils.py @@ -149,13 +149,20 @@ def clean_format(formatter: str, format_info, restrict: bool = False): fmt_keys = filter(None, (i[1] for i in Formatter().parse(formatter))) # fmt_keys = (i[1] for i in Formatter().parse(formatter) if i[1] is not None) - logger.debug("Formatter keys: %s", fmt_keys) + logger.debug("Formatter keys: %s", formatter) - clean_dict = dict() + clean_dict = {} for key in fmt_keys: + logger.debug(repr(key)) + logger.debug(format_info.get(key)) if isinstance(format_info.get(key), (str, float)): + logger.debug("1") clean_dict[key] = clean_filename(str(format_info[key]), restrict=restrict) + elif key == "explicit": + logger.debug("3") + clean_dict[key] = " (Explicit) " if format_info.get(key, False) else "" elif isinstance(format_info.get(key), int): # track/discnumber + logger.debug("2") clean_dict[key] = f"{format_info[key]:02}" else: clean_dict[key] = "Unknown"