1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Catch error when speical charactor crashes email send

This commit is contained in:
luxmoggy 2014-12-15 12:38:02 +01:00
parent ed0e7e4716
commit 27daf8b46c

View File

@ -29,7 +29,7 @@ import sickbeard
from sickbeard import logger, common from sickbeard import logger, common
from sickbeard import db from sickbeard import db
from sickbeard import encodingKludge as ek from sickbeard.encodingKludge import toUnicode
from sickbeard.exceptions import ex from sickbeard.exceptions import ex
@ -51,7 +51,7 @@ class EmailNotifier:
ep_name: The name of the episode that was snatched ep_name: The name of the episode that was snatched
title: The title of the notification (optional) title: The title of the notification (optional)
""" """
ep_name = ek.ss(ep_name) ep_name = toUnicode(ep_name)
if sickbeard.EMAIL_NOTIFY_ONSNATCH: if sickbeard.EMAIL_NOTIFY_ONSNATCH:
show = self._parseEp(ep_name) show = self._parseEp(ep_name)
@ -68,7 +68,10 @@ class EmailNotifier:
1) + "</b></p>\n\n<footer style='margin-top: 2.5em; padding: .7em 0; color: #777; border-top: #BBB solid 1px;'>Powered by SickRage.</footer></body>", 1) + "</b></p>\n\n<footer style='margin-top: 2.5em; padding: .7em 0; color: #777; border-top: #BBB solid 1px;'>Powered by SickRage.</footer></body>",
'html')) 'html'))
except: except:
msg = MIMEText(ep_name) try:
msg = MIMEText(ep_name)
except:
msg = MIMEText("Episode Snatched")
msg['Subject'] = 'Snatched: ' + ep_name msg['Subject'] = 'Snatched: ' + ep_name
msg['From'] = sickbeard.EMAIL_FROM msg['From'] = sickbeard.EMAIL_FROM
@ -86,7 +89,7 @@ class EmailNotifier:
ep_name: The name of the episode that was downloaded ep_name: The name of the episode that was downloaded
title: The title of the notification (optional) title: The title of the notification (optional)
""" """
ep_name = ek.ss(ep_name) ep_name = toUnicode(ep_name)
if sickbeard.EMAIL_NOTIFY_ONDOWNLOAD: if sickbeard.EMAIL_NOTIFY_ONDOWNLOAD:
show = self._parseEp(ep_name) show = self._parseEp(ep_name)
@ -103,7 +106,10 @@ class EmailNotifier:
1) + "</b></p>\n\n<footer style='margin-top: 2.5em; padding: .7em 0; color: #777; border-top: #BBB solid 1px;'>Powered by SickRage.</footer></body>", 1) + "</b></p>\n\n<footer style='margin-top: 2.5em; padding: .7em 0; color: #777; border-top: #BBB solid 1px;'>Powered by SickRage.</footer></body>",
'html')) 'html'))
except: except:
msg = MIMEText(ep_name) try:
msg = MIMEText(ep_name)
except:
mag = 'Episode Downloaded'
msg['Subject'] = 'Downloaded: ' + ep_name msg['Subject'] = 'Downloaded: ' + ep_name
msg['From'] = sickbeard.EMAIL_FROM msg['From'] = sickbeard.EMAIL_FROM
@ -121,7 +127,7 @@ class EmailNotifier:
ep_name: The name of the episode that was downloaded ep_name: The name of the episode that was downloaded
lang: Subtitle language wanted lang: Subtitle language wanted
""" """
ep_name = ek.ss(ep_name) ep_name = toUnicode(ep_name)
if sickbeard.EMAIL_NOTIFY_ONSUBTITLEDOWNLOAD: if sickbeard.EMAIL_NOTIFY_ONSUBTITLEDOWNLOAD:
show = self._parseEp(ep_name) show = self._parseEp(ep_name)
@ -138,7 +144,10 @@ class EmailNotifier:
1) + "</b></p>\n<p>Language: <b>" + lang + "</b></p>\n\n<footer style='margin-top: 2.5em; padding: .7em 0; color: #777; border-top: #BBB solid 1px;'>Powered by SickRage.</footer></body>", 1) + "</b></p>\n<p>Language: <b>" + lang + "</b></p>\n\n<footer style='margin-top: 2.5em; padding: .7em 0; color: #777; border-top: #BBB solid 1px;'>Powered by SickRage.</footer></body>",
'html')) 'html'))
except: except:
msg = MIMEText(ep_name + ": " + lang) try:
msg = MIMEText(ep_name + ": " + lang)
except:
msg = "Episode Subtitle Downloaded"
msg['Subject'] = lang + ' Subtitle Downloaded: ' + ep_name msg['Subject'] = lang + ' Subtitle Downloaded: ' + ep_name
msg['From'] = sickbeard.EMAIL_FROM msg['From'] = sickbeard.EMAIL_FROM
@ -198,7 +207,7 @@ class EmailNotifier:
return False return False
def _parseEp(self, ep_name): def _parseEp(self, ep_name):
ep_name = ek.ss(ep_name) ep_name = toUnicode(ep_name)
sep = " - " sep = " - "
titles = ep_name.split(sep) titles = ep_name.split(sep)