summaryrefslogtreecommitdiff
path: root/tidal_dl_ng/helper
diff options
context:
space:
mode:
authorRobert Honz <exislow+github@gmail.com>2024-01-18 22:14:46 +0100
committerRobert Honz <exislow+github@gmail.com>2024-01-18 22:14:46 +0100
commit12362983d6c3f1d49b7112d408b547c2dcca75ef (patch)
tree5c977c03a18c7eca5bd7bcffb79871e97580f1bb /tidal_dl_ng/helper
parent922b3d265519e38e465b869379a0accfa16431c5 (diff)
downloadtidal-dl-ng-12362983d6c3f1d49b7112d408b547c2dcca75ef.tar.gz
✨ Result pagination implement for Downloader.
Diffstat (limited to 'tidal_dl_ng/helper')
-rw-r--r--tidal_dl_ng/helper/tidal.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tidal_dl_ng/helper/tidal.py b/tidal_dl_ng/helper/tidal.py
index 1a1fcc1..60f636d 100644
--- a/tidal_dl_ng/helper/tidal.py
+++ b/tidal_dl_ng/helper/tidal.py
@@ -44,7 +44,7 @@ def get_tidal_media_type(url_media: str) -> MediaType | bool:
return result
-def search_all_results(session: Session, needle: str, types_media: SearchTypes = None) -> dict[str, [SearchTypes]]:
+def search_results_all(session: Session, needle: str, types_media: SearchTypes = None) -> dict[str, [SearchTypes]]:
limit: int = 300
offset: int = 0
done: bool = False
@@ -72,7 +72,7 @@ def search_all_results(session: Session, needle: str, types_media: SearchTypes =
return result
-def items_all_results(media_list: [Mix | Playlist | Album]) -> [Track | Video]:
+def items_results_all(media_list: [Mix | Playlist | Album], videos_include: bool = True) -> [Track | Video]:
limit: int = 100
offset: int = 0
done: bool = False
@@ -82,7 +82,11 @@ def items_all_results(media_list: [Mix | Playlist | Album]) -> [Track | Video]:
result = media_list.items()
else:
while not done:
- tmp_result: [Track | Video] = media_list.items(limit=limit, offset=offset)
+ tmp_result: [Track | Video] = (
+ media_list.items(limit=limit, offset=offset)
+ if videos_include
+ else media_list.tracks(limit=limit, offset=offset)
+ )
if bool(tmp_result):
result += tmp_result