1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-08-13 16:53:54 -04:00

Catch error when setting file date

This commit is contained in:
luxmoggy 2014-12-15 12:26:10 +01:00
parent 0bf673e57c
commit ed0e7e4716

View File

@ -2498,9 +2498,18 @@ class TVEpisode(object):
import time import time
airdatetime = airdatetime.timetuple() airdatetime = airdatetime.timetuple()
if helpers.touchFile(self.location, time.mktime(airdatetime)): logger.log(str(self.show.indexerid) + u": About to modify date of '" + self.location
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.DEBUG)
+ " to show air date " + time.strftime("%b %d,%Y (%H:%M)", airdatetime)) 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): def __getstate__(self):
d = dict(self.__dict__) d = dict(self.__dict__)