Plex Movie Poster Display

I always thought it would be cool to have a display outside my media room that would show the poster of the movie or TV show that is currently playing. I searched the internet and found similar projects, which were all windows programs.  There was just one problem… I wanted to run this project on a Raspberry Pi 3 running Linux. So, unsatisfied with the solutions I found online, I decided to build my own.

UPDATE: Code now updated to use X-Plex-Token.

github Get it on Github

Quick Links :
(The Plex Movie Poster program and Raspbian setup tips are after the how to section)
The Program
The Finished Project
Raspbian Setup Help

Parts List :
Raspberry Pi 3
Vizio TV – Vizio TV with a broken tuner.

Server Software :
Raspbian Jessie
Web Server – I am running NGINX.
Browser that runs in Kiosk mode – I am running Chromium.
Php – Programming language in which I ended up hacking together this code.
Sketch Up – To design the frame.

The Build :

I started out with a Vizio flat screen TV that had a broken TV tuner.  I stripped off all the extra bits and got down to just the main screen and the other needed electronic components.
IMG_20160522_201233

Once this was complete, I measured the screen and loaded up Sketch Up to design the frame. Admittedly, this is where I made my first mistake of the project. Since I do not normally work with wood, I did not realize that the stated size of wood and the actual size of wood is different. (Example a 1×3 is not 1 inch by 3 inches. It is actually 3/4″ x 2-1/2″). Doh. So all the time and work I spent designing the frame in Sketch Up ended up being scrapped.

Anyways, I had already purchased the wood so it was time to start a fresh design.
IMG_20160604_203910 IMG_20160605_160435 IMG_20160606_201457

One of the design issues I needed to solve was how to keep the screen in the frame. I wanted to be able to easily remove the screen, but it also needed to be securely mounted in the frame. The easiest solution I could come up with was to use some simple L brackets. The front of the screen presses against the outside frame border and the L brackets were screwed in on the backside of the frame, pressing the screen forward and holding it in place.
IMG_20160617_175620

Another design concern was mounting the complete assembly to the wall. Just like fastening the screen in the frame, I needed to be able to remove the completed frame from the wall easily. I came up with a solution that involved making a home made mount out of a few brackets, a dowel rod, and a 2 inch by 2 inch strip of wood. The mount is a strip of wood with two short dowels sticking out of the top and a few metal brackets to help keep it stable in the wall, along with one long screw through the strip into the wall stud. The frame then had two holes drilled into the top that lined up with the dowel rods on the mount. To hang the frame on the wall, I simply line up the holes in the frame to the dowels on the mount and slide it down. If I need to remove the frame for any reason I push up on the frame and it slides off the dowels.
IMG_20160611_194519 IMG_20160611_191553IMG_20160612_131435 IMG_20160611_193243IMG_20160616_133318 IMG_20160612_131454

I made a small hole in the left side of the frame (the side that would not be easily seen) through which I ran the screen control wires to the outer part of the frame. This gave me access to the power, brightness, etc. buttons since I would not have access to the back of the frame once it was mounted to the wall.

IMG_20160605_185239 IMG_20160617_180146

Next, it was time to stain. This is where I made my second mistake. The first stain was not correct and the frame had to be sanded down and re-stained. Second lesson learned… Always test stain on a scrap piece of wood. It may save you a lot of time and stress.
IMG_20160612_155654 IMG_20160613_215534 IMG_20160616_201426

The Program :

Disclaimer – I am a network engineer, not a programmer. I play around with code. I am publishing this to give back to the communities that have helped me learn. There may be better ways of scraping the Plex Posters, but this is the way I chose to do it. I am open to suggestions. Use at your own risk.

Download :
github Get it on Github

So, I had full intentions of writing the program in Python.  However, after messing around with it for a few weeks, I realized my Python skills are lacking. It was a fun Python learning experience, but I wanted to finish the project and had to switch to another language.

Old Python Version:
IMG_20160528_171849 IMG_20160606_202028 IMG_20160605_200106

I decided to rewrite the program in PHP and make it browser based. This allows me to have the Raspberry Pi boot to the desktop, automatically start a browser in kiosk mode, and open the PHP site.

How it Works :
This script scraps http://<IP Address of Plex server>:32400/status/sessions for clients and displays the poster of the currently playing movie or TV show. If nothing is currently playing, it will pull a random poster of an unwatched movie.

Prerequisites :
A functioning Plex Server
Web Server – I am running NGINX
PHP – I am running version  5.6.22
X-Plex-Token – Find out how to get your token here.

Features :
Custom Text on top and bottom of posters.
Cache posters locally.
Free.

Installation :

  1. Copy all the files into the root of your web server.
  2.  Fix permission on cache folder
     chmod 777 cache 
  3.  Edit the config.php file. (Do not forget to do this)
  4. Open the URL to your server in a broswer.

The Finished Project :

IMG_20160724_213411 IMG_20160628_235839 IMG_20160725_221757 IMG_20160725_221659 IMG_20160725_221559

Rasbian Jessie Setup Tips (Use at own risk)  :

Rotate Screen 90 Degrees :
Add the following line to the bottom of your /boot/config.txt

 display_rotate=1 

Remove Raspberry Pi Power Warning :
Add the following line to the bottom of your /boot/config.txt

 avoid_warnings=2 

Fix color depth on Raspberry Pi  :
Add the following lines to the bottom of your /boot/config.txt

framebuffer_depth=32
framebuffer_ignore_alpha=1 

Stop Raspberry Pi screen form going blank :
Uncomment the following line in/etc/lightdm/lightdm.conf

xserver-command=X -s 0 -dpms

Auto start Chromium in Kiosk on Raspberry Pi Jessie :
( I used this repo to install Chromium deb http://dl.bintray.com/kusti8/chromium-rpi jessie main )
vim /home/pi/.config/autostart/chromium.desktop and add copy and paste the following

[Desktop Entry]
Type=Application
Exec=/usr/bin/chromium-browser --noerrdialogs --disable-session-crashed-bubble --disable-infobars --kiosk http://<IP Address of server>
Hidden=false
X-GNOME-Autostart-enabled=true
Name[en_US]=AutoChromium
Name=AutoChromium
Comment=Start Chromium
Please follow and like us:

You may also like

38 Comments

  1. hello,

    im trying to get your program up and running. The $plexServer is the ip your plexmediaserver is running on correct? What is the $plexClient?

  2. Sorry for the late reply.

    The $plexclient is the ip address of the device you are using to watch your plex content with. If your Plex Server and Plex client are the same I would suggest trying 127.0.0.1 first. If you Plex Server and client are different devices then try using the IP address of the device you are watching the content on.

    I have released an update, and will be updating this blog soon, on github. It has a new web interface that might make this a little easier.

    I hope this helps,
    -Matt

  3. Love it! I was able to get this going and it is great, thanks for your work.

    Is there any way to do this with ROKU? Like if we are playing something from netfilx/amazon/plex to have the poster show…?

    1. Glad you like it. I hope to have another update in the next few months.

      I show the Plex posters on the screen when watching something on a Roku. The above should work, just need to set the Plex client IP address to your Roku’s IP address (?).
      As for Netflix or Amazon, I am not sure. There may be a way, however I have never tried it.

      I hope this helps,
      -Matt

    1. That is exactly what this does, but remotely. My movie poster frame is not next to my Plex Server, so I needed a solution to show the media information on a screen that could not be connected to the server it self.

      I hope this helps,
      -Matt

    1. Okay it works, but if nothing is playing is just will not change to “coming soon”.
      What do i need to put in the: PLEX_SERVER_MOVIES_SECTION_NUMBER ?
      Thanks!

      1. Glad you got it working.

        In a future release I will make this easier, however for now the best way to see the sections numbers is to open a browser and go to:
        https://[SERVER IP ADDRESS]:32400/library/sections

        The section number is listed under the composite variable Example: composite=”/library/sections/2/composite/1514750658″

        Also the type variable on the same line will show you the Section name. Example: type=”movie”

        I hope this helps.
        -Matt

        1. Hi, I got it working perfectly, changed the script a bit for faster updating and made it fit perfectly on my screen. AWESOME SCRIPT.

          Any updates i would love:

          For series: showing the Season and episode number.

          Overal:
          Showing the time the movie/series is playing and the time left
          Like: 1:36:14/2:15:00 (this would need to update every second though)
          This time would be posisioned on the bottom left corner over the poster image. ( in my opinion)

          I saw this at somewhere else but it was with kodi. Would love to see it with this script.

          Here is my poster (not finished yet)
          https://imgur.com/a/zzh2y

          Thanks!
          Alexander

          1. I forgot to add, your frame looks great. I was surprised how hard it was to make a rectangle out of wood…

          2. Hi again, sorry for al the comments haha, im trying to modify the script myself. The “duration” part is hard and I do not have that yet, because php is not my strongest language haha. But here is the part for the series

            $info = “” . $clients[‘parentTitle’] . ” Episode: ” . $clients[‘index’] . ” – ” . $clients[‘title’] . ” – ” . $clients[‘summary’] . “”;

            I keep you posted if I got the duration time. But I dont think it gets the “time left”or anything like that in the xlm, so we need to get that date somewhere else im afraid.

      1. That looks awesome, I am working on an update and hope to have it released in the next few months. Would it be okay if I merged these changes into the release (with credit of course)?

    1. Which .php file are you editing the script for? Sorry, bit of a novice coder in general but I love these feature ideas!

  4. Got it working as well. Looks good!

    Do you still have the python code from your first try?
    Can you publish it for the community to work on it?

    1. Thank you.

      I might have it somewhere. It was pretty bad since I am very new to Python. I will try to find it this weekend. 🙂

      -Matt

  5. I’ve come to realize this isn’t for the feint of heart, but i believe i have everything configured correctly. However, when i open a webpage nothing happens. Its a white screen. I can confirm that the network configurations are correct. At first i was getting access denied errors on everything, but i believe I’ve fixed that as well. Any advice?

    PS – I love this project, please let me know where i can donate so you will continue the awesome!

    1. Sorry to hear you are having trouble. Maybe check your web server error logs? Also what version of PHP are you using? I have not tested on PHP7 yet, but hope to in the next few weeks.

      I have never thought about donations since I do this as a hobby. I appreciate the offer however.

      -Matt

      1. It’s been great learning so it’s really no trouble. I am using php 5.6.33 although I think the website is using php 7?

  6. As an aside, i’m able to configure the AdminConfig.php file. I can open it up in a web browser and I see all my configurations pre-populated as expected.

    1. I am currently updating the script. I will get the new features added, since I am already about %75 done, and then see what changes need to be made of PHP 7.

      -Matt

  7. Is it absolutely necessary to run it on the Web Server (NGINX)? Would there be a way to read it from a standalone Plex serve not reverse proxied through NGINX?

    1. Sorry I was traveling and could not reply.

      The script uses the web server to run the PHP code on a remote device. It should be possible to run a web server on you Plex Server and hook it to a secondary display, but I have never run in this configuration.

      -Matt

  8. Running into the same issues. Installed and have the admin page to load. I tested the token and and access via url. Everything seems to be configured correctly. My setup is different, Apache instead nginx, and php v7. Where you able to determine php v7 impacts. The index page just load a black screen.

    Thanks this awesome stuff!!!

    1. I am unfortunately still working on the update. Life (AKA Work) has got in the way, but I hope to have it released soon. I plan on checking PHP7 while making a few last updates.

      -Matt

    2. Hi Danny, I ran into the same issue. For me, it turns out that the simplexml module was not installed when I installed PHP7. You can check your PHP install by creating a new file called phpinfo.php in the same directory as the movie poster code. Within that file put a single line:

      In your browser, navigate to that page. It will list your php config info. Do a search for simplexml. If you don’t see it listed as a module then you need to install it using the following command in the terminal:

      sudo apt-get install php7.0-xml

      After its done installing, refresh your phpinfo page and search again. You should now see multiple hits for “simplexml” and the module should be loaded.

      Once I got that resolved, it still took a good 30 seconds or more for the first poster image to display on screen, so give it a little time.

      That’s what worked for me. Hope that helps.

  9. For whatever reason, I am unable to get the entire poster to show on a 7 inch tablet. I have tried adjusting the width in the getData.php file to no avail. The bottom of the poster is being totally cut off, as is coming soon bottom text.

    Any help would be greatly appreciated.

    Great work!

    1. Please make sure you have the SimpleXML PHP module installed. If you are not sure if it is installed you can create / check a php file with phpinfo();

      If this module is install the script should work in PHP5 or PHP7.

      I hope this helps.
      -Matt

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.