diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index a919c2c2..a6807d39 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -1052,7 +1052,16 @@ def build_notify_text(subject='', body='', notify_action=None, parameters=None, logger.error(u"Tautulli NotificationHandler :: Unable to parse custom script arguments: %s. Using fallback." % e) script_args = [] - elif agent_id == 25: + try: + subject = custom_formatter.format(unicode(subject), **parameters) + except LookupError as e: + logger.error(u"Tautulli NotificationHandler :: Unable to parse parameter %s in notification subject. Using fallback." % e) + subject = unicode(default_subject).format(**parameters) + except Exception as e: + logger.error(u"Tautulli NotificationHandler :: Unable to parse custom notification subject: %s. Using fallback." % e) + subject = unicode(default_subject).format(**parameters) + + if agent_id == 25: if body: try: body = json.loads(body) @@ -1076,15 +1085,6 @@ def build_notify_text(subject='', body='', notify_action=None, parameters=None, body = '' else: - try: - subject = custom_formatter.format(unicode(subject), **parameters) - except LookupError as e: - logger.error(u"Tautulli NotificationHandler :: Unable to parse parameter %s in notification subject. Using fallback." % e) - subject = unicode(default_subject).format(**parameters) - except Exception as e: - logger.error(u"Tautulli NotificationHandler :: Unable to parse custom notification subject: %s. Using fallback." % e) - subject = unicode(default_subject).format(**parameters) - try: body = custom_formatter.format(unicode(body), **parameters) except LookupError as e: