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,16 +181,21 @@ def notify(notifier_id=None, notify_action=None, stream_data=None, timeline_data
if not notifier_config:
return
# Get the subject and body strings
subject_string = notifier_config['notify_text'][notify_action]['subject']
body_string = notifier_config['notify_text'][notify_action]['body']
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
subject_string = notifier_config['notify_text'][notify_action]['subject']
body_string = notifier_config['notify_text'][notify_action]['body']
# Format the subject and body strings
subject, body, script_args = build_notify_text(subject=subject_string,
body=body_string,
notify_action=notify_action,
parameters=parameters,
agent_id=notifier_config['agent_id'])
# Format the subject and body strings
subject, body, script_args = build_notify_text(subject=subject_string,
body=body_string,
notify_action=notify_action,
parameters=parameters,
agent_id=notifier_config['agent_id'])
# Set the notification state in the db
notification_id = set_notify_state(session=stream_data or timeline_data,
@ -207,10 +212,12 @@ def notify(notifier_id=None, notify_action=None, stream_data=None, timeline_data
script_args=script_args,
notify_action=notify_action,
notification_id=notification_id,
parameters=parameters)
parameters=parameters,
**kwargs)
if success:
set_notify_success(notification_id)
return True
def get_notify_state(session):

View file

@ -3087,10 +3087,10 @@ class WebInterface(object):
if notifier:
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,
body=body,
notify_action=notify_action,
**kwargs):
return "Notification sent."
else: