music-assistant-server

Branch:dev-lidarr-plugin

Commit Details

Fix index_in_buffer or current_index treating index 0 as unset (#3160)

index_in_buffer and current_index are int | None where 0 is a valid
value (first track in queue). Two locations use chained `or` to
select between them:

- set_shuffle: `queue.index_in_buffer or queue.current_index`
- play_media_from_queue: `queue.index_in_buffer or queue.current_index or 0`

When index_in_buffer is 0 (first track buffered), Python's `or`
treats it as falsy and falls through to current_index. This causes
shuffle reshuffling and queue insertion to use the wrong position.

Replace with explicit `is not None` checks in both locations.

Co-authored-by: David Bishop <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Forgejo

Author

David Bishop<[email protected]>
February 16, 2026 at 09:08 AM UTC

Committer

February 16, 2026 at 09:08 AM UTC
8additions
2deletions
1file changed

Parent commits

Changes

1 file
+8-2

Changed Files (1)

music_assistant/controllers/
music_assistant/controllers/player_queues.py
+8-2