Repository navigation
Allow moving the buffered next track on Sendspin players - #8084
Conversation
|
@Bot-MArley review |
Bot-MArley
left a comment
There was a problem hiding this comment.
Note
This comment was written by Claude and posted by Bot-MArley on behalf of the Music Assistant maintainers.
Thanks @maximmaxim345! This lets Sendspin players swap a next track they already received, so "Play next", move, delete and shuffle also change the next track until about 5 seconds before it starts. I read the whole diff on top of the base branch and found nothing that needs changing before merge.
Requested changes: none. The lock timer, the crossfade hand-off and the committed_index change all hold up, and every caller of committed_index still behaves as intended.
One heads-up: the description says the frontend reads next_item_replaceable, but I couldn't find a frontend change or companion PR for it. Until that lands, moving or deleting the buffered next track from the web UI stays blocked as before. The PR is still a draft, so it's waiting on you to mark it ready.
46f63e4 to
32d148c
Compare
32d148c to
eee48c7
Compare
7d607ba to
60773c4
Compare
|
@Bot-MArley review again |
Bot-MArley
left a comment
There was a problem hiding this comment.
Note
This comment was written by Claude and posted by Bot-MArley on behalf of the Music Assistant maintainers.
Thanks @maximmaxim345! This lets Sendspin players swap the next track they already received, so "Play next", move, delete and shuffle change it until about 5 seconds before it starts, and the queue publishes last_locked_index for the frontend (frontend#3326). I read the whole diff again on top of feat/sendspin-replace-sent-next-track. The lock timer, the crossfade hand-off through fading_into and the new committed_index all hold up, every caller now goes through the controller, and _play_index now resets the replaceable flag on a fresh load.
Requested changes: none, it looks good to me. It changes core queue and stream code as well as the Sendspin provider, so I don't approve it on my own. If you're a server admin, comment @Bot-MArley approve and I will. Otherwise it needs another maintainer's approval.
60773c4 to
bb9687a
Compare
Bot-MArley
left a comment
There was a problem hiding this comment.
Note
This comment was written by Claude and posted by Bot-MArley on behalf of the Music Assistant maintainers.
Thanks @maximmaxim345! This lets Sendspin players that can replace an already-sent next track keep it free to move: "Play next", move, delete and shuffle change it up to 5 seconds before it starts, and the queue publishes last_locked_index. This covers the changes since the last review (review).
I went through the whole diff against the #8083 branch and didn't find anything that needs to change before merge. Every caller of the old lock helper was moved over, and for players other than Sendspin the lock behaves as before.
It's stacked on #8083, so that one has to land first. It also changes core queue code, so another maintainer approves it, and a maintainer decides whether the sendspin-cli test counts as testing on a real device.
# What does this implement/fix? <!-- Quick description and explanation of changes. --> Stacked on #8084. Clients get the locked part of the queue as one queue field, `last_locked_index`, instead of an `extra_attributes` key next to `index_in_buffer`. That one value tells every client which items it may move or remove, so none of them has to combine it with `index_in_buffer` or repeat a server rule. ## Changes - The queue publishes the lock as `PlayerQueue.last_locked_index` (music-assistant/models#495). - The buffered next track counts as replaceable only while a track follows it. The lock covers the "last track can't be deleted" rule itself, so `delete_item` needs no special case. "Play next" while the next track is the last one lands after it. - The MCP queue tools follow the same lock. - API schema version 128, models 1.1.254. **Related issue (if applicable):** - stacked on #8084 - models music-assistant/models#495 - frontend music-assistant/frontend#3360 (stacked on music-assistant/frontend#3326) ## Types of changes <!-- Tick exactly one box. CI (.github/workflows/pr-labels.yaml) derives the label from the ticked box and applies it automatically; the release-notes generator uses that same label to slot this change into the next release notes. --> - [ ] Bugfix (non-breaking change which fixes an issue) — `bugfix` - [ ] New feature (non-breaking change which adds functionality) — `new-feature` - [ ] Enhancement to an existing feature — `enhancement` - [ ] New music/player/metadata/plugin provider — `new-provider` - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) — `breaking-change` - [ ] Refactor (no behaviour change) — `refactor` - [ ] Documentation only — `documentation` - [x] Maintenance / chore — `maintenance` - [ ] CI / workflow change — `ci` - [ ] Dependencies bump — `dependencies` ## Checklist - [x] The code change is tested and works locally. - [x] `pre-commit run --all-files` passes. - [x] `pytest` passes, and tests have been added/updated under `tests/` where applicable. - [x] For changes to shared models, the companion PR in `music-assistant/models` is linked. - [x] For changes affecting the UI, the companion PR in `music-assistant/frontend` is linked. - [x] I have read and complied with the project's [AI Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md) for any AI-assisted contributions. - [ ] I have [raised a PR against the documentation repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md) targeting the main or beta branch as appropriate.
|
@maximmaxim345 merged #8246 into your branch (and frontend#3360 into #3326): the lock is now the |
|
lab gate |
Bot-MArley
left a comment
There was a problem hiding this comment.
Note
This comment was written by Claude and posted by Bot-MArley on behalf of the Music Assistant maintainers.
Thanks @maximmaxim345! This covers the changes since the last review: the lock is now published as the PlayerQueue.last_locked_index field (models 1.1.254, pin and API_SCHEMA_VERSION bumped), the last-track rule lives in committed_index, and a buffered last track stays locked. I found no problems in the new commits, and the move, delete, play-next and shuffle paths all use the same boundary now.
No changes requested. The description still says the index goes into extra_attributes, so it's worth updating it and ticking the models item. The hardware test still names only sendspin-cli and scripts, so a maintainer decides whether that is enough; the PR is also stacked on #8083.
…ol-simplify # Conflicts: # music_assistant/constants.py # music_assistant/controllers/player_queues/controller.py # music_assistant/controllers/player_queues/queue_loader.py # music_assistant/models/player_protocol.py # pyproject.toml # requirements_all.txt
|
@Bot-MArley review again |
Bot-MArley
left a comment
There was a problem hiding this comment.
Note
This comment was written by Claude and posted by Bot-MArley on behalf of the Music Assistant maintainers.
Thanks @maximmaxim345! This lets Sendspin players swap a next track they already received, so "Play next", move, delete and shuffle can change it up to 5 seconds before it starts. The queue publishes the locked range as PlayerQueue.last_locked_index. I read the whole diff again on top of the latest dev, where #8083 has now landed. The lock timer, the crossfade hand-off, the last-track rule in committed_index and every caller of the boundary (queue loader, smart shuffle, party, plex_connect, ai_radio, MCP tools) all hold up. The API_SCHEMA_VERSION bump to 128 matches the new field.
Requested changes: none, it looks good to me. The earlier note about the description is fixed too.
It changes core queue and stream code and touches more than the Sendspin provider, so I don't approve it on my own. If you're a server admin, comment @Bot-MArley approve and I will. Otherwise it needs another maintainer's approval.
marcelveldt
left a comment
There was a problem hiding this comment.
LGTM, thanks @maximmaxim345!
What does this implement/fix?
Sendspin players can now drop a next track they already received and play another one in its place. "Play next", moving, deleting and shuffling then also change the next track on them, up to 5 seconds before it starts. Unless a crossfade into the old next track was already prepared, the switch happens inside the running stream without a gap or restart.
Players opt in with the new
replaces_enqueued_mediaproperty onPlayerProtocol. Sendspin sets it while "Allow legacy clients" is off and every group member supports the cut, so groups with a bridged Squeezelite or Cast speaker keep the existing lock. The queue publishes the last queue index the player holds as thePlayerQueue.last_locked_indexfield, and the frontend locks the queue up to that index instead of up to the buffered track. A buffered track stays locked while no playable track follows it, since the player can only replace it with one that does.Tested with
sendspin-cli1.0.1 (sendspin-cpp v0.10.0) and Python scripts built on the aiosendspin client: "Play next", move, delete and shuffle near the end of a track all switched to the new next track without a gap.Related issue (if applicable):
Types of changes
bugfixnew-featureenhancementnew-providerbreaking-changerefactordocumentationmaintenancecidependenciesChecklist
pre-commit run --all-filespasses.pytestpasses, and tests have been added/updated undertests/where applicable.music-assistant/modelsis linked.music-assistant/frontendis linked.