Merge pull request #1140 from luxmoggy/develop

Catches error from set file date and email when they have special charactors in them
This commit is contained in:
echel0n 2014-12-17 18:46:49 -08:00
commit b2d5ef531b
2 changed files with 24 additions and 6 deletions

View File

@ -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>",
'html'))
except:
msg = MIMEText(ep_name)
try:
msg = MIMEText(ep_name)
except:
msg = MIMEText("Episode Snatched")
msg['Subject'] = 'Snatched: ' + ep_name
msg['From'] = sickbeard.EMAIL_FROM
@ -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>",
'html'))
except:
msg = MIMEText(ep_name)
try:
msg = MIMEText(ep_name)
except:
mag = 'Episode Downloaded'
msg['Subject'] = 'Downloaded: ' + ep_name
msg['From'] = sickbeard.EMAIL_FROM
@ -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>",
'html'))
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['From'] = sickbeard.EMAIL_FROM

View File

@ -2498,9 +2498,18 @@ class TVEpisode(object):
import time
airdatetime = airdatetime.timetuple()
if helpers.touchFile(self.location, time.mktime(airdatetime)):
logger.log(str(self.show.indexerid) + u": Changed modify date of " + os.path.basename(self.location)
+ " to show air date " + time.strftime("%b %d,%Y (%H:%M)", airdatetime))
logger.log(str(self.show.indexerid) + u": About to modify date of '" + self.location
+ "' to show air date " + time.strftime("%b %d,%Y (%H:%M)", airdatetime), logger.DEBUG)
try:
if helpers.touchFile(self.location, time.mktime(airdatetime)):
logger.log(str(self.show.indexerid) + u": Changed modify date of " + os.path.basename(self.location)
+ " to show air date " + time.strftime("%b %d,%Y (%H:%M)", airdatetime))
else:
logger.log(str(self.show.indexerid) + u": Unable to modify date of " + os.path.basename(self.location)
+ " to show air date " + time.strftime("%b %d,%Y (%H:%M)", airdatetime), logger.ERROR)
except:
logger.log(str(self.show.indexerid) + u": Failed to modify date of '" + os.path.basename(self.location)
+ "' to show air date " + time.strftime("%b %d,%Y (%H:%M)", airdatetime), logger.ERROR)
def __getstate__(self):
d = dict(self.__dict__)