How To Setup Plex-Automatic-Pre-roll-Gui in Windows

by Danny
4 comments

READING TIME: 6 MINUTES

In this guide, I’m going to show you how to setup and install Plex-Automatic-Preroll-Gui to automate the prerolls that play before you start a Plex movie.

If this sounds familiar, it’s because I wrote a step-by-step guide on how to do this last year. However, the developer JUST released a new version which now includes a GUI, so configuring things just became a lot easier. No more editing config files!

This script will let you configure your prerolls to automatically change at whatever schedule you desire – daily, weekly, monthly, or even for specific holidays.

For reference, my Plex server is running on Windows Server 2019 so I’m tailoring my guide to that. This tutorial can also be followed for Windows 10/11 users.

Let’s get started!


Install Python 3.7+

The first step in setting this up is ensuring that you have Python 3.7+ installed (it may work on older versions but is untested).

Note: If you have Tautulli installed to track and monitor Plex stats, then you might already have Python installed.

To check if you have Python installed and which version you are on, open Command Prompt (type CMD into Start) and enter this command:

python

If you are on an older version and/or don’t have Python installed, download from here: https://www.python.org/downloads/release/python-380/

Click the Windows x86-x64 executable. Once downloaded, double-click the .exe to launch the installer.

Click Install Now and check both boxes at the bottom.


Step 2: Download the Plex Automatic Preroll Gui script

Download the script file from the developer’s Github page: https://github.com/TheHumanRobot/Plex-Automatic-Pre-roll-GUI

Next, click the green “Code” button > Download zip.

  1. Download to any directory (Downloads is fine).
  2. Next, create a folder like C:\Prerolls.
  3. Right click the Plex-Automatic-Prerolls-GUI-main.zip file > Extract All.
  4. Extract to C:\Prerolls

Step 3: Install Required Packages

Inside that zip are several files – one of them is called requirements.txt. Inside that text file is a list of all the required packages needed to set this up.

Copy Requirements.txt to Python Directory

To install, first navigate to your Python install directory. If you installed Python with all defaults, the default install directory is:

C:\Users\USERNAME\AppData\Local\Programs\Python\Python38\Scripts

Copy and paste the requirements.txt file in the path above:

Change to Python Directory in Command Prompt

Now, we need to change to that directory. In a CMD window, type this:

cd C:\Users\USERNAME\AppData\Local\Programs\Python\Python38\Scripts

Install Required Packages

Then, install the packages from requirements.txt:

pip install -r requirements.txt

If all goes well, you should see it install a bunch of packages like this:


Step 4: Extract the dist.zip

After that, extract the dist.zip to the default location:

Double-click the extracted dist folder to open it. Click through the folders. In the Preroll subfolder, you’ll see a Preroll.exe file. Double-click that to launch it:

The first time you launch it, you’ll need to enter your:

  • Plex server URL (http://192.168.68.137:32400)
  • Plex server token

To find your Plex token:
1. Open the Plex UI.
2. Find a Movie> Get Info > View XML.
3. In the URL, scroll to the far right and copy the Plex-Token= XYZ field

Add both of those into Plex Automated Preroll window. If you already have prerolls downloaded, feel free to click a Schedule and then browse to their paths. Assuming you don’t have any prerolls yet, you can skip the Schedule and Default Files for now.

Click Save and Submit. The window should close.


Step 5: Download Plex Prerolls

Next, download a few prerolls and throw them into a folder. I put mine into the C:\Prerolls folder I created in Step 2:

You can find all kinds of prerolls on Youtube, or you can find some free and paid ones here: https://prerolls.video/

If you want the 5 prerolls in my image above, you can download from here: https://smarthomepursuits.com/download/5837/


Step 6: Set Schedule

After you have a few downloaded, launch the Preroll.exe again. This time, choose the schedule (Monthly for this example) and browse to the files you downloaded. Click Save and Submit once complete.


Step 7: Test It Out

If choosing Monthly like I did, add a preroll to both December and November. Save and Submit.

Then, run the PrerollUpdate.py file. (Possible bug as of 10:20pm CST 12/21/21 – you need to run Preroll.py > Save and Submit. Assuming this will be fixed very shortly and I’ll remove this note from my guide)

Play a Plex Movie from your phone. It should starting playing the preroll you have set for the month of December (since I am writing this as of 12/21/21).

To test, we are going to change our Windows clock to a date in November.

Control Panel > Set the time and date > Change Date and Time. Set it to a date in November.

Run the PrerollUpdate.py (or Preroll.py until fixed) again. To confirm it updated:

1. Open up Plex.

2. Click the wrench to get into your settings.

3. Settings > Extras tab. You should see the correct URL for the preroll you’ve set for the month of November.


Final Step: Create Scheduled Task

The last step is to create a Windows Scheduled task that runs on your schedule. For example, if you set monthly prerolls, have the scheduled task run on the 1st of every month.

Open Task Scheduler. Right-click Task Scheduler Library > Create Basic Task. Create your task like mine below:

In the Program/script box, enter this path (change the USERNAME of course): C:\Prerolls\Plex-Automatic-Pre-roll-GUI-main\dist\dist\Preroll\PrerollUpdate.py


Wrapping Up

That’s it! You have now successfully automated the prerolls that will play before you play a Plex movie (TV Shows are not supported – a Plex limitation).

Let me know in the comments if you got this working, and be sure to give a star on Github to the developer of this awesome tool!


My Homelab Equipment

Here is some of the gear I use in my Homelab. I highly recommend each of them.

The full list of server components I use can be found on my Equipment List page.

4 comments

You may also like

4 comments

Kevin Walsh December 23, 2021 - 7:31 am

Thanks for the tip

Reply
Matthew W Jones December 27, 2021 - 1:31 pm

Do you use the public IP or private IP if they are different?

Reply
Danny December 27, 2021 - 2:25 pm

You use the private IP of your Plex server.

Reply
Logan Olberg January 4, 2022 - 5:49 pm

Amazing Update!

https://prerolls.video/ has actually updated their website to add this feature now called Rollarr… not surprising!

Reply

Leave a Comment