From ed0e7e47168aa297458ead10b9f98d7e893f0aca Mon Sep 17 00:00:00 2001 From: luxmoggy Date: Mon, 15 Dec 2014 12:26:10 +0100 Subject: [PATCH] Catch error when setting file date --- sickbeard/tv.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sickbeard/tv.py b/sickbeard/tv.py index 0efde9bb..8265690e 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -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__)