JBOPS - Just a Bunch Of Plex Scripts

Hi @JamminR and @Samwiseg0

Thanks for your answers and sorry for the late reply I had not enabled my notifications to “watch” the thread correctly.

This is my setup:
QNAP NAS: TS-453 Pro Firmware 4.3.6.0895
PMS: Version 1.15.4.919 (Running in QNAP NAS)
Tautulli: Version 2.1.25 (Running in QNAP NAS)

So, as you have seen, PMS and Tautulli are apps installed in my NAS directly and are not dockerized or something like that.

I´ve reinstalled Tautulli from scratch a couple of days ago and I´ve obtained the same file kill_stream.py wich is in GitHub page.

Inside the file I´ve written the common variables:

TAUTULLI_URL = https://192.168.10.12:8660
TAUTULLI_PUBLIC_URL = https://myurl.com:8660
TAUTULLI_APIKEY = The code generated in Settings -> Web Interface -> API -> API key

By the way… could you explain what does this variable?

VERIFY_SSL = False

I´m interested because I´m using https:// URLs, as you have seen above, and could be useful for me.

Regarding the custom arguments…

The custom arguments configured in tautulli for the script are copied from here:

--jbop stream --username {username} --sessionId {session_id} --killMessage 'Transcoding streams are not allowed.'

I´ve seen also these custom arguments written in the script itself (line 34) but I haven´t used them because I can´t understand some of them like:

–jbop SELECTOR
–notify notifierID

So, with all of this when I start to watch something forcing the transcode I see this lines in the log:

2019-05-01 20:29:56 - INFO    :: CP Server Thread-8 : Cleared the tautulli.log file.
2019-05-01 20:30:14 - DEBUG   :: Thread-3 : Tautulli ActivityHandler :: Session 142 started by user 409166 (nickiman) with ratingKey 80064 (Turbo).
2019-05-01 20:30:14 - DEBUG   :: Thread-2 : Tautulli NotificationHandler :: Checking custom notification conditions for notifier_id 1.
2019-05-01 20:30:14 - DEBUG   :: Thread-2 : Tautulli NotificationHandler :: Custom condition evaluated to 'True'. Conditions: [True, True].
2019-05-01 20:30:14 - INFO    :: Thread-1 : Tautulli NotificationHandler :: Preparing notification for notifier_id 1.
2019-05-01 20:30:14 - DEBUG   :: Thread-2 : Tautulli NotificationHandler :: Checking custom notification conditions for notifier_id 5.
2019-05-01 20:30:14 - DEBUG   :: Thread-2 : Tautulli NotificationHandler :: Custom condition evaluated to 'True'. Conditions: [True].
2019-05-01 20:30:14 - INFO    :: Thread-2 : Tautulli NotificationHandler :: Preparing notification for notifier_id 3.
2019-05-01 20:30:14 - INFO    :: Thread-2 : Tautulli Notifiers :: Sending Telegram notification...
2019-05-01 20:30:16 - INFO    :: Thread-1 : Tautulli Notifiers :: Email notification sent.
2019-05-01 20:30:16 - INFO    :: Thread-1 : Tautulli NotificationHandler :: Preparing notification for notifier_id 5.
2019-05-01 20:30:16 - DEBUG   :: Thread-1 : Tautulli Notifiers :: Trying to run notify script, action: play, arguments: [u'--jbop', u'stream', u'--username', u'nickiman', u'--sessionId', u'w1v78dkv6a21rrdort3kxogv', u'--killMessage', u'Transcoding streams are not allowed.']
2019-05-01 20:30:16 - DEBUG   :: Thread-1 : Tautulli Notifiers :: Full script is: ['python', u'/share/CACHEDEV1_DATA/.qpkg/JBOPS/killstream/kill_stream.py', '--jbop', 'stream', '--username', 'nickiman', '--sessionId', 'w1v78dkv6a21rrdort3kxogv', '--killMessage', 'Transcoding streams are not allowed.']
2019-05-01 20:30:16 - DEBUG   :: Thread-1 : Tautulli Notifiers :: Executing script in a new thread.
2019-05-01 20:30:16 - INFO    :: Thread-2 : Tautulli Notifiers :: Telegram notification sent.
2019-05-01 20:30:16 - DEBUG   :: Thread-49 : Tautulli Notifiers :: Subprocess returned with status code 1.
2019-05-01 20:30:16 - ERROR   :: Thread-49 : Tautulli Notifiers :: Script error: 
  Traceback (most recent call last):
    File "/share/CACHEDEV1_DATA/.qpkg/Tautulli/lib/python2.7/site.py", line 67, in <module>
      import ssl
    File "/share/CACHEDEV1_DATA/.qpkg/Tautulli/lib/python2.7/ssl.py", line 95, in <module>
      from collections import namedtuple
    File "/share/CACHEDEV1_DATA/.qpkg/Tautulli/lib/python2.7/collections.py", line 21, in <module>
      from operator import itemgetter as _itemgetter, eq as _eq
  ImportError: /share/CACHEDEV1_DATA/.qpkg/Tautulli/lib/python2.7/lib-dynload/operator.so: undefined symbol: _PyUnicodeUCS2_AsDefaultEncodedString
2019-05-01 20:30:16 - INFO    :: Thread-49 : Tautulli Notifiers :: Script notification sent.
2019-05-01 20:30:16 - DEBUG   :: Thread-1 : Tautulli NotificationHandler :: Checking custom notification conditions for notifier_id 1.
2019-05-01 20:30:16 - DEBUG   :: Thread-1 : Tautulli NotificationHandler :: Custom condition evaluated to 'True'. Conditions: [True, True].
2019-05-01 20:30:16 - INFO    :: Thread-2 : Tautulli NotificationHandler :: Preparing notification for notifier_id 1.
2019-05-01 20:30:16 - INFO    :: Thread-1 : Tautulli NotificationHandler :: Preparing notification for notifier_id 3.
2019-05-01 20:30:17 - INFO    :: Thread-1 : Tautulli Notifiers :: Sending Telegram notification...
2019-05-01 20:30:18 - INFO    :: Thread-1 : Tautulli Notifiers :: Telegram notification sent.
2019-05-01 20:30:18 - INFO    :: Thread-2 : Tautulli Notifiers :: Email notification sent.

Looking at log it seems like there are several problems with the python embeded in Tautulli.
Correct me if I´m wrong.

These errors makes me wondering if I could call this script with a different python which I´ve installed in my QNAP NAS so, instead run the script like this:

Tautulli Notifiers :: Full script is: ['python', u'/share/CACHEDEV1_DATA/.qpkg/JBOPS/killstream/kill_stream.py

I would like to try to run the script like this:

Tautulli Notifiers :: Full script is: ['/share/CACHEDEV1_DATA/.qpkg/QPython2/bin/python2', u'/share/CACHEDEV1_DATA/.qpkg/JBOPS/killstream/kill_stream.py

Maybe in this way I could solve the python problems… just a guess.

Keep waiting your comments and thanks for your help.

Regards