summaryrefslogtreecommitdiff
path: root/tidal_dl_ng
diff options
context:
space:
mode:
authorRobert Honz <exislow+github@gmail.com>2024-03-14 06:30:47 +0100
committerRobert Honz <exislow+github@gmail.com>2024-03-14 06:36:48 +0100
commit5c5aac11f1903805c8dc95c8eaffa9b8d9ca4c8a (patch)
tree584f4befef815672a80d0bae53cbc49de36dc940 /tidal_dl_ng
parent7a357cdc61034564094dfbf6d8a2d03f825a2fa0 (diff)
downloadtidal-dl-ng-5c5aac11f1903805c8dc95c8eaffa9b8d9ca4c8a.tar.gz
✨ The full track name will be used as file title.
Diffstat (limited to 'tidal_dl_ng')
-rw-r--r--tidal_dl_ng/download.py8
-rw-r--r--tidal_dl_ng/gui.py12
-rw-r--r--tidal_dl_ng/helper/path.py5
-rw-r--r--tidal_dl_ng/helper/tidal.py8
4 files changed, 19 insertions, 14 deletions
diff --git a/tidal_dl_ng/download.py b/tidal_dl_ng/download.py
index 4d752cb..824f3aa 100644
--- a/tidal_dl_ng/download.py
+++ b/tidal_dl_ng/download.py
@@ -30,7 +30,7 @@ from tidal_dl_ng.constants import (
from tidal_dl_ng.helper.decryption import decrypt_file, decrypt_security_token
from tidal_dl_ng.helper.exceptions import MediaMissing, UnknownManifestFormat
from tidal_dl_ng.helper.path import check_file_exists, format_path_media, path_file_sanitize
-from tidal_dl_ng.helper.tidal import instantiate_media, items_results_all, name_builder_item
+from tidal_dl_ng.helper.tidal import instantiate_media, items_results_all, name_builder_item, name_builder_title
from tidal_dl_ng.metadata import Metadata
from tidal_dl_ng.model.gui_data import ProgressBars
from tidal_dl_ng.model.tidal import StreamManifest
@@ -304,7 +304,7 @@ class Download:
path_file=path_file,
lyrics=lyrics,
copy_right=copy_right,
- title=track.name,
+ title=name_builder_title(track),
artists=[artist.name for artist in track.artists],
album=track.album.name if track.album else "",
tracknumber=track.track_num,
@@ -349,10 +349,10 @@ class Download:
if isinstance(media, Mix):
list_media_name = media.title[:30]
elif video_download:
- list_media_name = media.name[:30]
+ list_media_name = name_builder_title(media)[:30]
else:
videos_include = False
- list_media_name = media.name[:30]
+ list_media_name = name_builder_title(media)[:30]
# Get all items of the list.
items = items_results_all(media, videos_include=videos_include)
diff --git a/tidal_dl_ng/gui.py b/tidal_dl_ng/gui.py
index 0c8e97a..532dd02 100644
--- a/tidal_dl_ng/gui.py
+++ b/tidal_dl_ng/gui.py
@@ -13,6 +13,8 @@ from tidal_dl_ng.helper.tidal import (
get_tidal_media_type,
instantiate_media,
items_results_all,
+ name_builder_artist,
+ name_builder_title,
search_results_all,
user_media_lists,
)
@@ -388,8 +390,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
if isinstance(item, Track):
result_item: ResultItem = ResultItem(
position=idx,
- artist=", ".join(artist.name for artist in item.artists),
- title=item.name,
+ artist=name_builder_artist(item),
+ title=name_builder_title(item),
album=item.album.name,
duration_sec=item.duration,
obj=item,
@@ -399,8 +401,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
elif isinstance(item, Video):
result_item: ResultItem = ResultItem(
position=idx,
- artist=", ".join(artist.name for artist in item.artists),
- title=item.name,
+ artist=name_builder_artist(item),
+ title=name_builder_title(item),
album=item.album.name if item.album else "",
duration_sec=item.duration,
obj=item,
@@ -421,7 +423,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
elif isinstance(item, Album):
result_item: ResultItem = ResultItem(
position=idx,
- artist=", ".join(artist.name for artist in item.artists),
+ artist=name_builder_artist(item),
title="",
album=item.name,
duration_sec=item.duration,
diff --git a/tidal_dl_ng/helper/path.py b/tidal_dl_ng/helper/path.py
index 65f9163..691056c 100644
--- a/tidal_dl_ng/helper/path.py
+++ b/tidal_dl_ng/helper/path.py
@@ -10,6 +10,7 @@ from tidalapi import Album, Mix, Playlist, Track, UserPlaylist, Video
from tidal_dl_ng import __name_display__
from tidal_dl_ng.constants import AudioExtensions, MediaType
+from tidal_dl_ng.helper.tidal import name_builder_artist, name_builder_title
def path_home() -> str:
@@ -84,12 +85,12 @@ def format_str_media(name: str, media: Track | Album | Playlist | UserPlaylist |
try:
if name == "artist_name":
if hasattr(media, "artists"):
- result = ", ".join(artist.name for artist in media.artists)
+ result = name_builder_artist(media)
elif hasattr(media, "artist"):
result = media.artist.name
elif name == "track_title":
if isinstance(media, Track | Video):
- result = media.name
+ result = name_builder_title(media)
elif name == "mix_name":
if isinstance(media, Mix):
result = media.title
diff --git a/tidal_dl_ng/helper/tidal.py b/tidal_dl_ng/helper/tidal.py
index 4ae57bd..c8b93bb 100644
--- a/tidal_dl_ng/helper/tidal.py
+++ b/tidal_dl_ng/helper/tidal.py
@@ -5,12 +5,14 @@ from tidal_dl_ng.constants import MediaType
from tidal_dl_ng.helper.exceptions import MediaUnknown
-def name_builder_artist(media: Track) -> str:
+def name_builder_artist(media: Track | Video | Album) -> str:
return ", ".join(artist.name for artist in media.artists)
-def name_builder_title(media: Track) -> str:
- return media.name
+def name_builder_title(media: Track | Video) -> str:
+ result: str = media.full_name if hasattr(media, "full_name") else media.name
+
+ return result
def name_builder_item(media: Track) -> str: