Check media_type in params when building notification text

This commit is contained in:
JonnyWong16 2016-10-04 18:52:11 -07:00 committed by JonnyWong16
parent 08a8b5fee0
commit 06db6826ed

View file

@ -528,13 +528,13 @@ def build_server_notify_params(notify_action=None):
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):
# Check for exclusion tags # Check for exclusion tags
if parameters['media_type'] == 'movie': if parameters.get('media_type') == 'movie':
# Regex pattern to remove the text in the tags we don't want # Regex pattern to remove the text in the tags we don't want
pattern = re.compile(r'<movie>|</movie>|<tv>.*?</tv>|<music>.*?</music>', re.IGNORECASE | re.DOTALL) pattern = re.compile(r'<movie>|</movie>|<tv>.*?</tv>|<music>.*?</music>', re.IGNORECASE | re.DOTALL)
elif parameters['media_type'] == 'show' or parameters['media_type'] == 'episode': elif parameters.get('media_type') == 'show' or parameters.get('media_type') == 'episode':
# Regex pattern to remove the text in the tags we don't want # Regex pattern to remove the text in the tags we don't want
pattern = re.compile(r'<movie>.*?</movie>|<tv>|</tv>|<music>.*?</music>', re.IGNORECASE | re.DOTALL) pattern = re.compile(r'<movie>.*?</movie>|<tv>|</tv>|<music>.*?</music>', re.IGNORECASE | re.DOTALL)
elif parameters['media_type'] == 'artist' or parameters['media_type'] == 'track': elif parameters.get('media_type') == 'artist' or parameters.get('media_type') == 'track':
# Regex pattern to remove the text in the tags we don't want # Regex pattern to remove the text in the tags we don't want
pattern = re.compile(r'<movie>.*?</movie>|<tv>.*?</tv>|<music>|</music>', re.IGNORECASE | re.DOTALL) pattern = re.compile(r'<movie>.*?</movie>|<tv>.*?</tv>|<music>|</music>', re.IGNORECASE | re.DOTALL)
else: else: