Installing and Configuring Custom Tautulli Scripts

This guide will show you how to setup Custom Tautulli Scripts. These scripts extend the functionality of your Plex Media Server and gives you more flexibility

In this guide, we'll be installing 2 scripts, killstream.py and limiterr.py from blacktwin's JBOPS repository.. We'll be setting up the following:

  • killstream.py to disallow transcoding of 4k sources
  • limiterr.py to limit amount of plays of a show during night time.

Take note that the scripts in this guide requires Plex Pass and will only work on Plex Pass users.

Prerequisites

  • Login to your seedbox's SSH
  • We'll create a folder named scripts, so do mkdir -p scripts then navigate to your newly created folder with cd scripts
  • Get the full path of the folder by doing pwd. Take note of the output. In this guide, the output is /home7/usbdocs/scripts. Yours may vary.
usbdocs@lw975:~$ mkdir -p scripts
usbdocs@lw975:~$ cd scripts
usbdocs@lw975:~/scripts$ pwd
/home7/usbdocs/scripts
usbdocs@lw975:~/scripts$

killstream.py

Downloading The Script

  • Download the latest revision of the script below using wget
wget https://raw.githubusercontent.com/blacktwin/JBOPS/python3/killstream/kill_stream.py
  • After that, change the owner and make it executable by running the following commands
chown $USER:$USER kill_stream.py
chmod a+x kill_stream.py

Configuring Tautulli Notification Agent

  • Open up Tautulli and go to Settings

  • Then, on Notification Agents click Add a new notification agent. Scroll down and select Script.

  • Then under Script Settings, enter the following information
Configuration

Script Folder: [output of `pwd`]
Script file: ./kill_stream.py
Description: [Add anything here.]

Triggers

Playback Start
Transcode Decision Change

Conditions

Condition {1}: Video Decision - is - transcode
Condition {2}: Library Name - contains - 4K

Append 4k Library Namea with 4k movies/TV Shows in Plex for the second condition to work.

Arguments

Playback Start:

--jbop stream --username {username} --sessionId {session_id} --killMessage 'Please do not transcode 4k. Thanks!'

Arguments

Transcode Decision Change:

--jbop stream --username {username} --sessionId {session_id} --killMessage 'Please do not transcode 4k. Thanks!'

  • Once that's all done, click Save

Testing The Script

  • You can test your script by attempting to play a 4k file and change the quality to 720p or lower. It'll transcode for a while, after which you should get the stream kill message.

limiterr.py

This script is dependent on the timezone of Plex instances. Our slots are hosted in The Netherlands, so its timezone is CET/CEST. Adjust the times as necessary. You may use World Time Buddy to check your local timezone in relation to the seedbox's timezone.

Downloading The Script

  • Download the latest revision of the script below using wget
wget https://raw.githubusercontent.com/blacktwin/JBOPS/master/killstream/limiterr.py
  • After that, change the owner and make it executable by running the following commands
chown $USER:$USER limiterr.py
chmod a+x limiterr.py

Configuring Tautulli Notification Agent

  • Open up Tautulli and go to Settings

  • Then, on Notification Agents click Add a new notification agent. Scroll down and select Script.

  • Then under Script Settings, enter the following information
Configuration

Script Folder: [output of `pwd`]
Script file: ./limiterr.py
Description: [Add anything here.]

Triggers

Playback Start

Conditions

Condition {1}: Current Hour - is - 22 or 23 or 0 or 1

(Value is dependent in relation to your timezone and the seedbox's timezone.)

Arguments

Playback Start:

--jbop limit --username {username} --sessionId {session_id} --grandparent_rating_key {grandparent_rating_key} --limit plays=3 --delay 60 --killMessage "You sleep bro?"

  • Once that's all done, click Save

Testing The Script

  • You can test your script by watching some shows at the set times. After 3 plays, you should get the stream kill message.