If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

[Beta-Release] PHP Library Presenter for PLEX [PLPP] (v0.9 beta)

mlocher75mlocher75 Posts: 53Members, Plex Pass Plex Pass

PHP Library Presenter for PLEX [PLPP]

Version

0.9 (beta) - 15 August 2016

Description

Provides a PHP frontend 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
  • PHP cURL extension
  • a running PLEX server
  • a recent browser with active javascript and cookies accepted

To do for final v1.0 release

  • include stream/part information in details view

Possible features for future releases

  • make the amount of information to be shown per media type configurable
  • download the library list in different file formats
  • support additional languages

Screen shots

(from version 0.5 beta)
Landing page (with slider)
Thumbs view for movie library
Details view for movie (pop up window)
List view for movie library
Thumbs view for show library
Thumbs view for seasons
Thumbs view for episodes
Details view for episode (pop up window)
Settings page part 1
Settings page part 2
Settings page part 3

Download

Download PLPP (v0.9 beta)

Install instructions

Unpack zip file and upload contents to a webserver.
Change permissions for the following files and folders:

  • /plpp/cache --> chmod 777
  • /plpp/config --> chmod 777
  • /plpp/config/general.json --> 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.

Updating from previous versions

Before v0.8 (beta)

  • Update not possible. Please delete all files and folders and install from scratch (see above).

v0.8 (beta) and later

  • Unpack zip file and overwrite the files in the plpp folder with the files from zip file.
  • Check permissions for the following files and folders and change if needed:
    • /plpp/cache --> chmod 777
    • /plpp/config --> chmod 777
    • /plpp/config/general.json --> chmod 777
  • Point your web browser to the settings page "/plpp/settings.php". Login with your password. Go to User Settings, change settings if needed and save!

Revision history

v0.9 (beta)

  • "Error message not showing up if plex server settings are wrong" corrected
  • Timeout if plex server is not reachable set 30 seconds
  • Rewrote function to load images now using cURL. Should load images slightly faster and work also via https if no OpenSSL installed.
  • Added search function

v0.8 (beta)

  • Almost a total rewrite of the code compared to v0.7. Coded a own class called plexAPI for interaction with the PLEX http API
  • Image handling rewritten: PLPP should now always load the correct thumb as set in the PLEX web GUI; PLPP will now load any kind of supported images and not only JPEG.
  • Added support for photo/pictures and music libraries
  • Added option to choose default view mode (thumbs or list view)
  • Added option to turn on/off image caching
  • Added option to refresh cached images
  • MIT license included

v0.7 (beta) - unreleased

  • Added filter selection drop down menu to the breadcrumb menu
  • Added item count to the breadcrumb menu
  • Some enhancements in the generated html
  • Episode count added to seasons view
  • Method to load the xml via web API changed. Using own function with curl instead of simPLEXml_load_file. May fix some issues when connecting via SSL if OpenSSL is not installed.

v0.6 (beta)

  • Readme file included
  • Correction of some syntactic errors in the generated html code
  • New configuration option for library index sort type and order
  • favicon.ico added
  • "Use of undefined constant SCRIPT_NAME" warning fixed
  • "Wrong Administrator Password" error when saving PLEX Server settings fixed
  • Log-out link added to settings section
  • All glyphicons icons replaced with font awesome and icon size increased
  • general.json configuration file structure slightly changed for easier handling
  • X-PLEX-Device-Name added to the authentication header when requesting the token (PLPP now shows up correctly in the PLEX device list)
  • Configuration file save routine changed to generate more detailed error messages in case saving fails
  • Configuration files are reloaded after saving

v0.5 (beta)

  • First public release

License

The MIT License (MIT)
Copyright (c) 2016 Michael Locher

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Tagged:
«134

Comments

  • m1e1w1m1e1w1 Posts: 363Members, Plex Pass Plex Pass
    edited May 2016

    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.

    Synology DS1511+ 5x4TB + DX513 5x4TB + DX513 5x4TB (For content) + 4TB External (For PMS Library)

    Dedicated Win 10 64bit PMS - 16GB RAM - intel i7 3770K @ 4.2Ghz (PMS App)
    2 Roku 2 XS, 3 Roku 2 XD, 2 Roku 3, 4 Chromecast
    11 Android Devices, 5 IDevices
    Using browsers - Chrome, Safari, Firefox, Internet Explorer

    130mb Down / 4mb Up

  • mlocher75mlocher75 Posts: 53Members, Plex Pass Plex Pass
    edited May 2016

    @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.

  • m1e1w1m1e1w1 Posts: 363Members, Plex Pass Plex Pass

    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.

    Synology DS1511+ 5x4TB + DX513 5x4TB + DX513 5x4TB (For content) + 4TB External (For PMS Library)

    Dedicated Win 10 64bit PMS - 16GB RAM - intel i7 3770K @ 4.2Ghz (PMS App)
    2 Roku 2 XS, 3 Roku 2 XD, 2 Roku 3, 4 Chromecast
    11 Android Devices, 5 IDevices
    Using browsers - Chrome, Safari, Firefox, Internet Explorer

    130mb Down / 4mb Up

  • pikeupepikeupe Posts: 107Members, Plex Pass Plex Pass
    edited May 2016

    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

  • mlocher75mlocher75 Posts: 53Members, Plex Pass Plex Pass

    @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.?

  • mlocher75mlocher75 Posts: 53Members, Plex Pass Plex Pass

    @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.

  • pikeupepikeupe Posts: 107Members, Plex Pass Plex Pass

    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 =

  • mlocher75mlocher75 Posts: 53Members, Plex Pass Plex Pass

    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.

  • pikeupepikeupe Posts: 107Members, Plex Pass Plex Pass

    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

  • mlocher75mlocher75 Posts: 53Members, Plex Pass Plex Pass

    @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.

  • pikeupepikeupe Posts: 107Members, Plex Pass Plex Pass

    @mlocher75 said:

    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!

  • mlocher75mlocher75 Posts: 53Members, Plex Pass Plex Pass

    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.

  • pikeupepikeupe Posts: 107Members, Plex Pass Plex Pass

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

  • mlocher75mlocher75 Posts: 53Members, Plex Pass Plex Pass

    @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.

  • pikeupepikeupe Posts: 107Members, Plex Pass Plex Pass

    then it works by disabling SSL
    thank you

  • mlocher75mlocher75 Posts: 53Members, Plex Pass Plex Pass

    @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.

  • pikeupepikeupe Posts: 107Members, Plex Pass Plex Pass

    I'll watch this side the
    thank you

  • pikeupepikeupe Posts: 107Members, Plex Pass Plex Pass
    edited May 2016

    Hello

    first page in the new section disappeared séries

  • mlocher75mlocher75 Posts: 53Members, Plex Pass Plex Pass
    edited May 2016

    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.

  • pikeupepikeupe Posts: 107Members, Plex Pass Plex Pass

    Hello
    I think it should be another problem
    because I added an episode of series and instead it puts me music library
    one attached image

«134
Sign In or Register to comment.