mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Change episodes older than 1970 may already exist.
Change compare file mtime as int to epoch. Change handle datetime_to_epoch error.
This commit is contained in:
parent
a74f022ea3
commit
f97dac58b7
1 changed files with 13 additions and 11 deletions
|
@ -2626,20 +2626,22 @@ class TVEpisode(object):
|
|||
hr, m = network_timezones.parse_time(self.show.airs)
|
||||
airtime = datetime.time(hr, m)
|
||||
|
||||
airdatetime = datetime.datetime.combine(self.airdate, airtime)
|
||||
aired_dt = datetime.datetime.combine(self.airdate, airtime)
|
||||
try:
|
||||
aired_epoch = helpers.datetime_to_epoch(aired_dt)
|
||||
filemtime = int(ek.ek(os.path.getmtime, self.location))
|
||||
except (StandardError, Exception):
|
||||
return
|
||||
|
||||
filemtime = datetime.datetime.fromtimestamp(ek.ek(os.path.getmtime, self.location))
|
||||
if filemtime != aired_epoch:
|
||||
|
||||
if filemtime != airdatetime:
|
||||
result, loglevel = 'Changed', logger.MESSAGE
|
||||
if not helpers.touch_file(self.location, aired_epoch):
|
||||
result, loglevel = 'Error changing', logger.WARNING
|
||||
|
||||
if helpers.touch_file(self.location, helpers.datetime_to_epoch(airdatetime)):
|
||||
logger.log('%s: Changed modify date of %s to show air date %s'
|
||||
% (self.show.indexerid, ek.ek(os.path.basename, self.location),
|
||||
airdatetime.strftime('%b %d,%Y (%H:%M)')))
|
||||
else:
|
||||
logger.log('%s: Error changing modify date of %s to show air date %s, Error: %s'
|
||||
% (self.show.indexerid, ek.ek(os.path.basename, self.location),
|
||||
airdatetime.strftime('%b %d,%Y (%H:%M)'), e.message), logger.WARNING)
|
||||
logger.log('%s: %s modify date of %s to show air date %s'
|
||||
% (self.show.indexerid, result, ek.ek(os.path.basename, self.location),
|
||||
aired_dt.strftime('%b %d,%Y (%H:%M)')), loglevel)
|
||||
|
||||
def __getstate__(self):
|
||||
d = dict(self.__dict__)
|
||||
|
|
Loading…
Reference in a new issue