Add notification for server down

This commit is contained in:
Jonathan Wong 2015-11-16 23:19:37 -08:00
parent 1983597cf1
commit b28ac1543a
6 changed files with 115 additions and 15 deletions

View file

@ -64,6 +64,13 @@ from plexpy import helpers
</label> </label>
<p class="help-block">Trigger notification when a media item is added to the Plex Media Server.</p> <p class="help-block">Trigger notification when a media item is added to the Plex Media Server.</p>
</div> </div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_down" ${helpers.checked(data['on_down'])} class="toggle-switches">
Notify on server down
</label>
<p class="help-block">Trigger notification when the Plex Media Server cannot be reached.</p>
</div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -658,6 +658,23 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
</li> </li>
</ul> </ul>
</li> </li>
<li>
<div class="link"><i class="fa fa-server"></i>Server Down<i class="fa fa-chevron-down"></i></div>
<ul class="submenu">
<li>
<div class="form-group">
<label for="notify_on_down_subject_text">Subject Line</label>
<input class="form-control" type="text" id="notify_on_down_subject_text" name="notify_on_down_subject_text" value="${config['notify_on_down_subject_text']}" data-parsley-trigger="change" required>
<p class="help-block">Set a custom subject line.</p>
</div>
<div class="form-group">
<label for="notify_on_down_body_text">Message Body</label>
<textarea class="form-control" id="notify_on_down_body_text" name="notify_on_down_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_down_body_text']}</textarea>
<p class="help-block">Set a custom body.</p>
</div>
</li>
</ul>
</li>
</ul> </ul>
<p><input type="button" class="btn btn-bright save-button" value="Save" data-success="Changes saved successfully"></p> <p><input type="button" class="btn btn-bright save-button" value="Save" data-success="Changes saved successfully"></p>

View file

@ -46,6 +46,7 @@ _CONFIG_DEFINITIONS = {
'BOXCAR_ON_BUFFER': (int, 'Boxcar', 0), 'BOXCAR_ON_BUFFER': (int, 'Boxcar', 0),
'BOXCAR_ON_WATCHED': (int, 'Boxcar', 0), 'BOXCAR_ON_WATCHED': (int, 'Boxcar', 0),
'BOXCAR_ON_CREATED': (int, 'Boxcar', 0), 'BOXCAR_ON_CREATED': (int, 'Boxcar', 0),
'BOXCAR_ON_DOWN': (int, 'Boxcar', 0),
'BUFFER_THRESHOLD': (int, 'Monitoring', 3), 'BUFFER_THRESHOLD': (int, 'Monitoring', 3),
'BUFFER_WAIT': (int, 'Monitoring', 900), 'BUFFER_WAIT': (int, 'Monitoring', 900),
'CACHE_DIR': (str, 'General', ''), 'CACHE_DIR': (str, 'General', ''),
@ -71,6 +72,7 @@ _CONFIG_DEFINITIONS = {
'EMAIL_ON_BUFFER': (int, 'Email', 0), 'EMAIL_ON_BUFFER': (int, 'Email', 0),
'EMAIL_ON_WATCHED': (int, 'Email', 0), 'EMAIL_ON_WATCHED': (int, 'Email', 0),
'EMAIL_ON_CREATED': (int, 'Email', 0), 'EMAIL_ON_CREATED': (int, 'Email', 0),
'EMAIL_ON_DOWN': (int, 'Email', 0),
'ENABLE_HTTPS': (int, 'General', 0), 'ENABLE_HTTPS': (int, 'General', 0),
'FIRST_RUN_COMPLETE': (int, 'General', 0), 'FIRST_RUN_COMPLETE': (int, 'General', 0),
'FREEZE_DB': (int, 'General', 0), 'FREEZE_DB': (int, 'General', 0),
@ -88,6 +90,7 @@ _CONFIG_DEFINITIONS = {
'GROWL_ON_BUFFER': (int, 'Growl', 0), 'GROWL_ON_BUFFER': (int, 'Growl', 0),
'GROWL_ON_WATCHED': (int, 'Growl', 0), 'GROWL_ON_WATCHED': (int, 'Growl', 0),
'GROWL_ON_CREATED': (int, 'Growl', 0), 'GROWL_ON_CREATED': (int, 'Growl', 0),
'GROWL_ON_DOWN': (int, 'Growl', 0),
'HOME_LIBRARY_CARDS': (str, 'General', 'library_statistics_first'), 'HOME_LIBRARY_CARDS': (str, 'General', 'library_statistics_first'),
'HOME_STATS_LENGTH': (int, 'General', 30), 'HOME_STATS_LENGTH': (int, 'General', 30),
'HOME_STATS_TYPE': (int, 'General', 0), 'HOME_STATS_TYPE': (int, 'General', 0),
@ -113,6 +116,7 @@ _CONFIG_DEFINITIONS = {
'IFTTT_ON_BUFFER': (int, 'IFTTT', 0), 'IFTTT_ON_BUFFER': (int, 'IFTTT', 0),
'IFTTT_ON_WATCHED': (int, 'IFTTT', 0), 'IFTTT_ON_WATCHED': (int, 'IFTTT', 0),
'IFTTT_ON_CREATED': (int, 'IFTTT', 0), 'IFTTT_ON_CREATED': (int, 'IFTTT', 0),
'IFTTT_ON_DOWN': (int, 'IFTTT', 0),
'JOURNAL_MODE': (str, 'Advanced', 'wal'), 'JOURNAL_MODE': (str, 'Advanced', 'wal'),
'LAUNCH_BROWSER': (int, 'General', 1), 'LAUNCH_BROWSER': (int, 'General', 1),
'LOG_DIR': (str, 'General', ''), 'LOG_DIR': (str, 'General', ''),
@ -138,6 +142,7 @@ _CONFIG_DEFINITIONS = {
'NMA_ON_BUFFER': (int, 'NMA', 0), 'NMA_ON_BUFFER': (int, 'NMA', 0),
'NMA_ON_WATCHED': (int, 'NMA', 0), 'NMA_ON_WATCHED': (int, 'NMA', 0),
'NMA_ON_CREATED': (int, 'NMA', 0), 'NMA_ON_CREATED': (int, 'NMA', 0),
'NMA_ON_DOWN': (int, 'NMA', 0),
'NOTIFY_CONSECUTIVE': (int, 'Monitoring', 1), 'NOTIFY_CONSECUTIVE': (int, 'Monitoring', 1),
'NOTIFY_RECENTLY_ADDED_GRANDPARENT': (int, 'Monitoring', 0), 'NOTIFY_RECENTLY_ADDED_GRANDPARENT': (int, 'Monitoring', 0),
'NOTIFY_RECENTLY_ADDED_DELAY': (int, 'Monitoring', 60), 'NOTIFY_RECENTLY_ADDED_DELAY': (int, 'Monitoring', 60),
@ -156,6 +161,8 @@ _CONFIG_DEFINITIONS = {
'NOTIFY_ON_WATCHED_BODY_TEXT': (str, 'Monitoring', '{user} ({player}) has watched {title}.'), 'NOTIFY_ON_WATCHED_BODY_TEXT': (str, 'Monitoring', '{user} ({player}) has watched {title}.'),
'NOTIFY_ON_CREATED_SUBJECT_TEXT': (str, 'Monitoring', 'PlexPy ({server_name})'), 'NOTIFY_ON_CREATED_SUBJECT_TEXT': (str, 'Monitoring', 'PlexPy ({server_name})'),
'NOTIFY_ON_CREATED_BODY_TEXT': (str, 'Monitoring', '{title} was recently added to Plex.'), 'NOTIFY_ON_CREATED_BODY_TEXT': (str, 'Monitoring', '{title} was recently added to Plex.'),
'NOTIFY_ON_DOWN_SUBJECT_TEXT': (str, 'Monitoring', 'PlexPy ({server_name})'),
'NOTIFY_ON_DOWN_BODY_TEXT': (str, 'Monitoring', 'The Plex server is down.'),
'OSX_NOTIFY_APP': (str, 'OSX_Notify', '/Applications/PlexPy'), 'OSX_NOTIFY_APP': (str, 'OSX_Notify', '/Applications/PlexPy'),
'OSX_NOTIFY_ENABLED': (int, 'OSX_Notify', 0), 'OSX_NOTIFY_ENABLED': (int, 'OSX_Notify', 0),
'OSX_NOTIFY_ON_PLAY': (int, 'OSX_Notify', 0), 'OSX_NOTIFY_ON_PLAY': (int, 'OSX_Notify', 0),
@ -165,6 +172,7 @@ _CONFIG_DEFINITIONS = {
'OSX_NOTIFY_ON_BUFFER': (int, 'OSX_Notify', 0), 'OSX_NOTIFY_ON_BUFFER': (int, 'OSX_Notify', 0),
'OSX_NOTIFY_ON_WATCHED': (int, 'OSX_Notify', 0), 'OSX_NOTIFY_ON_WATCHED': (int, 'OSX_Notify', 0),
'OSX_NOTIFY_ON_CREATED': (int, 'OSX_Notify', 0), 'OSX_NOTIFY_ON_CREATED': (int, 'OSX_Notify', 0),
'OSX_NOTIFY_ON_DOWN': (int, 'OSX_Notify', 0),
'PLEX_CLIENT_HOST': (str, 'Plex', ''), 'PLEX_CLIENT_HOST': (str, 'Plex', ''),
'PLEX_ENABLED': (int, 'Plex', 0), 'PLEX_ENABLED': (int, 'Plex', 0),
'PLEX_PASSWORD': (str, 'Plex', ''), 'PLEX_PASSWORD': (str, 'Plex', ''),
@ -176,6 +184,7 @@ _CONFIG_DEFINITIONS = {
'PLEX_ON_BUFFER': (int, 'Plex', 0), 'PLEX_ON_BUFFER': (int, 'Plex', 0),
'PLEX_ON_WATCHED': (int, 'Plex', 0), 'PLEX_ON_WATCHED': (int, 'Plex', 0),
'PLEX_ON_CREATED': (int, 'Plex', 0), 'PLEX_ON_CREATED': (int, 'Plex', 0),
'PLEX_ON_DOWN': (int, 'Plex', 0),
'PROWL_ENABLED': (int, 'Prowl', 0), 'PROWL_ENABLED': (int, 'Prowl', 0),
'PROWL_KEYS': (str, 'Prowl', ''), 'PROWL_KEYS': (str, 'Prowl', ''),
'PROWL_PRIORITY': (int, 'Prowl', 0), 'PROWL_PRIORITY': (int, 'Prowl', 0),
@ -186,6 +195,7 @@ _CONFIG_DEFINITIONS = {
'PROWL_ON_BUFFER': (int, 'Prowl', 0), 'PROWL_ON_BUFFER': (int, 'Prowl', 0),
'PROWL_ON_WATCHED': (int, 'Prowl', 0), 'PROWL_ON_WATCHED': (int, 'Prowl', 0),
'PROWL_ON_CREATED': (int, 'Prowl', 0), 'PROWL_ON_CREATED': (int, 'Prowl', 0),
'PROWL_ON_DOWN': (int, 'Prowl', 0),
'PUSHALOT_APIKEY': (str, 'Pushalot', ''), 'PUSHALOT_APIKEY': (str, 'Pushalot', ''),
'PUSHALOT_ENABLED': (int, 'Pushalot', 0), 'PUSHALOT_ENABLED': (int, 'Pushalot', 0),
'PUSHALOT_ON_PLAY': (int, 'Pushalot', 0), 'PUSHALOT_ON_PLAY': (int, 'Pushalot', 0),
@ -195,6 +205,7 @@ _CONFIG_DEFINITIONS = {
'PUSHALOT_ON_BUFFER': (int, 'Pushalot', 0), 'PUSHALOT_ON_BUFFER': (int, 'Pushalot', 0),
'PUSHALOT_ON_WATCHED': (int, 'Pushalot', 0), 'PUSHALOT_ON_WATCHED': (int, 'Pushalot', 0),
'PUSHALOT_ON_CREATED': (int, 'Pushalot', 0), 'PUSHALOT_ON_CREATED': (int, 'Pushalot', 0),
'PUSHALOT_ON_DOWN': (int, 'Pushalot', 0),
'PUSHBULLET_APIKEY': (str, 'PushBullet', ''), 'PUSHBULLET_APIKEY': (str, 'PushBullet', ''),
'PUSHBULLET_DEVICEID': (str, 'PushBullet', ''), 'PUSHBULLET_DEVICEID': (str, 'PushBullet', ''),
'PUSHBULLET_CHANNEL_TAG': (str, 'PushBullet', ''), 'PUSHBULLET_CHANNEL_TAG': (str, 'PushBullet', ''),
@ -206,6 +217,7 @@ _CONFIG_DEFINITIONS = {
'PUSHBULLET_ON_BUFFER': (int, 'PushBullet', 0), 'PUSHBULLET_ON_BUFFER': (int, 'PushBullet', 0),
'PUSHBULLET_ON_WATCHED': (int, 'PushBullet', 0), 'PUSHBULLET_ON_WATCHED': (int, 'PushBullet', 0),
'PUSHBULLET_ON_CREATED': (int, 'PushBullet', 0), 'PUSHBULLET_ON_CREATED': (int, 'PushBullet', 0),
'PUSHBULLET_ON_DOWN': (int, 'PushBullet', 0),
'PUSHOVER_APITOKEN': (str, 'Pushover', ''), 'PUSHOVER_APITOKEN': (str, 'Pushover', ''),
'PUSHOVER_ENABLED': (int, 'Pushover', 0), 'PUSHOVER_ENABLED': (int, 'Pushover', 0),
'PUSHOVER_KEYS': (str, 'Pushover', ''), 'PUSHOVER_KEYS': (str, 'Pushover', ''),
@ -218,6 +230,7 @@ _CONFIG_DEFINITIONS = {
'PUSHOVER_ON_BUFFER': (int, 'Pushover', 0), 'PUSHOVER_ON_BUFFER': (int, 'Pushover', 0),
'PUSHOVER_ON_WATCHED': (int, 'Pushover', 0), 'PUSHOVER_ON_WATCHED': (int, 'Pushover', 0),
'PUSHOVER_ON_CREATED': (int, 'Pushover', 0), 'PUSHOVER_ON_CREATED': (int, 'Pushover', 0),
'PUSHOVER_ON_DOWN': (int, 'Pushover', 0),
'REFRESH_USERS_INTERVAL': (int, 'Monitoring', 12), 'REFRESH_USERS_INTERVAL': (int, 'Monitoring', 12),
'REFRESH_USERS_ON_STARTUP': (int, 'Monitoring', 1), 'REFRESH_USERS_ON_STARTUP': (int, 'Monitoring', 1),
'TELEGRAM_BOT_TOKEN': (str, 'Telegram', ''), 'TELEGRAM_BOT_TOKEN': (str, 'Telegram', ''),
@ -230,6 +243,7 @@ _CONFIG_DEFINITIONS = {
'TELEGRAM_ON_BUFFER': (int, 'Telegram', 0), 'TELEGRAM_ON_BUFFER': (int, 'Telegram', 0),
'TELEGRAM_ON_WATCHED': (int, 'Telegram', 0), 'TELEGRAM_ON_WATCHED': (int, 'Telegram', 0),
'TELEGRAM_ON_CREATED': (int, 'Telegram', 0), 'TELEGRAM_ON_CREATED': (int, 'Telegram', 0),
'TELEGRAM_ON_DOWN': (int, 'Telegram', 0),
'TV_NOTIFY_ENABLE': (int, 'Monitoring', 0), 'TV_NOTIFY_ENABLE': (int, 'Monitoring', 0),
'TV_NOTIFY_ON_START': (int, 'Monitoring', 1), 'TV_NOTIFY_ON_START': (int, 'Monitoring', 1),
'TV_NOTIFY_ON_STOP': (int, 'Monitoring', 0), 'TV_NOTIFY_ON_STOP': (int, 'Monitoring', 0),
@ -245,6 +259,7 @@ _CONFIG_DEFINITIONS = {
'TWITTER_ON_BUFFER': (int, 'Twitter', 0), 'TWITTER_ON_BUFFER': (int, 'Twitter', 0),
'TWITTER_ON_WATCHED': (int, 'Twitter', 0), 'TWITTER_ON_WATCHED': (int, 'Twitter', 0),
'TWITTER_ON_CREATED': (int, 'Twitter', 0), 'TWITTER_ON_CREATED': (int, 'Twitter', 0),
'TWITTER_ON_DOWN': (int, 'Twitter', 0),
'UPDATE_DB_INTERVAL': (int, 'General', 24), 'UPDATE_DB_INTERVAL': (int, 'General', 24),
'VERIFY_SSL_CERT': (bool_int, 'Advanced', 1), 'VERIFY_SSL_CERT': (bool_int, 'Advanced', 1),
'VIDEO_LOGGING_ENABLE': (int, 'Monitoring', 1), 'VIDEO_LOGGING_ENABLE': (int, 'Monitoring', 1),
@ -258,7 +273,8 @@ _CONFIG_DEFINITIONS = {
'XBMC_ON_RESUME': (int, 'XBMC', 0), 'XBMC_ON_RESUME': (int, 'XBMC', 0),
'XBMC_ON_BUFFER': (int, 'XBMC', 0), 'XBMC_ON_BUFFER': (int, 'XBMC', 0),
'XBMC_ON_WATCHED': (int, 'XBMC', 0), 'XBMC_ON_WATCHED': (int, 'XBMC', 0),
'XBMC_ON_CREATED': (int, 'XBMC', 0) 'XBMC_ON_CREATED': (int, 'XBMC', 0),
'XBMC_ON_DOWN': (int, 'XBMC', 0)
} }
# pylint:disable=R0902 # pylint:disable=R0902
# it might be nice to refactor for fewer instance variables # it might be nice to refactor for fewer instance variables

View file

@ -179,6 +179,14 @@ def notify_timeline(timeline_data=None, notify_action=None):
body=notify_strings[1]) body=notify_strings[1])
# Set the notification state in the db # Set the notification state in the db
set_notify_state(session=timeline_data, state=notify_action, agent_info=agent) set_notify_state(session=timeline_data, state=notify_action, agent_info=agent)
elif notify_action == 'down':
for agent in notifiers.available_notification_agents():
if agent['on_down'] and notify_action == 'down':
# Build and send notification
notify_strings = build_server_notify_text(state=notify_action)
notifiers.send_notification(config_id=agent['id'],
subject=notify_strings[0],
body=notify_strings[1])
else: else:
logger.debug(u"PlexPy Notifier :: Notify timeline called but incomplete data received.") logger.debug(u"PlexPy Notifier :: Notify timeline called but incomplete data received.")
@ -583,6 +591,42 @@ def build_notify_text(session=None, timeline=None, state=None):
else: else:
return None return None
def build_server_notify_text(state=None):
# Get the server name
server_name = plexpy.CONFIG.PMS_NAME
on_down_subject = plexpy.CONFIG.NOTIFY_ON_DOWN_SUBJECT_TEXT
on_down_body = plexpy.CONFIG.NOTIFY_ON_DOWN_BODY_TEXT
available_params = {'server_name': server_name}
# Default text
subject_text = 'PlexPy (%s)' % server_name
if state == 'down':
# Default body text
body_text = 'Unable to get a response from the server.'
if on_down_subject and on_down_body:
try:
subject_text = unicode(on_down_subject).format(**available_params)
except LookupError, e:
logger.error(u"PlexPy Notifier :: Unable to parse field %s in notification subject. Using fallback." % e)
except:
logger.error(u"PlexPy Notifier :: Unable to parse custom notification subject. Using fallback.")
try:
body_text = unicode(on_down_body).format(**available_params)
except LookupError, e:
logger.error(u"PlexPy Notifier :: Unable to parse field %s in notification body. Using fallback." % e)
except:
logger.error(u"PlexPy Notifier :: Unable to parse custom notification body. Using fallback.")
return [subject_text, body_text]
else:
return [subject_text, body_text]
else:
return None
def strip_tag(data): def strip_tag(data):
import re import re

View file

@ -66,7 +66,8 @@ def available_notification_agents():
'on_resume': plexpy.CONFIG.GROWL_ON_RESUME, 'on_resume': plexpy.CONFIG.GROWL_ON_RESUME,
'on_buffer': plexpy.CONFIG.GROWL_ON_BUFFER, 'on_buffer': plexpy.CONFIG.GROWL_ON_BUFFER,
'on_watched': plexpy.CONFIG.GROWL_ON_WATCHED, 'on_watched': plexpy.CONFIG.GROWL_ON_WATCHED,
'on_created': plexpy.CONFIG.GROWL_ON_CREATED 'on_created': plexpy.CONFIG.GROWL_ON_CREATED,
'on_down': plexpy.CONFIG.GROWL_ON_DOWN
}, },
{'name': 'Prowl', {'name': 'Prowl',
'id': AGENT_IDS['Prowl'], 'id': AGENT_IDS['Prowl'],
@ -79,7 +80,8 @@ def available_notification_agents():
'on_resume': plexpy.CONFIG.PROWL_ON_RESUME, 'on_resume': plexpy.CONFIG.PROWL_ON_RESUME,
'on_buffer': plexpy.CONFIG.PROWL_ON_BUFFER, 'on_buffer': plexpy.CONFIG.PROWL_ON_BUFFER,
'on_watched': plexpy.CONFIG.PROWL_ON_WATCHED, 'on_watched': plexpy.CONFIG.PROWL_ON_WATCHED,
'on_created': plexpy.CONFIG.PROWL_ON_CREATED 'on_created': plexpy.CONFIG.PROWL_ON_CREATED,
'on_down': plexpy.CONFIG.PROWL_ON_DOWN
}, },
{'name': 'XBMC', {'name': 'XBMC',
'id': AGENT_IDS['XBMC'], 'id': AGENT_IDS['XBMC'],
@ -92,7 +94,8 @@ def available_notification_agents():
'on_resume': plexpy.CONFIG.XBMC_ON_RESUME, 'on_resume': plexpy.CONFIG.XBMC_ON_RESUME,
'on_buffer': plexpy.CONFIG.XBMC_ON_BUFFER, 'on_buffer': plexpy.CONFIG.XBMC_ON_BUFFER,
'on_watched': plexpy.CONFIG.XBMC_ON_WATCHED, 'on_watched': plexpy.CONFIG.XBMC_ON_WATCHED,
'on_created': plexpy.CONFIG.XBMC_ON_CREATED 'on_created': plexpy.CONFIG.XBMC_ON_CREATED,
'on_down': plexpy.CONFIG.XBMC_ON_DOWN
}, },
{'name': 'Plex', {'name': 'Plex',
'id': AGENT_IDS['Plex'], 'id': AGENT_IDS['Plex'],
@ -105,7 +108,8 @@ def available_notification_agents():
'on_resume': plexpy.CONFIG.PLEX_ON_RESUME, 'on_resume': plexpy.CONFIG.PLEX_ON_RESUME,
'on_buffer': plexpy.CONFIG.PLEX_ON_BUFFER, 'on_buffer': plexpy.CONFIG.PLEX_ON_BUFFER,
'on_watched': plexpy.CONFIG.PLEX_ON_WATCHED, 'on_watched': plexpy.CONFIG.PLEX_ON_WATCHED,
'on_created': plexpy.CONFIG.PLEX_ON_CREATED 'on_created': plexpy.CONFIG.PLEX_ON_CREATED,
'on_down': plexpy.CONFIG.PLEX_ON_DOWN
}, },
{'name': 'NotifyMyAndroid', {'name': 'NotifyMyAndroid',
'id': AGENT_IDS['NMA'], 'id': AGENT_IDS['NMA'],
@ -118,7 +122,8 @@ def available_notification_agents():
'on_resume': plexpy.CONFIG.NMA_ON_RESUME, 'on_resume': plexpy.CONFIG.NMA_ON_RESUME,
'on_buffer': plexpy.CONFIG.NMA_ON_BUFFER, 'on_buffer': plexpy.CONFIG.NMA_ON_BUFFER,
'on_watched': plexpy.CONFIG.NMA_ON_WATCHED, 'on_watched': plexpy.CONFIG.NMA_ON_WATCHED,
'on_created': plexpy.CONFIG.NMA_ON_CREATED 'on_created': plexpy.CONFIG.NMA_ON_CREATED,
'on_down': plexpy.CONFIG.NMA_ON_DOWN
}, },
{'name': 'Pushalot', {'name': 'Pushalot',
'id': AGENT_IDS['Pushalot'], 'id': AGENT_IDS['Pushalot'],
@ -131,7 +136,8 @@ def available_notification_agents():
'on_resume': plexpy.CONFIG.PUSHALOT_ON_RESUME, 'on_resume': plexpy.CONFIG.PUSHALOT_ON_RESUME,
'on_buffer': plexpy.CONFIG.PUSHALOT_ON_BUFFER, 'on_buffer': plexpy.CONFIG.PUSHALOT_ON_BUFFER,
'on_watched': plexpy.CONFIG.PUSHALOT_ON_WATCHED, 'on_watched': plexpy.CONFIG.PUSHALOT_ON_WATCHED,
'on_created': plexpy.CONFIG.PUSHALOT_ON_CREATED 'on_created': plexpy.CONFIG.PUSHALOT_ON_CREATED,
'on_down': plexpy.CONFIG.PUSHALOT_ON_DOWN
}, },
{'name': 'Pushbullet', {'name': 'Pushbullet',
'id': AGENT_IDS['Pushbullet'], 'id': AGENT_IDS['Pushbullet'],
@ -144,7 +150,8 @@ def available_notification_agents():
'on_resume': plexpy.CONFIG.PUSHBULLET_ON_RESUME, 'on_resume': plexpy.CONFIG.PUSHBULLET_ON_RESUME,
'on_buffer': plexpy.CONFIG.PUSHBULLET_ON_BUFFER, 'on_buffer': plexpy.CONFIG.PUSHBULLET_ON_BUFFER,
'on_watched': plexpy.CONFIG.PUSHBULLET_ON_WATCHED, 'on_watched': plexpy.CONFIG.PUSHBULLET_ON_WATCHED,
'on_created': plexpy.CONFIG.PUSHBULLET_ON_CREATED 'on_created': plexpy.CONFIG.PUSHBULLET_ON_CREATED,
'on_down': plexpy.CONFIG.PUSHBULLET_ON_DOWN
}, },
{'name': 'Pushover', {'name': 'Pushover',
'id': AGENT_IDS['Pushover'], 'id': AGENT_IDS['Pushover'],
@ -157,7 +164,8 @@ def available_notification_agents():
'on_resume': plexpy.CONFIG.PUSHOVER_ON_RESUME, 'on_resume': plexpy.CONFIG.PUSHOVER_ON_RESUME,
'on_buffer': plexpy.CONFIG.PUSHOVER_ON_BUFFER, 'on_buffer': plexpy.CONFIG.PUSHOVER_ON_BUFFER,
'on_watched': plexpy.CONFIG.PUSHOVER_ON_WATCHED, 'on_watched': plexpy.CONFIG.PUSHOVER_ON_WATCHED,
'on_created': plexpy.CONFIG.PUSHOVER_ON_CREATED 'on_created': plexpy.CONFIG.PUSHOVER_ON_CREATED,
'on_down': plexpy.CONFIG.PUSHOVER_ON_DOWN
}, },
{'name': 'Boxcar2', {'name': 'Boxcar2',
'id': AGENT_IDS['Boxcar2'], 'id': AGENT_IDS['Boxcar2'],
@ -170,7 +178,8 @@ def available_notification_agents():
'on_resume': plexpy.CONFIG.BOXCAR_ON_RESUME, 'on_resume': plexpy.CONFIG.BOXCAR_ON_RESUME,
'on_buffer': plexpy.CONFIG.BOXCAR_ON_BUFFER, 'on_buffer': plexpy.CONFIG.BOXCAR_ON_BUFFER,
'on_watched': plexpy.CONFIG.BOXCAR_ON_WATCHED, 'on_watched': plexpy.CONFIG.BOXCAR_ON_WATCHED,
'on_created': plexpy.CONFIG.BOXCAR_ON_CREATED 'on_created': plexpy.CONFIG.BOXCAR_ON_CREATED,
'on_down': plexpy.CONFIG.BOXCAR_ON_DOWN
}, },
{'name': 'E-mail', {'name': 'E-mail',
'id': AGENT_IDS['Email'], 'id': AGENT_IDS['Email'],
@ -183,7 +192,8 @@ def available_notification_agents():
'on_resume': plexpy.CONFIG.EMAIL_ON_RESUME, 'on_resume': plexpy.CONFIG.EMAIL_ON_RESUME,
'on_buffer': plexpy.CONFIG.EMAIL_ON_BUFFER, 'on_buffer': plexpy.CONFIG.EMAIL_ON_BUFFER,
'on_watched': plexpy.CONFIG.EMAIL_ON_WATCHED, 'on_watched': plexpy.CONFIG.EMAIL_ON_WATCHED,
'on_created': plexpy.CONFIG.EMAIL_ON_CREATED 'on_created': plexpy.CONFIG.EMAIL_ON_CREATED,
'on_down': plexpy.CONFIG.EMAIL_ON_DOWN
}, },
{'name': 'Twitter', {'name': 'Twitter',
'id': AGENT_IDS['Twitter'], 'id': AGENT_IDS['Twitter'],
@ -196,7 +206,8 @@ def available_notification_agents():
'on_resume': plexpy.CONFIG.TWITTER_ON_RESUME, 'on_resume': plexpy.CONFIG.TWITTER_ON_RESUME,
'on_buffer': plexpy.CONFIG.TWITTER_ON_BUFFER, 'on_buffer': plexpy.CONFIG.TWITTER_ON_BUFFER,
'on_watched': plexpy.CONFIG.TWITTER_ON_WATCHED, 'on_watched': plexpy.CONFIG.TWITTER_ON_WATCHED,
'on_created': plexpy.CONFIG.TWITTER_ON_CREATED 'on_created': plexpy.CONFIG.TWITTER_ON_CREATED,
'on_down': plexpy.CONFIG.TWITTER_ON_DOWN
}, },
{'name': 'IFTTT', {'name': 'IFTTT',
'id': AGENT_IDS['IFTTT'], 'id': AGENT_IDS['IFTTT'],
@ -209,7 +220,8 @@ def available_notification_agents():
'on_resume': plexpy.CONFIG.IFTTT_ON_RESUME, 'on_resume': plexpy.CONFIG.IFTTT_ON_RESUME,
'on_buffer': plexpy.CONFIG.IFTTT_ON_BUFFER, 'on_buffer': plexpy.CONFIG.IFTTT_ON_BUFFER,
'on_watched': plexpy.CONFIG.IFTTT_ON_WATCHED, 'on_watched': plexpy.CONFIG.IFTTT_ON_WATCHED,
'on_created': plexpy.CONFIG.IFTTT_ON_CREATED 'on_created': plexpy.CONFIG.IFTTT_ON_CREATED,
'on_down': plexpy.CONFIG.IFTTT_ON_DOWN
}, },
{'name': 'Telegram', {'name': 'Telegram',
'id': AGENT_IDS['Telegram'], 'id': AGENT_IDS['Telegram'],
@ -222,7 +234,8 @@ def available_notification_agents():
'on_resume': plexpy.CONFIG.TELEGRAM_ON_RESUME, 'on_resume': plexpy.CONFIG.TELEGRAM_ON_RESUME,
'on_buffer': plexpy.CONFIG.TELEGRAM_ON_BUFFER, 'on_buffer': plexpy.CONFIG.TELEGRAM_ON_BUFFER,
'on_watched': plexpy.CONFIG.TELEGRAM_ON_WATCHED, 'on_watched': plexpy.CONFIG.TELEGRAM_ON_WATCHED,
'on_created': plexpy.CONFIG.TELEGRAM_ON_CREATED 'on_created': plexpy.CONFIG.TELEGRAM_ON_CREATED,
'on_down': plexpy.CONFIG.TELEGRAM_ON_DOWN
} }
] ]
@ -240,7 +253,8 @@ def available_notification_agents():
'on_resume': plexpy.CONFIG.OSX_NOTIFY_ON_RESUME, 'on_resume': plexpy.CONFIG.OSX_NOTIFY_ON_RESUME,
'on_buffer': plexpy.CONFIG.OSX_NOTIFY_ON_BUFFER, 'on_buffer': plexpy.CONFIG.OSX_NOTIFY_ON_BUFFER,
'on_watched': plexpy.CONFIG.OSX_NOTIFY_ON_WATCHED, 'on_watched': plexpy.CONFIG.OSX_NOTIFY_ON_WATCHED,
'on_created': plexpy.CONFIG.OSX_NOTIFY_ON_CREATED 'on_created': plexpy.CONFIG.OSX_NOTIFY_ON_CREATED,
'on_down': plexpy.CONFIG.OSX_NOTIFY_ON_DOWN
}) })
return agents return agents

View file

@ -462,6 +462,8 @@ class WebInterface(object):
"notify_on_watched_body_text": plexpy.CONFIG.NOTIFY_ON_WATCHED_BODY_TEXT, "notify_on_watched_body_text": plexpy.CONFIG.NOTIFY_ON_WATCHED_BODY_TEXT,
"notify_on_created_subject_text": plexpy.CONFIG.NOTIFY_ON_CREATED_SUBJECT_TEXT, "notify_on_created_subject_text": plexpy.CONFIG.NOTIFY_ON_CREATED_SUBJECT_TEXT,
"notify_on_created_body_text": plexpy.CONFIG.NOTIFY_ON_CREATED_BODY_TEXT, "notify_on_created_body_text": plexpy.CONFIG.NOTIFY_ON_CREATED_BODY_TEXT,
"notify_on_down_subject_text": plexpy.CONFIG.NOTIFY_ON_DOWN_SUBJECT_TEXT,
"notify_on_down_body_text": plexpy.CONFIG.NOTIFY_ON_DOWN_BODY_TEXT,
"home_stats_length": plexpy.CONFIG.HOME_STATS_LENGTH, "home_stats_length": plexpy.CONFIG.HOME_STATS_LENGTH,
"home_stats_type": checked(plexpy.CONFIG.HOME_STATS_TYPE), "home_stats_type": checked(plexpy.CONFIG.HOME_STATS_TYPE),
"home_stats_count": plexpy.CONFIG.HOME_STATS_COUNT, "home_stats_count": plexpy.CONFIG.HOME_STATS_COUNT,