Log test notifications

This commit is contained in:
JonnyWong16 2017-04-19 19:43:22 -07:00
parent 006e7c214d
commit f2f28f48cb
2 changed files with 19 additions and 12 deletions

View file

@ -181,6 +181,11 @@ def notify(notifier_id=None, notify_action=None, stream_data=None, timeline_data
if not notifier_config: if not notifier_config:
return return
if notify_action == 'test':
subject = kwargs.pop('subject', 'PlexPy')
body = kwargs.pop('body', 'Test Notification')
script_args = kwargs.pop('script_args', [])
else:
# Get the subject and body strings # Get the subject and body strings
subject_string = notifier_config['notify_text'][notify_action]['subject'] subject_string = notifier_config['notify_text'][notify_action]['subject']
body_string = notifier_config['notify_text'][notify_action]['body'] body_string = notifier_config['notify_text'][notify_action]['body']
@ -207,10 +212,12 @@ def notify(notifier_id=None, notify_action=None, stream_data=None, timeline_data
script_args=script_args, script_args=script_args,
notify_action=notify_action, notify_action=notify_action,
notification_id=notification_id, notification_id=notification_id,
parameters=parameters) parameters=parameters,
**kwargs)
if success: if success:
set_notify_success(notification_id) set_notify_success(notification_id)
return True
def get_notify_state(session): def get_notify_state(session):

View file

@ -3087,10 +3087,10 @@ class WebInterface(object):
if notifier: if notifier:
logger.debug(u"Sending %s%s notification." % (test, notifier['agent_name'])) logger.debug(u"Sending %s%s notification." % (test, notifier['agent_name']))
if notifiers.send_notification(notifier_id=notifier_id, if notification_handler.notify(notifier_id=notifier_id,
notify_action=notify_action,
subject=subject, subject=subject,
body=body, body=body,
notify_action=notify_action,
**kwargs): **kwargs):
return "Notification sent." return "Notification sent."
else: else: