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

2 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

Leave a Reply

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