encoding for killmessage, enviro instead of config, import os missing.
This commit is contained in:
parent
03b36c1035
commit
42d381f9e2
@ -46,6 +46,7 @@ Taultulli > Settings > Notification Agents > New Script > Script Arguments:
|
||||
import requests
|
||||
import argparse
|
||||
import sys
|
||||
import os
|
||||
from plexapi.server import PlexServer, CONFIG
|
||||
|
||||
TAUTULLI_URL = ''
|
||||
@ -54,16 +55,17 @@ PLEX_URL = ''
|
||||
PLEX_TOKEN = ''
|
||||
|
||||
# Environmental Variables
|
||||
#PLEX_URL = os.getenv('PLEX_URL', PLEX_URL)
|
||||
#PLEX_TOKEN = os.getenv('PLEX_TOKEN', PLEX_TOKEN)
|
||||
#TAUTULLI_URL = os.getenv('TAUTULLI_URL', TAUTULLI_URL)
|
||||
#TAUTULLI_APIKEY = os.getenv('TAUTULLI_APIKEY', TAUTULLI_APIKEY)
|
||||
PLEX_URL = os.getenv('PLEX_URL', PLEX_URL)
|
||||
PLEX_TOKEN = os.getenv('PLEX_TOKEN', PLEX_TOKEN)
|
||||
TAUTULLI_URL = os.getenv('TAUTULLI_URL', TAUTULLI_URL)
|
||||
TAUTULLI_APIKEY = os.getenv('TAUTULLI_APIKEY', TAUTULLI_APIKEY)
|
||||
TAUTULLI_ENCODING = os.getenv('TAUTULLI_ENCODING', 'UTF-8')
|
||||
|
||||
# Using CONFIG file
|
||||
PLEX_URL = CONFIG.data['auth'].get('server_baseurl', PLEX_URL)
|
||||
PLEX_TOKEN = CONFIG.data['auth'].get('server_token', PLEX_TOKEN)
|
||||
TAUTULLI_URL = CONFIG.data['auth'].get('tautulli_baseurl', TAUTULLI_URL)
|
||||
TAUTULLI_APIKEY = CONFIG.data['auth'].get('tautulli_apikey', TAUTULLI_APIKEY)
|
||||
# PLEX_URL = CONFIG.data['auth'].get('server_baseurl', PLEX_URL)
|
||||
# PLEX_TOKEN = CONFIG.data['auth'].get('server_token', PLEX_TOKEN)
|
||||
# TAUTULLI_URL = CONFIG.data['auth'].get('tautulli_baseurl', TAUTULLI_URL)
|
||||
# TAUTULLI_APIKEY = CONFIG.data['auth'].get('tautulli_apikey', TAUTULLI_APIKEY)
|
||||
|
||||
SUBJECT_TEXT = "Tautulli has killed a stream."
|
||||
BODY_TEXT = "Killed session ID '{id}'. Reason: {message}"
|
||||
@ -248,6 +250,10 @@ def terminate_session(session_id, message, notifier=None, username=None):
|
||||
return None
|
||||
|
||||
|
||||
def arg_decoding(arg):
|
||||
return arg.decode(TAUTULLI_ENCODING).encode('UTF-8')
|
||||
|
||||
|
||||
def unshare(user):
|
||||
print('{user} has reached their limit. Unsharing...'.format(user=user))
|
||||
plex.myPlexAccount().updateFriend(user=user, server=plex, removeSections=True, sections='2')
|
||||
|
Loading…
Reference in New Issue
Block a user