Set PlayerQueue.is_dynamic when radio_source changes#3886
Draft
dmoo500 wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the server to keep the new PlayerQueue.is_dynamic field in sync with queue.radio_source, allowing clients to read whether the queue is driven by a single dynamic playlist directly from the queue state.
Changes:
- Add
PlayerQueuesController._calc_is_dynamic()to detect whenradio_sourceis exactly one dynamicPlaylist. - Set/clear
queue.is_dynamicalongsidequeue.radio_sourceupdates throughoutplayer_queues.py. - Ensure the Yandex Music provider sets
queue.is_dynamic = Falsewhen it assigns a track asradio_source.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
music_assistant/controllers/player_queues.py |
Adds _calc_is_dynamic and updates radio_source mutation points to maintain queue.is_dynamic. |
music_assistant/providers/yandex_music/provider.py |
Explicitly sets queue.is_dynamic = False when assigning a Track as the queue’s radio_source. |
dfe9540 to
e02acb8
Compare
e02acb8 to
7be55f9
Compare
Contributor
Author
|
Converting to draft — the mypy lint failure is expected: this PR depends on music-assistant/models#224 which adds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sets the new
is_dynamicfield onPlayerQueue(added in music-assistant/models#224) wheneverradio_sourceis updated, so clients can read it directly.Changes
PlayerQueuesController._calc_is_dynamic(): static helper that checks ifradio_sourceis a single dynamic playlistqueue.is_dynamicat all 5radio_sourceassignment points inplayer_queues.pysignal_updateis called after all field mutations so clients receive a consistent state in one eventWhy
is_dynamiclives on the model (not computed client-side)PlayerQueueuses mashumaro'sDataClassDictMixin. A@propertyis silently skipped byto_dict()/to_cache()— only dataclass fields are serialized. Clients and the restore path would always see the default value. A plainbool = Falsefield is the correct approach: it is serialized like any other field and kept in sync by the server.Dependencies
Requires music-assistant/models#224 to be merged and released first. PR is in draft until then.
Related