[Release] PHP Library Presenter for PLEX [PLPP]

other-dev

#1

PLEX Logo

PHP Library Presenter for PLEX [PLPP]

Version

v1.0 - 01.01.2018 - first release on GitHub

Download

https://github.com/Tensai75/plpp/releases

Description

Provides a PHP front end to simply present PLEX libraries on the web without the possibility to play or download the library items. Currently movie/home video, TV show, music and photo/picture libraries are supported.

Background

I always was looking for a program to present my PLEX libraries to my friends and relatives. The PLEX web gui is great, but not suitable for this purpose because I do not want them all to have access to the web gui. Hence I started to code my own solution, which should have a similar look as the PLEX web gui.
However, I haven't coded in PHP for years. Actually I did not program anything for years. So this project is also a teaching project for me especially to learn OOP. Therefore the code might be pretty ugly but I wrote this program for myself and myself solely. I release this program into public domain without any warranty. It worked for me, but it must not for you.
If you find bugs you can gladly post them here but don't expect me to correct them immediately (as a father of three little girls, I have a very busy life).

Features

  • directly accesses a PLEX server via http API
  • slider view for the front page showing recently added library items (bxslider jquery plug-in)
  • 2 different views for the libraries:
    • thumbnail view
    • data table list view (dataTables jquery plug-in)
  • ajax pop-up for the detail view of a movie/tv show/music library item
  • lightbox gallery pop-up for the photos/pictures of photo/picture libraries
  • password protected admin section to change the configuration, e.g.:
    • set up the connection to the PLEX server
    • exclude libraries from being shown
  • template and CSS based and hence themeable
  • default template/theme based on bootstrap 3
  • posters and thumbnails are served via the PHP script to prevent the PLEX token to be disclosed in the generated html code
  • the images are cached locally in order to speed up image delivery

Requirements

  • a webserver with PHP (tested with apache v2.2 and PHP v5.6)
  • PHP GD extension for image manipulation
  • a running PLEX server
  • a recent browser with active javascript and cookies accepted

Possible features for future releases

  • include stream/part information in details view
  • make the amount of information to be shown per media type configurable
  • download the library list in different file formats
  • support additional languages

Install instructions

Clone the repository to your webserver root or unpack zip file and upload contents to a webserver.
Change permissions for the following folders:

  • plpp/cache --> chmod 777
  • plpp/config --> chmod 777

Point your web browser to "plpp/settings.php". You are first prompted to set the password for the settings section. Thereafter you can login to configure the settings.

Screen Shoots

Screen Shoot 1
Screen Shoot 2
Screen Shoot 3
Screen Shoot 4
Screen Shoot 5
Screen Shoot 6

Revision history

v1.0

  • First release on GitHub

Plex Web Player
#2

Tested.

Initial findings:
when setting up plex server information, after saving i get a prompt "wrong administrator password!" although its correct after i specify the password for setup and then again to login.

Libraries to include show up for settings, so checked all boxes.

front end home page does not display any library images, thumbnails or lists for me. Is there a population time for the content? i.e. every 1000 movies should load in X number of seconds?

Debug enabled get this:
Error: Use of undefined constant SCRIPT_NAME - assumed 'SCRIPT_NAME'

Guide is well written for setup. had no issues meeting requirements / permissions.


#3

@m1e1w1 said:
Tested.

Thanks for testing it.

@m1e1w1 said:
Initial findings:
when setting up plex server information, after saving i get a prompt "wrong administrator password!" although its correct after i specify the password for setup and then again to login.

Do you always get this error when saving the settings or was it a one-time error?
Edit: Probably found the reason: POST variable for the login password and the PLEX Server password were identical. Didn't catch this because I used the same password for both. Will be fixed in next release.

@m1e1w1 said:
Libraries to include show up for settings, so checked all boxes.

front end home page does not display any library images, thumbnails or lists for me. Is there a population time for the content? i.e. every 1000 movies should load in X number of seconds?

The checked libraries are excluded. So when checking all libraries you won't see anything on the front page. If you want to see all libraries, uncheck them all.
Might be illogical and will probably be changed vice-versa in the next release.

@m1e1w1 said:
Debug enabled get this:
Error: Use of undefined constant SCRIPT_NAME - assumed 'SCRIPT_NAME'

Yeah, I forgot the quotation marks. Will be fixed with next release.


#4

Thanks for replying;

  • The wrong administrator password! error i get every time "save" is pressed.

  • Wow, the excluded libraries.... that's my fault. It say's that on the settings page and i just did not pay attention to it to realize it said exclude, not include. However, with the existing install; once a library is set to exclude by checking the box, and saving... unchecking the box and saving is not working. after save i get a message "Success: Configuration file "config/libraries.json" successfully saved!" and after page refreshes itself, the previously unchecked box is still checked. viewing the front end page behavor is correct that it dose not show the excluded library after attempted save.

  • Fresh install of all files, works fine, all libraries show up. tested again, with checking a library to exclude, save, un-check, save; stays checked.


#5

Hello

I have 2 errors when I go to library

H_INFO in C:\xampp\htdocs\plpp\settings.php on line 16
Error: Undefined index: ORIG_PATH_INFO
Error: Plex server not reachable!
thank you for this work


#6

@m1e1w1 said:
- Fresh install of all files, works fine, all libraries show up. tested again, with checking a library to exclude, save, un-check, save; stays checked.

Pretty strange. Looks like your libraries.json file is locked after first time save.

I have uploaded a new release (v0.6 beta) in the first post. I have changed the error handling while saving the configuration files to have more detailed error message in case saving fails.
Can you try the new version and report back any error message you encounter when checking/unchecking the libraries and saving them as mentioned above? Please also turn on debug mode for the tests.

Can you also provide some background information, e.g. what webserver are you using, PHP version, etc.?


#7

@pikeupe said:
H_INFO in C:\xampp\htdocs\plpp\settings.php on line 16
Error: Undefined index: ORIG_PATH_INFO

Fixed in version v0.6.

Error: Plex server not reachable!

There must be something wrong with your PLEX Server settings.
Or the access to the PLEX Server is blocked, e.g. by a router or by a firewall.

Turn on the debug mode in the "User Settings" page and then go back to the front end and click on "Show Debug Information". In the third line of the pop-up window the url is stated which is used to contact your PLEX server. Check if you get a response when you copy/past the url into a webbrowser.

Note: to be able to use this program the PLEX server must be accessible via the specified port. Check also your "Remote Access" settings in the PLEX web gui server settings.


#8

Hello

I am running windows 7 and xampp V3.2.1

a single mistake I with version V0.6 beta

Error: Plex server not reachable!

here's what I have in Debug

$plpp_item =
$plpp_viewmode = slider
$url = https://127.0.0.1:32400/library/recentlyAdded/?X-Plex-Token=********************
$plpp_libraryindex =
Array
(
[Directory] =>
)
$plpp_plexxml =


#9

@pikeupe said:
here's what I have in Debug

$url = https://127.0.0.1:32400/library/recentlyAdded/?X-Plex-Token=********************

You are using the IP for localhost (127.0.0.1). So you have installed PLPP on the same computer where also the plex server is running, correct?

Can you access the PLEX web gui on this computer with a web browser with the url "https://127.0.0.1:32400/web" ?

Have you tried to turn of SSL in the PLPP Plex Server settings?
If it still does not work, also check the "Network" settings in the PLEX web gui and set "secure connections" to "preferred" to allow also non-SSL connections.


#10

I just tested it on my nas ds414 + dsm 6
impecable works with some slowness after having given the permission to the folder and file
great job thank you


#11

@pikeupe said:
I just tested it on my nas ds414 + dsm 6
impecable works with some slowness after having given the permission to the folder and file
great job thank you

Thanks!
I know that the pages load a little slow the first time because the images are first requested from the plex server, processed and saved locally by the script. It would have been much faster if the images would load directly from the plex server but in this case, the token would be exposed in the img links in the soure code, which is a big security issue. So I decided to let the script serve the images. Because the images are cached locally, the further page views of an already cached page should load much faster.

There is also another little drawback: the cache folder might get several megabites big if you have huge libraries.


#12

@mlocher75 said:

@pikeupe said:
here's what I have in Debug

$url = https://127.0.0.1:32400/library/recentlyAdded/?X-Plex-Token=********************

You are using the IP for localhost (127.0.0.1). So you have installed PLPP on the same computer where also the plex server is running, correct?

Can you access the PLEX web gui on this computer with a web browser with the url "https://127.0.0.1:32400/web" ?

Have you tried to turn of SSL in the PLPP Plex Server settings?
If it still does not work, also check the "Network" settings in the PLEX web gui and set "secure connections" to "preferred" to allow also non-SSL connections.

yes everything is on the same computer
yes I arrive via https://127.0.0.1:32400/web/index.html well on the page

I have not authorized Secure connection has plex but its does not change
Error: Plex server not reachable!


#13

Honestly I don't know why the script can't connect to the plex server on the same computer.
But I am glad that it works on your diskstation.


#14

apparently it does not find the path PMS
Where was I could put it manually and in what form


#15

@pikeupe said:
apparently it does not find the path PMS
Where was I could put it manually and in what form
You dont need the path to plex server. My script gets the info via http API. Hence if you can access the plex server web gui with a web browser via https://127.0.0.1:32400/web/index.html the script should be able to access the server too.

I am still not sure if you have tried to disable SSL in my script. The setting should look like this:

If it still does not work with this setting, I am clueless. Especially if the script installed on your diskstation can access the plex server.


#16

then it works by disabling SSL
thank you


#17

@pikeupe said:
then it works by disabling SSL
thank you

OK. So the culprit is probably your PHP installation on the Windows computer. Most probably OpenSSL is not included and hence PHP fails to establish a proper SSL connection.


#18

I'll watch this side the
thank you


#19

Hello

first page in the new section disappeared séries


#20

Hi pikeupe

In the recently added sections, only itmes are displayed from libraries which are not excluded.
But the plex server does only return the latest 25 movies and 25 shows of all libraries. Therefore if you have added 25 or more new shows to a library which is excluded, the plex server will return these shows which subsequently are filtered out by my script, so nothing is shown.

Another reason could be that you have not added a new show at all for some time. I don't know exactly but I believe the plex server does only return items which have been added within a certain time frame, e.g. within the last X weeks.