Plex and PlexAmp plugin

Here is what I found:

The plugin uses the ‘net-ping’ npm module. That module uses the npm ‘raw-socket’ module to do low
level networking tasks under the hood. I hit two issues with raw-socket that prevented my media
server from being even sent an ICMP ping, and crashed the setup process:

node-raw-socket/issues/53
node-raw-socket/issues/70

Both these issues are still open. I replaced the ‘net-ping’ module with the ‘ping’ module and
later moved to a HTTP-based test (see below.)

The information that the plugin retrieved using pms/servers did not contain
my media server, since I did not have remote access enabled. I moved getting data from
pms/resources.

This got me to a plugin that detected my local media server. I then found a few more
problems.

I did not have a list of Albums by Artist at the top level (my favorite way to browse my
collection). I added one.

Links from pages with lists of albums to album pages were broken. This was because
the page generation code was requiring ‘related albums’ information and my media
server was not providing it. I made it optional – it will appear on the page, if provided,
but it is not necessary.

When I tried to test with multiple media servers by putting a Plex docker container in
Amazon EC2 via remote access, the plugin would get information about the server
from Plex.tv but the server library would never show up in the list. This was because
EC2 public interfaces have ICMP network traffic blocked by default. Thinking that
having ICMP traffic blocked by remote access servers is not an unreasonable assumption,
I replaced the ICMP ping with a http HEAD request to the Plex media server http port
instead. If any kind of successful (2XX) or unauthorized (401) response is returned,
the service is deemed to be reachable and running. That allowed me to access both
local and remote media libraries (though it’s via HTTP and still insecure.)

The label on the Music Libary options pull down always defaults to the first item provided
by Plex.tv regardless of what libary is actually being used. This is because a port number
was being loaded as a number when the code needed it to be loaded as string. I made sure
the value loaded from config.json is actually loaded as a string.

1 Like

A few more details and all the code can be found here:

Others on this thread can try my code if they wish, and please let me know if you want to
absorb any of these changes upstream. Please let me know if there is anything else I can
do to help. I’d like to see this get out there into the world as a supported plugin.

1 Like

Thanks that is great!

I will see if can I easily merge your branch in the next week or so! I have some local changes but I think from what you have written your changes will not overlap so should be easy to merge.

Jerome

1 Like

@Jerome_O_Flaherty, I see you’ve started writing some unit tests.

I felt the strong need for unit tests during my recent development efforts as well. I’ve spent the last week writing some unit tests to cover the plugin setup process. I’ve got http service mocks constructed that allow me to test much of getPinAndUpdateConfig().

I’m using mocha. Looks like you are using jest. I will convert my tests to jest and publish shortly.

Thanks.

Ted

1 Like

Twenty Jest tests to verify all the error paths for getPinAndUpdateConfig() and much of the dependent code can now be found in tests/getpingandupdateconfig.test.js. I found a couple bugs while verifying the tests.

I also updated the plexamp README.md file. I didn’t expect you to simply merge all my changes wholesale; the README still identified the code as a fork of your code. I’ll be more careful in future.

Great, I am just back from holidays so I plan to properly catchup this weekend. I had a hour or so when I was away hence why I merged the changes but because I didn’t have proper access to my Volumio’s devices I decided to wait before I can test the changes and hopefully prepare a PR for the Volumio dev team to push as a update to this plugin.

2 Likes

I am also back. I had to take a week off to do some intensive job interview prep. I just pushed a couple changes to my repo based on work over the last week or so. The first change is additional unit tests for getuconfig() and some surrounding functions. The second change fixes some problems with search() – it was not properly handling keyword searches for albums, artists, and songs that returned no data, and then was not properly formatting results to have handleBrowserUri() to correctly link to artist and album pages.
I’ll create some unit tests for the search code next.

2 Likes

Great, I should finally have a bit of time this weekend to try and push a new build of this into the Volumio review process.

1 Like

Hi,

Relatively new to RPi digital music streamers.
I’ve been using Plex for quite some time and ALL my CDs etc are ripped to 3 or 4 different libraries, however Plex doesn’t natively stream DSD…hence Volumio.

I know I can connect to Plex libraries via DLNA ok, but thought I’d try out your plugin.

It connects to my Plex server fine, however looks like it’s stalling when trying to connect to a library (?) eventually throwing the connection error.

Hope this helps.

I’ll keep watching pogress on this thread with interest.

Cheers

Jerome, does your plugin support folder view like original PlexAmp does?

No I don’t believe it does !!

Sorry guys I have gotten back to update this plugin - really soon I promise

Hi dmonds,

Could you supply some of the log showing the Plexamp plugin connection process leading up to the failure?

Where is your Plex server located? On the local network? On the internet somewhere? Does it have remote access enabled?

Thanks.

Yes any logs would be a great help. I am currently investigating rewriting the whole find the local Plex server code, if I get a more reliable approach I will update the plugin immediately

Hi,

Yes, Plex server on same network.
I’ll try it again tomorrow and grab a log and post here.

Ok, installed plugin.
Tried to select “Artists” from selection.
Green bar runs across top and stalls when almost to end of screen.
After about 90-120 seconds I get a “Server is unreachable” message.

Here’s the log…
http://logs.volumio.org/volumio/BOZ4JlB.html

Note: after install and setup. the settings button in the plugin presents a blank screen. (ie Volumio background but nothing else)
Perhaps this is the issue, as I’ve not had any opportunity to select a music library on my Plex Server.

Hope this helps.
dmonds

1 Like

Thanks for the logs - so a couple of questions:

  1. How big is your Plex library?
    I have about 4000 artists and it is slow loading the artist listing (eventually I will refactor the listing to be alphabetic and query all the ‘A’ then all the ‘B’ etc and make the Volumio UI more responsive when loading large libraries.
  2. Is Plex installed on 192.168.1.20 on your home network?

i.e. I see this call which is the one timing out?
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

  1. Have you tried any of the other browsing options like recently added ?

Thanks

Hi,

Answers:
I only have about 500 artists spread across 5 librarys.
All music is local to Plex server which is on 192.168.1.20

Yes, I did try different selections.

Please note: At what point do I tell your plugin which library to connect to?

I aso notice from the log snippet you have highlighted the connection is being attempted on port 32734…shouldn’t the connection be on the default port 32400?
Cheers

You should be able to view your libraries in the preferences / settings of the plugin. I have 2 servers with 3 libraries and I select which one I use in the preferences. Maybe I have some limit on the servers that I didn’t realise, also possible go into your app.plex.tv - Plex settings and check the list of authorised devices you have and by filtering the device type by “server” you should see the list of servers that the plugin queries, possible there was some server stored which is no longer used and that is causing this issue.

Hi,

As per previous posts…when I select settings for your plugin I get presented with a blank page…just the background and 3x tabs across the bottom of screen for Browser, Player and Queue.

I do not have an options showing to select a library.

I browse via Safari on iPad and Firefox via Win10 PC.
I have removed and installed the plugin 4 times now without any difference in behaviour.

Plex devices show the RPi.
I only have the one plex server.

Cheers

I’ve been following this and other “Plex plugin” threads and just to say I have exactly the same problem.

I get “Connection Failed - Server is unreachable”

I have one server on the same network.