if media_types is None:
media_types = MediaType.ALL
media_types_str = "(" + ",".join(f'"{x}"' for x in media_types) + ")"
+ available_providers = ("library", *get_global_cache_value("unique_providers", []))
+ available_providers_str = "(" + ",".join(f'"{x}"' for x in available_providers) + ")"
query = (
f"SELECT * FROM {DB_TABLE_PLAYLOG} "
f"WHERE media_type in {media_types_str} AND fully_played = 1 "
+ f"AND provider in {available_providers_str} "
"ORDER BY timestamp DESC"
)
db_rows = await self.mass.music.database.get_rows_from_query(query, limit=limit)
@api_command("music/in_progress_items")
async def in_progress_items(self, limit: int = 10) -> list[ItemMapping]:
"""Return a list of the Audiobooks and PodcastEpisodes that are in progress."""
+ available_providers = ("library", *get_global_cache_value("unique_providers", []))
+ available_providers_str = "(" + ",".join(f'"{x}"' for x in available_providers) + ")"
query = (
f"SELECT * FROM {DB_TABLE_PLAYLOG} "
f"WHERE media_type in ('audiobook', 'podcast_episode') AND fully_played = 0 "
+ f"AND provider in {available_providers_str} "
"AND seconds_played > 0 "
"ORDER BY timestamp DESC"
)
db_rows = await self.mass.music.database.get_rows_from_query(query, limit=limit)
result: list[ItemMapping] = []
- available_providers = ("library", *get_global_cache_value("unique_providers", []))
for db_row in db_rows:
result.append(
ItemMapping.from_dict(