summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Honz <exislow+github@gmail.com>2024-03-23 12:29:14 +0100
committerRobert Honz <exislow+github@gmail.com>2024-03-23 12:29:14 +0100
commit84c8036bddf9c613e6a13095b918ba0dcc5ae3ef (patch)
treeefbab905378a645a0621f1159eb209a58ddc5bd3
parent54d042a2e9c2c84b38256d793c76143868f3c5f5 (diff)
downloadtidal-dl-ng-84c8036bddf9c613e6a13095b918ba0dcc5ae3ef.tar.gz
✨ List EPs and singles while expanding artists in result pane.
-rw-r--r--tidal_dl_ng/helper/tidal.py33
1 files changed, 19 insertions, 14 deletions
diff --git a/tidal_dl_ng/helper/tidal.py b/tidal_dl_ng/helper/tidal.py
index 93c9f76..101ab5a 100644
--- a/tidal_dl_ng/helper/tidal.py
+++ b/tidal_dl_ng/helper/tidal.py
@@ -90,31 +90,36 @@ def search_results_all(session: Session, needle: str, types_media: SearchTypes =
def items_results_all(media_list: [Mix | Playlist | Album], videos_include: bool = True) -> [Track | Video | Album]:
- limit: int = 100
- offset: int = 0
- done: bool = False
result: [Track | Video | Album] = []
if isinstance(media_list, Mix):
result = media_list.items()
else:
+ func_get_items_media: [Callable] = []
+
if isinstance(media_list, Playlist | Album):
if videos_include:
- func_get_items_media: Callable = media_list.items
+ func_get_items_media.append(media_list.items)
else:
- func_get_items_media: Callable = media_list.tracks
+ func_get_items_media.append(media_list.tracks)
else:
- func_get_items_media: Callable = media_list.get_albums
+ func_get_items_media.append(media_list.get_albums)
+ func_get_items_media.append(media_list.get_albums_ep_singles)
- while not done:
- tmp_result: [Track | Video] = func_get_items_media(limit=limit, offset=offset)
+ for func_media in func_get_items_media:
+ limit: int = 100
+ offset: int = 0
+ done: bool = False
- if bool(tmp_result):
- result += tmp_result
- # Get the next page in the next iteration.
- offset += limit
- else:
- done = True
+ while not done:
+ tmp_result: [Track | Video | Album] = func_media(limit=limit, offset=offset)
+
+ if bool(tmp_result):
+ result += tmp_result
+ # Get the next page in the next iteration.
+ offset += limit
+ else:
+ done = True
return result