Skip to content

fix(plex_connect): refactor shuffle to be more consistent#2985

Draft
LeMyst wants to merge 1 commit intomusic-assistant:devfrom
LeMyst:feat/refactor-shuffle
Draft

fix(plex_connect): refactor shuffle to be more consistent#2985
LeMyst wants to merge 1 commit intomusic-assistant:devfrom
LeMyst:feat/refactor-shuffle

Conversation

@LeMyst
Copy link

@LeMyst LeMyst commented Jan 16, 2026

This pull request refactors how shuffle and seek options are handled when playing media through the Plex Connect player remote integration. The main goal is to ensure shuffle and seek are consistently applied to playback, while preventing redundant shuffling when Plex has already handled it server-side.

Playback option handling improvements:

  • Shuffle and seek are now applied immediately after playback starts for fallback, regular container, and single item scenarios in handle_play_media, ensuring consistent behavior across all playback types. [1] [2] [3]

Prevention of redundant shuffle:

  • In both fetch_queue and create_queue, shuffle is explicitly disabled (set_shuffle(player_id, False)) when the PlayQueue is already ordered or shuffled by Plex, avoiding double randomization of the queue. [1] [2]

Copilot AI review requested due to automatic review settings January 16, 2026 20:59
@LeMyst LeMyst changed the title Plex connect: Refactor shuffle fix(plex_conenct): refactor shuffle to be more consistent Jan 16, 2026
@LeMyst LeMyst changed the title fix(plex_conenct): refactor shuffle to be more consistent fix(plex_connect): refactor shuffle to be more consistent Jan 16, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors shuffle and seek option handling in the Plex Connect player integration to ensure consistent application across different playback scenarios and prevent redundant shuffling when Plex has already managed it server-side.

Changes:

  • Adds shuffle and seek application immediately after playback starts for fallback, regular container, and single item scenarios
  • Explicitly disables shuffle in fetch_queue and create_queue methods when PlayQueues are already ordered/shuffled by Plex server

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@LeMyst LeMyst force-pushed the feat/refactor-shuffle branch from b75f16d to 452a433 Compare January 16, 2026 21:42
@OzGav
Copy link
Contributor

OzGav commented Jan 16, 2026

@anatosun

@anatosun
Copy link
Contributor

Hello @LeMyst , it looks good. However, I have a bunch of manual tests I usually run to see if everything works. Let me come back to you in a few days with the result of my tests.

@MarvinSchenkel
Copy link
Contributor

Hello @LeMyst , it looks good. However, I have a bunch of manual tests I usually run to see if everything works. Let me come back to you in a few days with the result of my tests.

If possible, we could maybe add those tests as unit tests in another PR?

@OzGav
Copy link
Contributor

OzGav commented Jan 31, 2026

Also lint, mypy and conflicts to be resolved. Marking as draft until this is ready.

@OzGav OzGav marked this pull request as draft January 31, 2026 01:49
@anatosun
Copy link
Contributor

My tests are difficult to integrate in unit tests I'm afraid. I usually start playback and try multiple corner cases. Once I have time I will document those tests for others!

All seems well for this PR on my side @LeMyst !

@MarvinSchenkel
Copy link
Contributor

My tests are difficult to integrate in unit tests I'm afraid. I usually start playback and try multiple corner cases. Once I have time I will document those tests for others!

All seems well for this PR on my side @LeMyst !

Thanks for the sanity check. @LeMyst , if you could fix the tests, mark this as 'ready for review' then this should be food to merge :)

Shuffle and seek operations are now consistently applied after playback for fallback, regular containers, and single items. Shuffle is explicitly disabled when Plex has already handled queue ordering/shuffling server-side to prevent double randomization.
@LeMyst LeMyst force-pushed the feat/refactor-shuffle branch from 452a433 to 5d8fc43 Compare February 1, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants