This article will show you how to install PlexPy. PlexPy is a Python-based monitoring and tracking tool for Plex Media Server.
You'll need to execute some commands via SSH to use this software. There is a separate guide on how to connect to your slot via SSH. Commands are kept as simple as possible and in most cases will simply need to be copied and pasted into the terminal window (then executed by pressing the Enter key).
Installation - bash script
You can copy and paste the following to run an installation script for PlexPy:
wget -qO ~/install.plexpy.sh https://bitbucket.org/feralio/wiki/raw/HEAD/src/wiki/software/plexpy/plexpy.sh && bash ~/install.plexpy.sh
The script will also allow you to restart the software, re-run the proxypass setup (if you've made the switch to nginx) and uninstall PlexPy.
Installation - manual
Install PlexPy by logging in via SSH, then copying and pasting the following:
git clone https://github.com/JonnyWong16/plexpy.git
Configuring before starting PlexPy
You need to start and then close PlexPy so that it'll create the necessary configs. Do so with the following command:
screen -dmS plexpy python ~/plexpy/PlexPy.py && sleep 10 && pkill -fu "$(whoami)" 'plexpy'
We also need to change the port number, since the default can naturally only be used once per server. To randomise it, run this command (the start command in the section below will tell you how to access Jackett):
sed -i 's|http_port = 8181|http_port = '$(shuf -i 10001-32001 -n 1)'|g' ~/plexpy/config.ini
If you intend to follow the guide to proxypassing, run this command as well:
sed -i "s|http_root = \"\"|http_root = /$(whoami)/plexpy/|g" ~/plexpy/config.ini
Please note that startup commands below assume you haven't done this - see the proxypass guide on help for the URL you'll need to use.
Starting, stopping and restarting
This section covers the PlexPy process - starting it, stopping it and restarting it. It also covers checking if the process is running, in case that becomes necessary.
- screen -dmS plexpy python ~/plexpy/PlexPy.py && echo -e "\nhttp://$(hostname -f):$(sed -rn 's|http_port = (.*)|\1|p' ~/plexpy/config.ini)"
- check running
- pgrep -fu "$(whoami)" "SCREEN -dmS plexpy"
- pkill -fu "$(whoami)" 'SCREEN -dmS plexpy'
- pkill -fu "$(whoami)" 'SCREEN -dmS plexpy' && screen -dmS plexpy python ~/plexpy/PlexPy.py && echo -e "\nhttp://$(hostname -f):$(sed -rn 's|http_port = (.*)|\1|p' ~/plexpy/config.ini)"
- kill (force stop)
- pkill -9 -fu "$(whoami)" 'SCREEN -dmS plexpy'
Automatically restarting PlexPy if it is not running
Cron jobs can be used to check if PlexPy is running and start it up if it is not. There is a separate page on configuring cron jobs.
Go to the URL provided by the script or start-up command. When it loads, you'll be presented with a Setup Wizard. After clicking Next on the welcome screen, you'll need to enter your Plex username and password then click Authenticate. Assuming the authentication is successful, click on Next
At the next screen you'll need to select your Plex server. Click the dropdown and you should see an IP beginning with 10 and your server name in parentheses. Click this, and the text next to the verify button should read Server found!.
The next screens of the wizard are really personal preference. Choose the monitoring and notification options you wish, and read the text on important existing PlexWatch / Plexivity databases (noting the instructions, if importing applies to you).
Finally, click Finish and PlexPy should scan your Plex libraries and load up the homepage.
If you experience issues or crashes using PlexPy the first thing to try and do is restart the software using the command listed in the section above, "Starting, stopping and restarting"
pkill -9 -fu "$(whoami)" 'SCREEN -dmS plexpy' rm -rf ~/plexpy/