Skip to content

Conversation

@anatosun
Copy link
Contributor

@anatosun anatosun commented Nov 7, 2025

Plex Connect: new plugin for Plex discovery and control

This PR introduces Plex Connect, a new standalone plugin that enables Music Assistant players to be discovered and controlled by Plex clients like Plexamp when using Plex as a music source.

Functionalities

Plex Connect acts as a bridge between your Plex server and Music Assistant players, allowing Plex clients like Plexamp to discover and control your MA players. This plugin requires the Plex music provider to be configured as it works specifically with Plex music sources.

Music Assistant players visible in Plexamp

How It Works

Setup:

  • Enable Plex Connect plugin in Music Assistant
  • Configure the plugin for each player you want to control via Plex clients

Discovery & Connection:

  • Plugin creates a dedicated remote control server for each enabled player
  • Players are automatically advertised on the local network via GDM (Good Day Mate) broadcasts
  • Plex clients (like Plexamp) discover these players as native Plex players - no manual configuration needed

Control & Features:

  • Control your Music Assistant players directly from any Plex client
  • Standard playback controls: play, pause, skip, seek
  • Queue management: add tracks, reorder, clear queue
  • Access Plex advanced features: Sonic Adventures, Radio, DJs, Mixes

Synchronization:

  • Real-time state synchronization using Plex's timeline and navigation protocols
  • Playback state, current track, progress, and queue stay synchronized
  • All playback activity reported to your Plex server
  • Listening history and scrobbles visible in Plex dashboard
  • Enables "Continue Listening" and other Plex features

Comments

  • The timeline report to the Plex server is now done on a per-player basis, the logic has been moved to player_remote.py.
  • This feature, although tested extensively before the PR, needs testing by other fellow users!

Copilot AI review requested due to automatic review settings November 7, 2025 17:43
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 PR adds Plex remote control functionality to Music Assistant, enabling Plex clients (like Plexamp) to discover and control Music Assistant players. The implementation includes GDM (Good Day Mate) discovery protocol support, HTTP endpoints for playback control, and player state synchronization between Plex and Music Assistant.

Key Changes:

  • Implements per-player remote control instances with unique client IDs
  • Adds GDM broadcasting for player discovery by Plex clients
  • Provides HTTP API endpoints for playback control, timeline updates, and play queue management

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
music_assistant/providers/plex/player_remote.py Core implementation of player manager, remote control instances, and HTTP server for handling Plex commands
music_assistant/providers/plex/gdm.py GDM advertiser implementation for player discovery via UDP broadcasts
music_assistant/providers/plex/helpers.py Added utility function to determine local IP address
music_assistant/providers/plex/init.py Integration of PlexPlayerManager with configuration entries for remote control
Comments suppressed due to low confidence (1)

music_assistant/providers/plex/gdm.py:215

  • Variable bytes_sent is not used.
            bytes_sent = self._broadcast_socket.sendto(

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

@anatosun anatosun force-pushed the feature/plex-remote-control branch from e531ec6 to f13cd1b Compare November 8, 2025 07:40
Copilot AI review requested due to automatic review settings November 8, 2025 07:41
@anatosun anatosun force-pushed the feature/plex-remote-control branch from f13cd1b to 26c6d4a Compare November 8, 2025 07:41
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 4 out of 4 changed files in this pull request and generated 8 comments.


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

Comment on lines 326 to 253
self._unsub_callbacks.append(
self.provider.mass.subscribe(self._handle_queue_event, EventType.QUEUE_UPDATED)
)
self._unsub_callbacks.append(
self.provider.mass.subscribe(self._handle_queue_event, EventType.QUEUE_TIME_UPDATED)
)
Copy link
Member

Choose a reason for hiding this comment

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

you can just subscribe to player_updated nowadays. we have updated the player model and player.current_media will now always contain the translated metadata from any source

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it still possible to subscribe to separate events?

@marcelveldt
Copy link
Member

As stated in the comments, my first feeling is that this is a separate, dedicated plugin provider and has little to do with the Plex music provider. It would be good to clarify exactly what this does and who can use it. Like for example, will this work regardless if you are an actual plex user ?

@anatosun
Copy link
Contributor Author

anatosun commented Nov 9, 2025

First let met thank you for reviewing the PR.

I understand your concern, my main motivation for making it part of the plex provider was to avoid duplicating Plex credentials.

Looking at the amount of code this PR adds, I can agree that this should become its own separate plugin.

My question now is, could the Plex Connect Plugin use the Plex provider directly?

@anatosun
Copy link
Contributor Author

@marcelveldt
I have refactored this functionality into its own separate plugin. Should I proceed by modifying the existing PR or doing a new one? I plan to move the playback report to the plugin, as it allows Plex to be aware of Music assistant players...

@marcelveldt
Copy link
Member

Does the plugin work without a Plex server? Does it just mimic a Plex server so you can allow any MA player with any MA music source?
Then it's simply a standalone plugin.

If it still relies on a Plex server, then you can can choose either between including it in the Plex music provider (while keeping the code maintainable) or isolate it into its own plugin. You can even add a "depends_on" in the manifest of the plugin to make it depend on Plex music provider.

@marcelveldt
Copy link
Member

@marcelveldt

I have refactored this functionality into its own separate plugin. Should I proceed by modifying the existing PR or doing a new one? I plan to move the playback report to the plugin, as it allows Plex to be aware of Music assistant players...

I have no preference. That is completely up to you

@anatosun anatosun requested a review from Copilot November 11, 2025 14:23
Copilot finished reviewing on behalf of anatosun November 11, 2025 14:24
@anatosun anatosun force-pushed the feature/plex-remote-control branch from d61780e to 79d924c Compare November 11, 2025 14:25
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 5 out of 6 changed files in this pull request and generated 5 comments.


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

Copilot finished reviewing on behalf of anatosun November 11, 2025 14:44
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 5 out of 6 changed files in this pull request and generated 17 comments.


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

"codeowners": ["@anatosun"],
"requirements": ["plexapi==4.17.1"],
"icon": "mdi:plex",
"documentation": "https://music-assistant.io/plugin-support/plex_connect/",
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

The documentation URL https://music-assistant.io/plugin-support/plex_connect/ is specified but this is a new plugin. Ensure that this documentation page exists or will be created before users encounter this plugin, otherwise users will face broken links when trying to learn about the plugin.

Suggested change
"documentation": "https://music-assistant.io/plugin-support/plex_connect/",

Copilot uses AI. Check for mistakes.
@anatosun
Copy link
Contributor Author

... and the documentation

@anatosun anatosun requested a review from marcelveldt November 14, 2025 07:57
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.

3 participants