ARD Audiothek: Introduce filter of not published episodes to reduce loading times...
authorJan Feil <11638228+jfeil@users.noreply.github.com>
Fri, 3 Oct 2025 20:39:04 +0000 (22:39 +0200)
committerGitHub <noreply@github.com>
Fri, 3 Oct 2025 20:39:04 +0000 (22:39 +0200)
music_assistant/providers/ard_audiothek/__init__.py
music_assistant/providers/ard_audiothek/database_queries.py

index 66c5f1cf9a5da9a94b7a4627403786d47bfcb88f..8d706445cf68f45c507b55d0f224d5055e27ec01 100644 (file)
@@ -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"]):
index 904872d35914507e26f98ba524b0e942b00f9399..a4147e0087624b0ded222df10723e1a04f7b962d 100644 (file)
@@ -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