Issue
When using MediaSage's play_queue API with mode="play_next", the requested track is successfully added to the Plex PlayQueue, but it is not reliably inserted immediately after the currently playing track in Plexamp.
Environment
MediaSage
Plex Server
Plexamp
PlexAPI 4.18.0
Python 3.12
Linux
Expected behavior
Given:
Currently playing
Existing Up Next #1
Existing Up Next #2
calling:
play_queue(..., mode="play_next")
should result in:
Currently playing
New track
Existing Up Next #1
Existing Up Next #2
Actual behavior
PlayQueue.addItem(track, playNext=True) reports success and the track is present in the server-side queue, but Plexamp does not consistently show it as the next track.
Working fix
I was able to resolve this by explicitly moving the newly added PlayQueue item after the currently selected item:
existing_queue.addItem(track, playNext=True, refresh=False)
existing_queue.moveItem(
new_queue_item,
after=current_queue_item,
refresh=True,
)
I also found that explicitly refreshing the Plexamp music queue after the change was required:
target_client.refreshPlayQueue(
play_queue_id,
mtype="music",
)
With these changes, the new track appears correctly as the first Up Next item in Plexamp.
Question
Would it make sense to incorporate this explicit moveItem(..., after=current_queue_item) and client queue refresh into MediaSage's play_next implementation to guarantee the expected ordering?
Issue
When using MediaSage's play_queue API with mode="play_next", the requested track is successfully added to the Plex PlayQueue, but it is not reliably inserted immediately after the currently playing track in Plexamp.
Environment
MediaSage
Plex Server
Plexamp
PlexAPI 4.18.0
Python 3.12
Linux
Expected behavior
Given:
Currently playing
Existing Up Next #1
Existing Up Next #2
calling:
play_queue(..., mode="play_next")
should result in:
Currently playing
New track
Existing Up Next #1
Existing Up Next #2
Actual behavior
PlayQueue.addItem(track, playNext=True) reports success and the track is present in the server-side queue, but Plexamp does not consistently show it as the next track.
Working fix
I was able to resolve this by explicitly moving the newly added PlayQueue item after the currently selected item:
existing_queue.addItem(track, playNext=True, refresh=False)
existing_queue.moveItem(
new_queue_item,
after=current_queue_item,
refresh=True,
)
I also found that explicitly refreshing the Plexamp music queue after the change was required:
target_client.refreshPlayQueue(
play_queue_id,
mtype="music",
)
With these changes, the new track appears correctly as the first Up Next item in Plexamp.
Question
Would it make sense to incorporate this explicit moveItem(..., after=current_queue_item) and client queue refresh into MediaSage's play_next implementation to guarantee the expected ordering?