Skip to content

Add is_dynamic field to PlayerQueue#224

Open
dmoo500 wants to merge 1 commit into
music-assistant:mainfrom
dmoo500:feature/player-queue-is-dynamic
Open

Add is_dynamic field to PlayerQueue#224
dmoo500 wants to merge 1 commit into
music-assistant:mainfrom
dmoo500:feature/player-queue-is-dynamic

Conversation

@dmoo500
Copy link
Copy Markdown
Contributor

@dmoo500 dmoo500 commented May 13, 2026

Summary

Adds an is_dynamic field to PlayerQueue so all clients can check directly whether a dynamic playlist is the active radio source, without having to inspect radio_source manually.

Background

Previously, clients had to implement the detection logic themselves:

len(queue.radio_source) == 1
and isinstance(queue.radio_source[0], Playlist)
and queue.radio_source[0].is_dynamic

This was duplicated in the web frontend and would need to be reimplemented in every client (mobile app, etc.).

Change

Adds is_dynamic: bool = False as a serialized field on PlayerQueue. The server sets this field whenever radio_source changes.

Why a stored field instead of @property: PlayerQueue uses mashumaro's DataClassDictMixin. Its to_dict() / to_cache() serialization only processes dataclass fields — @property accessors are silently skipped and would never reach the wire or the cache, so clients would always see the default value. Verified with a minimal test against the installed mashumaro version.

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant