Plex and PlexAmp plugin

Interesting - so I think possible the problem is to with the network library I am using which I believe doesn’t support IPv6 - so another user / developer shared some fixes which use a different implementation. I will see can I push that change out ASAP as it might be as simple as that.

Separately I have been looking at reimplementing the whole connecting to Plex and even the PlexAmp side of this codebase but that has taken way longer than my spare time will allow, but hopefully soon. So first thing if I will try and package up the changes that “thaining” shared which might fix these network connectivity related issues.

Hi dmonds,

It took me a while to determine a potential reason why your failure is occurring because you are running a version of the plugin code that is 9+ months old at this point. As @Jerome_O_Flaherty points out, the problem seems to occur here:

Aug 25 16:28:14 dens-pi4 volumio[976]: info: plexamp/artists
Aug 25 16:29:44 dens-pi4 volumio[976]: info: PlexAmp::connect ETIMEDOUT 192.168.1.20:32734
Aug 25 16:30:25 dens-pi4 volumio[976]: info: PlexAmp::connect ETIMEDOUT 192.168.1.20:32734

The port 32734 appears to be the sticking point here. This older code retrieves Plex server definitions using a HTTP call that (for me at least) only returns (my) servers that have Remote Access enabled.

Could you check the server settings for 192.168.1.20 and see if Remote Access enabled for the server at port 32734? Based on why I see in the code and my own interaction with Plex web APIs, that is a likely source of your problem.

Based on the debugging I’ve done, the green bar runs across top and stalls when almost to end of screen and “Server is unreachable” message occur whenever the underlying plugin code has an unhandled error during plugin initialization.

Hi as per a previous post, the default port on my server is 32400.

I was implying that the call from the plugin, which sits on the sam network, was to the wrong port,

You mention I’m using a 9+ mth old version…how do I get a newer version to test? I’ve siply been selecting the plugin available within Volumio.

Cheers

Hi,

Yes, it should be connecting to port 32400 but it isn’t. The way the plugin works in the version of the code you are using is to connect to the URL https://plex.tv/pms/servers. That returns some XML that looks something
like this:

<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer friendlyName="myPlex" identifier="com.plexapp.plugins.myplex" machineIdentifier="cefceee7d089dfe2a59f4627f74be0907d7ac025" size="1">
  <Server accessToken="AbcDEFghij1234" name="ec2-54-68-36-94" address="54.68.36.94" port="32400" version="1.32.1.6999-91e1e2e2c" scheme="http" host="54.68.36.94" localAddresses="172.22.96.222" machineIdentifier="ce06903388fb95898260396abf399b3bd64" createdAt="1684187149" updatedAt="1693345548" owned="1" synced="0"/>
</MediaContainer>

Looking at the server tag, it extracts these fields:

<Server name="ec2-54-68-36-94" address="54.68.36.94" port="32400"/>

This would cause the plugin to try to connect to IP address 54.68.36.94 and port 32400.

The data being returned by the servers URL for your server looks something like this:

<Server name="some-name" address="192.168.1.20" port="32734"/>

I’m just wondering if you have UPNP enabled (port 32764 seems to be associated with UPNP) and Remote Access enabled. That’s causing the servers URL to report your Plex server as accessible on port 32734 of host 192.168.1.20 instead of on its normal base port of 32400.

One of the changes I proposed is to use a different plex.tv URL to determine where Plex servers can be found.

Getting the newest version would involve connecting the host/Raspberry Pi/whatever where Volumio is running via SSH, getting a copy of Jerome’s latest source tree, building the plexamp module, and then updating your downloaded version with the newly built version. (I"m running Volumio 3, and so I don’t see a version of the Plex and Plexamp plugin available for download.)

Is that something you would want to try?

I just checked and can confirm that Remote access is enabled on my Plex Server and is advertising a port of 11614. So where the plugin is getting 32764 is a mystery.

Whilst the plugin does authenticate with my server, I cannot set a library, however at this stage I doubt it would help as it’s not connecting on the correct port.
Perhaps a setting in the plugin to set internal IP and port would be helpful, prior to setting libraries?

I’m running Volumio 3 as well and have 3 versions of the plugin to choose from within the Music Services Section; 1.0.3 (beta), 1.0.1 (beta) and 1.0.0 (beta).

I have never had any issues connecting to my Plex server inside or outside of my network.
Inside I can connect via AppleTV, Phone, iPad, TV, Raspberry Pi and PCs running the Plex Client or via a web browser.

I’m guessing the plugin is primarily aimed at people who wish to connect to Plex servers external to local network, however I do not have this requirement.

Rather than jump in and start downloading/building/updating, you could share location and an example of the plugin config file? I might be able to set one of my libraries there and see if it makes a difference?

Cheers

Thanks guys.
As @Athansor23 mentioned I am using what is probably an old way of finding and integrating with Plex Servers - it worked well for me (with 2 servers and 3 libraries and I presumed it would work for other setups) but obviously not.
But in the last 2-3 weeks I have been playing around with a different Plex API and I believe this updated approach will suit everyone better.
First a bit of background - So I initially implemented this in the ‘nerdiest’ way possible, like other open source Plex code, I just had a configured PlexToken and a Plex local server address and port configured. If you knew how to get these details and configured them it worked well. This mechanism was probably the original way Plex worked and was totally independent of the Plex cloud service so I thought it might appeal to people who wanted to run their personal Plex servers independent of Plex ‘Cloud’. But before releasing the plugin I thought I better make it easier for people to get a Token Token (and the nerdy way to do this is to examine the web UI using developer tools and capture the token in requests so not the most user friendly). At the same time, Plex released the new PlexAmp Raspberry PI image and the initial version of that had a similar stack to Volumio i.e. a Node.JS application, and I figured out a way of adding that plexamp capability could be added to a Volumio instance, so I added that to this plugin, but before I released the plugin the Plex Amp team updated their Node requirements and it become incompatible with Volumio’s Node implementation so I disabled that capability.
But I really think a good Plex plugin should do all these capabilities so that is what I have been independently trying in the last few weeks. Basically, going Plex ‘cloud’ only, queries the list of servers associated with an Plex Account from the cloud and using the Plex cloud API’s to browse your Plex servers and libraries, this codebase also supports the Plex ‘Link’ API which is the key one where Volumio can appear within the PlexAmp app as a destination, so removes the need for a PlexAmp ‘binary’ installed and can take advantage of Volumio superior Audio pipeline etc
So, sorry about not being responsive with plugin changes but I now plan to ripping out my current way of connecting to local Plex servers and adding a Plex link / PlexAmp implementation to this plugin.

1 Like

Sounds cool. Thanks for the update.

That sounds great, @Jerome_O_Flaherty.

Analyzing network topology is a rough configuration task. The designers of Plex simplify the problem for themselves by making activation of the product contingent on contact with Plex.tv during set up. That ensures that Plex.tv has the ability to communicate with all Plex Media Servers at the start.

It would just be great if some kind of company approved API library was available, or a supported spec was published. Reverse engineering REST APIs is usually a recipe for trouble, sooner or later.

I spent some time yesterday looking the un-minified Javascript code in version 4.8.2 of PlexAmp.

A few clues there led me to discover that there now is an updated REST call to a list of all servers and clients know to Plex.tv at http://plex.tv/api/v2/resources. I’ve documented it here:

1 Like

Has this plugin made any more progress? Would be very interested in it being a PlexAmp user.

Not yet but thanks for reminding me - if I get time this weekend I will continue to update it and try and prepare a release

Hi,

It seems that if you use a different port to forward remote connections, your plugin tries to use the remote port for the local connection

I have 2 Plex servers running here, both on 32400 on a different IP locally.

On the firewall, one is port forwarded from 32400, the other from 32500.

Your plugin took the 32500 as the port, and the local ip to connect to, which is a combination that doesn’t work :stuck_out_tongue:

Thanks!

edit: one runs just my music, the other just video. I have swapped the forwarded ports around to see if that helps for me.

Ok, browsing works now, but I can’t play.

I just get

Nov 14 14:40:36 volumio volumio[682]: verbose: ControllerMpd::sendMpdCommand stop

Very excited about this project. Has plexamp portion made progress / is it running reliably?

No progress in a few months. I have a new codebase which I should be able to port over this implementation and I will look into doing that over the Christmas period.

3 Likes

I would like to thank everyone for all their efforts. I set it up with Raspberry 2 and SSD1322 display and everything works perfectly. In addition, I installed a headless plexamp, but the information of an mp3 or flac file that I play with the plexamp does not appear on the screen. Only the clock appears. When I select an MP3 or flac as source with the Volumio app, no problem.
Is there a way to make the music information I send to plexamp headless appear on the screen?

PS: I made a 3D box suitable for my schiit brand equipment. If you wish, I will share it with you when it is completed.

Hey @Jerome_O_Flaherty
Hope you are doing well.
Any update on your wonderful job ? Available for any tests or help :slight_smile:
Thank again for your invest !
Cheers

any new updates ? all the problems mensunt up here are still thare ? can’t connect to remote server, when activating plugin i can not hit settings again. i see volumio in PLEX server so that part should work but i can not read my liberay…

Would also love to have a way to use my Volumio device (RPI 3B+) as a Plexamp endpoint I can control with the Plexamp app on my phone.

No need to be able to browse through the Plex library in the Volumio webUI, just a “Spotify Connect” for Plexamp.