I couldn't find any solutions for this in the forum, so I wrote a quick script to do this myself. If anyone has ideas for improvements let me know.
Here is the script and explanation/notes follow:
#!/bin/sh
# All echos are for debugging
# Get a count of the files in the pre-roll library minus default
NUM_FILES=ls /media/pre-roll | grep -v default.mkv |wc -l | sed -e 's/^[ \t]*//'
#echo "NUM_FILES=$NUM_FILES"
# Now Generate a random number between 1 and NUM_FILES
# I'm getting the random number from www.random.org
RANDNUM=wget -qO- https://www.random.org/integers/?num=1\&min=1\&max="$NUM_FILES"\&col=1\&base=10\&format=plain\&rnd=new
#echo "RANDNUM=$RANDNUM"
# Go to the RANDNUM file and then copy it to default.mkv
FILE=ls /media/pre-roll | grep -v default.mkv | head -"$RANDNUM" | tail -1
#echo "FILE=$FILE"
cp /media/pre-roll/$FILE /media/pre-roll/default.mkv
My Libraries are located under /media for my install.
I created a pre-roll library.
I downloaded some pre-roll video into my library. Then I created a default.mkv file by copying an existing video to that. I had to split the video as Plex recognized that it was a duplicate. Then I copied the url for my default.mkv file and pasted that in the pre-roll location in extras.
The script is located in my root directory in the jail that my plex media server is running in for freenas.
I'm assuming that all my pre-roll video files are mkv. If the formats are different then the script will not work as the default.mkv file will obviously not be the right type.
The script is running as root.
Finally, I set up a cronjob to run the script once a day at 3am:
0 3 * * * /pre-roll_update.sh
Hope you find this useful and feedback is always appreciated!