✨ List EPs and singles while expanding artists in result pane.

This commit is contained in:
Robert Honz
2024-03-23 12:29:14 +01:00
parent 54d042a2e9
commit 84c8036bdd
+19 -14
View File
@@ -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]: 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] = [] result: [Track | Video | Album] = []
if isinstance(media_list, Mix): if isinstance(media_list, Mix):
result = media_list.items() result = media_list.items()
else: else:
func_get_items_media: [Callable] = []
if isinstance(media_list, Playlist | Album): if isinstance(media_list, Playlist | Album):
if videos_include: if videos_include:
func_get_items_media: Callable = media_list.items func_get_items_media.append(media_list.items)
else: else:
func_get_items_media: Callable = media_list.tracks func_get_items_media.append(media_list.tracks)
else: 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: for func_media in func_get_items_media:
tmp_result: [Track | Video] = func_get_items_media(limit=limit, offset=offset) limit: int = 100
offset: int = 0
done: bool = False
if bool(tmp_result): while not done:
result += tmp_result tmp_result: [Track | Video | Album] = func_media(limit=limit, offset=offset)
# Get the next page in the next iteration.
offset += limit if bool(tmp_result):
else: result += tmp_result
done = True # Get the next page in the next iteration.
offset += limit
else:
done = True
return result return result