diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index a34ed214..9954da70 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -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): diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 978ae4f2..d6850c3b 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -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: