temp fix on recently played query to avoid too many queries
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Tue, 7 Jan 2025 23:20:57 +0000 (00:20 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Tue, 7 Jan 2025 23:20:57 +0000 (00:20 +0100)
music_assistant/controllers/music.py

index 65a106c24bb5e7569147535b409bcd086ddf36cf..1a5f6ec72ab5900f1eef59b1f6f6160e9b5fc4c5 100644 (file)
@@ -463,9 +463,11 @@ class MusicController(CoreController):
         if media_types is None:
             media_types = MediaType.ALL
         media_types_str = "(" + ",".join(f'"{x}"' for x in media_types) + ")"
+        # temporary fix to avoid too many queries on providers:
+        # we only query for library items for now
         query = (
-            f"SELECT * FROM {DB_TABLE_PLAYLOG} WHERE media_type "
-            f"in {media_types_str} ORDER BY timestamp DESC"
+            f"SELECT * FROM {DB_TABLE_PLAYLOG} WHERE provider = 'library' "
+            f"AND media_type in {media_types_str} ORDER BY timestamp DESC"
         )
         db_rows = await self.mass.music.database.get_rows_from_query(query, limit=limit)
         result: list[MediaItemType] = []