diff --git a/lib/bleach/sanitizer.py b/lib/bleach/sanitizer.py
index 8bdca752..3a1f953c 100644
--- a/lib/bleach/sanitizer.py
+++ b/lib/bleach/sanitizer.py
@@ -39,7 +39,7 @@ class BleachSanitizerMixin(HTMLSanitizerMixin):
if isinstance(self.allowed_attributes, dict):
allowed_attributes = self.allowed_attributes.get(
token['name'], [])
- print callable(allowed_attributes)
+ #print callable(allowed_attributes)
if not callable(allowed_attributes):
allowed_attributes += self.wildcard_attributes
else:
diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py
index df05f075..91c425e2 100644
--- a/plexpy/notification_handler.py
+++ b/plexpy/notification_handler.py
@@ -557,7 +557,7 @@ def build_server_notify_params(notify_action=None, **kwargs):
return available_params
-def build_notify_text(subject='', body='', notify_action=None, parameters=None, agent_id=None):
+def build_notify_text(subject='', body='', notify_action=None, parameters=None, agent_id=None, test=False):
media_type = parameters.get('media_type')
all_tags = r'.*?|' \
@@ -596,8 +596,13 @@ def build_notify_text(subject='', body='', notify_action=None, parameters=None,
default_body = default_action.get('body', '')
# Use default subject and body if they are blank
- subject = subject or default_subject
- body = body or default_body
+ # only if the notification is not script
+ if agent_id != 15:
+ subject = subject or default_subject
+ body = body or default_body
+
+ if test:
+ return subject, body
try:
subject = unicode(subject).format(**parameters)
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index 540f36a5..608b9f79 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -39,6 +39,7 @@ import http_handler
import libraries
import log_reader
import logger
+import notification_handler
import notifiers
import plextv
import plexivity_import
@@ -2985,6 +2986,26 @@ class WebInterface(object):
else:
return {'result': 'error', 'message': 'Failed to add notification agent.'}
+ @cherrypy.expose
+ @requireAuth(member_of("admin"))
+ def get_notify_text_preview(self, notify_action='', subject='', body='', agent_id=0, agent_name='', **kwargs):
+ if str(agent_id).isdigit():
+ agent_id = int(agent_id)
+
+ text = []
+
+ for media_type in ('movie', 'show', 'season', 'episode', 'artist', 'album', 'track'):
+ test_subject, test_body = notification_handler.build_notify_text(subject=subject,
+ body=body,
+ notify_action=notify_action,
+ parameters={'media_type': media_type},
+ agent_id=agent_id,
+ test=True)
+
+ text.append({'media_type': media_type, 'subject': test_subject, 'body': test_body})
+
+ return serve_template(templatename="notifier_text_preview.html", text=text, agent=agent_name)
+
@cherrypy.expose
@requireAuth(member_of("admin"))
@addtoapi("notify")