diff options
| author | Robert Honz <exislow+github@gmail.com> | 2025-10-17 13:13:19 +0200 |
|---|---|---|
| committer | Robert Honz <exislow+github@gmail.com> | 2025-10-17 13:13:19 +0200 |
| commit | dd5a402dcebd79e1efe1b643ec874ade42683271 (patch) | |
| tree | 175917d2cdb59385799d00f0f55e6c13a5f590d5 /tidal_dl_ng/helper/tidal.py | |
| parent | feebdda62f0b64a94dfff63334ca9ee7984df453 (diff) | |
| download | tidal-dl-ng-dd5a402dcebd79e1efe1b643ec874ade42683271.tar.gz | |
feat(path): ✨ add customizable delimiters for artist names in file paths
* Updated `format_path_media` and related functions to accept customizable delimiters for artist names.
* Modified `Settings` class to include `filename_delimiter_artist` and `filename_delimiter_album_artist`.
* Enhanced `name_builder_artist` and `name_builder_album_artist` functions to utilize the new delimiters.
Diffstat (limited to 'tidal_dl_ng/helper/tidal.py')
| -rw-r--r-- | tidal_dl_ng/helper/tidal.py | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/tidal_dl_ng/helper/tidal.py b/tidal_dl_ng/helper/tidal.py index 22d8f00..4a06d21 100644 --- a/tidal_dl_ng/helper/tidal.py +++ b/tidal_dl_ng/helper/tidal.py @@ -10,11 +10,34 @@ from tidal_dl_ng.constants import FAVORITES, MediaType from tidal_dl_ng.helper.exceptions import MediaUnknown -def name_builder_artist(media: Track | Video | Album, delimiter: str = "; ") -> str: +def name_builder_artist(media: Track | Video | Album, delimiter: str = ", ") -> str: + """Builds a string of artist names for a track, video, or album. + + Returns a delimited string of all artist names associated with the given media. + + Args: + media (Track | Video | Album): The media object to extract artist names from. + delimiter (str, optional): The delimiter to use between artist names. Defaults to ", ". + + Returns: + str: A delimited string of artist names. + """ return delimiter.join(artist.name for artist in media.artists) -def name_builder_album_artist(media: Track | Album, first_only: bool = False, delimiter: str = "; ") -> str: +def name_builder_album_artist(media: Track | Album, first_only: bool = False, delimiter: str = ", ") -> str: + """Builds a string of main album artist names for a track or album. + + Returns a delimited string of main artist names from the album, optionally including only the first main artist. + + Args: + media (Track | Album): The media object to extract artist names from. + first_only (bool, optional): If True, only the first main artist is included. Defaults to False. + delimiter (str, optional): The delimiter to use between artist names. Defaults to ", ". + + Returns: + str: A delimited string of main album artist names. + """ artists_tmp: [str] = [] artists: [Artist] = media.album.artists if isinstance(media, Track) else media.artists |
