Merge pull request #777 from JackDandy/feature/FixStatusReset

Fix status reset of a snatched, downloaded, or archived episode when …
This commit is contained in:
JackDandy 2016-09-24 03:40:56 +01:00 committed by GitHub
commit 4a4afdaa01
2 changed files with 26 additions and 21 deletions

View file

@ -164,6 +164,8 @@
* Change when using "Add new show" reduce search time outs
* Change always allow incomplete show data
* Remove redundant config/general/"Allow incomplete show data"
* Fix status reset of a snatched, downloaded, or archived episode when its date is set to never (no date) on the info
source and there is no media file
[develop changelog]
* Change send nzb data to NZBGet for Anizb instead of url

View file

@ -1836,6 +1836,7 @@ class TVEpisode(object):
# if we don't have the file
if not ek.ek(os.path.isfile, self.location):
if self.status in [SKIPPED, UNAIRED, UNKNOWN, WANTED]:
today = datetime.date.today()
delta = datetime.timedelta(days=1)
show_time = network_timezones.parse_date_time(self.airdate.toordinal(), self.show.airs, self.show.network)
@ -1845,7 +1846,7 @@ class TVEpisode(object):
(not self.airdate < (today - delta) and ((show_time + show_length) > tz_now)))
# if this episode hasn't aired yet set the status to UNAIRED
if future_airtime and self.status in [SKIPPED, UNAIRED, UNKNOWN, WANTED]:
if future_airtime:
msg = 'Episode airs in the future, marking it %s'
self.status = UNAIRED
@ -1858,8 +1859,7 @@ class TVEpisode(object):
self.status = UNAIRED
# if the airdate is in the past
else:
if UNAIRED == self.status:
elif UNAIRED == self.status:
msg = ('Episode status %s%s, with air date in the past, marking it ' % (
statusStrings[self.status], ','.join([(' is a special', '')[0 < self.season],
('', ' is paused')[self.show.paused]])) + '%s')
@ -1876,6 +1876,9 @@ class TVEpisode(object):
else:
msg = 'Not touching episode status %s, with air date in the past, because there is no file'
else:
msg = 'Not touching episode status %s, because there is no file'
logger.log(msg % statusStrings[self.status], logger.DEBUG)
# if we have a media file then it's downloaded