summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Honz <exislow+github@gmail.com>2024-03-19 14:44:16 +0100
committerRobert Honz <exislow+github@gmail.com>2024-03-19 14:53:09 +0100
commite1dfc9ae0b86601e950387882533ab7ea6684f22 (patch)
treeac4bafded0151f88fd04e122fd7e44d0895e37e0
parent1e42f7c22d9cffe48163366eba3373f548ab235f (diff)
downloadtidal-dl-ng-e1dfc9ae0b86601e950387882533ab7ea6684f22.tar.gz
✨ Adds 'album_artist' to the folder names. Fixes #51
-rw-r--r--tidal_dl_ng/helper/path.py4
-rw-r--r--tidal_dl_ng/helper/tidal.py5
2 files changed, 6 insertions, 3 deletions
diff --git a/tidal_dl_ng/helper/path.py b/tidal_dl_ng/helper/path.py
index cda8663..2fc7d16 100644
--- a/tidal_dl_ng/helper/path.py
+++ b/tidal_dl_ng/helper/path.py
@@ -10,7 +10,7 @@ from tidalapi import Album, Mix, Playlist, Track, UserPlaylist, Video
from tidal_dl_ng import __name_display__
from tidal_dl_ng.constants import FILENAME_SANITIZE_PLACEHOLDER, UNIQUIFY_THRESHOLD, AudioExtensions, MediaType
-from tidal_dl_ng.helper.tidal import name_builder_artist, name_builder_title
+from tidal_dl_ng.helper.tidal import name_builder_artist, name_builder_title, name_builder_album_artist
def path_home() -> str:
@@ -88,6 +88,8 @@ def format_str_media(name: str, media: Track | Album | Playlist | UserPlaylist |
result = name_builder_artist(media)
elif hasattr(media, "artist"):
result = media.artist.name
+ elif name == "album_artist":
+ result = name_builder_album_artist(media)
elif name == "track_title":
if isinstance(media, Track | Video):
result = name_builder_title(media)
diff --git a/tidal_dl_ng/helper/tidal.py b/tidal_dl_ng/helper/tidal.py
index 2a61bd6..77dd72d 100644
--- a/tidal_dl_ng/helper/tidal.py
+++ b/tidal_dl_ng/helper/tidal.py
@@ -1,5 +1,5 @@
from tidalapi import Album, Mix, Playlist, Session, Track, UserPlaylist, Video
-from tidalapi.artist import Role
+from tidalapi.artist import Role, Artist
from tidalapi.session import SearchTypes
from tidal_dl_ng.constants import MediaType
@@ -12,8 +12,9 @@ def name_builder_artist(media: Track | Video | Album) -> str:
def name_builder_album_artist(media: Track | Album) -> str:
artists_tmp: [str] = []
+ artists: [Artist] = media.album.artists if isinstance(media, Track) else media.artists
- for artist in media.album.artists:
+ for artist in artists:
if Role.main in artist.roles:
artists_tmp.append(artist.name)