From: Jan Feil <11638228+jfeil@users.noreply.github.com> Date: Fri, 3 Oct 2025 20:39:04 +0000 (+0200) Subject: ARD Audiothek: Introduce filter of not published episodes to reduce loading times... X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=3cbb7c9f7bee08251d840f749d957762517ba81f;p=music-assistant-server.git ARD Audiothek: Introduce filter of not published episodes to reduce loading times (#2478) --- diff --git a/music_assistant/providers/ard_audiothek/__init__.py b/music_assistant/providers/ard_audiothek/__init__.py index 66c5f1cf..8d706445 100644 --- a/music_assistant/providers/ard_audiothek/__init__.py +++ b/music_assistant/providers/ard_audiothek/__init__.py @@ -487,8 +487,12 @@ class ARDAudiothek(MusicProvider): ) -> AsyncGenerator[PodcastEpisode, None]: """Get podcast episodes.""" await self._update_progress() + depublished_filter = {"isPublished": {"equalTo": True}} async with await self.get_client() as session: - show_length_query.variable_values = {"showId": prov_podcast_id} + show_length_query.variable_values = { + "showId": prov_podcast_id, + "filter": depublished_filter, + } length = await session.execute(show_length_query) length = length["show"]["items"]["totalCount"] step_size = 128 @@ -497,6 +501,7 @@ class ARDAudiothek(MusicProvider): "showId": prov_podcast_id, "first": step_size, "offset": offset, + "filter": depublished_filter, } result = (await session.execute(show_query))["show"] for idx, episode in enumerate(result["items"]["nodes"]): diff --git a/music_assistant/providers/ard_audiothek/database_queries.py b/music_assistant/providers/ard_audiothek/database_queries.py index 904872d3..a4147e00 100644 --- a/music_assistant/providers/ard_audiothek/database_queries.py +++ b/music_assistant/providers/ard_audiothek/database_queries.py @@ -140,9 +140,9 @@ query Livestream($coreId: String!) { show_length_query = gql(""" -query Show($showId: ID!) { +query Show($showId: ID!, $filter: ItemFilter) { show(id: $showId) { - items { + items(filter: $filter) { totalCount } } @@ -152,13 +152,12 @@ query Show($showId: ID!) { show_query = gql( """ -query Show($showId: ID!, $first: Int, $offset: Int) { +query Show($showId: ID!, $first: Int, $offset: Int, $filter: ItemFilter) { show(id: $showId) { synopsis title showType - items(first: $first, offset: $offset) { - totalCount + items(first: $first, offset: $offset, filter: $filter) { nodes { duration title