From 2957213fd5f5ec92e17e88a43ec2e054bf5fec4b Mon Sep 17 00:00:00 2001 From: Fabian Munkes <105975993+fmunkes@users.noreply.github.com> Date: Mon, 16 Feb 2026 19:24:01 +0100 Subject: [PATCH] fix: adapt playlog for all users if no user present (#3169) adapt playlog for all users --- music_assistant/controllers/music.py | 29 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/music_assistant/controllers/music.py b/music_assistant/controllers/music.py index 54bf9e6d..fb1fa543 100644 --- a/music_assistant/controllers/music.py +++ b/music_assistant/controllers/music.py @@ -1185,17 +1185,20 @@ class MusicController(CoreController): # based on configured provider filter we can try to find a user user = provider_user - if user: - # NOTE: if no user was found, we will alter the playlog for all users - params["userid"] = user.user_id - # update generic playlog table (when not playing) if not is_playing: - await self.database.insert( - DB_TABLE_PLAYLOG, - params, - allow_replace=True, - ) + if user: + user_ids = [user.user_id] + else: + # NOTE: if no user was found, we will alter the playlog for all users + user_ids = [user.user_id for user in await self.mass.webserver.auth.list_users()] + for user_id in user_ids: + params["userid"] = user_id + await self.database.insert( + DB_TABLE_PLAYLOG, + params, + allow_replace=True, + ) # forward to provider(s) to sync resume state (e.g. for audiobooks) for prov_mapping in media_item.provider_mappings: @@ -1262,10 +1265,14 @@ class MusicController(CoreController): user = provider_user if user: + user_ids = [user.user_id] + else: # NOTE: if no user was found, we will alter the playlog for all users - params["userid"] = user.user_id + user_ids = [user.user_id for user in await self.mass.webserver.auth.list_users()] + for user_id in user_ids: + params["userid"] = user_id + await self.database.delete(DB_TABLE_PLAYLOG, params) - await self.database.delete(DB_TABLE_PLAYLOG, params) # forward to provider(s) to sync resume state (e.g. for audiobooks) for prov_mapping in media_item.provider_mappings: if ( -- 2.34.1