mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-03 18:03:37 +00:00
Merge pull request #777 from JackDandy/feature/FixStatusReset
Fix status reset of a snatched, downloaded, or archived episode when …
This commit is contained in:
commit
4a4afdaa01
2 changed files with 26 additions and 21 deletions
|
@ -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
|
||||
|
|
|
@ -1836,30 +1836,30 @@ class TVEpisode(object):
|
|||
# if we don't have the file
|
||||
if not ek.ek(os.path.isfile, self.location):
|
||||
|
||||
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)
|
||||
show_length = datetime.timedelta(minutes=helpers.tryInt(self.show.runtime, 60))
|
||||
tz_now = datetime.datetime.now(network_timezones.sb_timezone)
|
||||
future_airtime = (self.airdate > (today + delta) or
|
||||
(not self.airdate < (today - delta) and ((show_time + show_length) > tz_now)))
|
||||
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)
|
||||
show_length = datetime.timedelta(minutes=helpers.tryInt(self.show.runtime, 60))
|
||||
tz_now = datetime.datetime.now(network_timezones.sb_timezone)
|
||||
future_airtime = (self.airdate > (today + delta) or
|
||||
(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]:
|
||||
msg = 'Episode airs in the future, marking it %s'
|
||||
self.status = UNAIRED
|
||||
|
||||
# if there's no airdate then set it to unaired (and respect ignored)
|
||||
elif self.airdate == datetime.date.fromordinal(1):
|
||||
if IGNORED == self.status:
|
||||
msg = 'Episode has no air date and marked %s, no change'
|
||||
else:
|
||||
msg = 'Episode has no air date, marking it %s'
|
||||
# if this episode hasn't aired yet set the status to UNAIRED
|
||||
if future_airtime:
|
||||
msg = 'Episode airs in the future, marking it %s'
|
||||
self.status = UNAIRED
|
||||
|
||||
# if the airdate is in the past
|
||||
else:
|
||||
if UNAIRED == self.status:
|
||||
# if there's no airdate then set it to unaired (and respect ignored)
|
||||
elif self.airdate == datetime.date.fromordinal(1):
|
||||
if IGNORED == self.status:
|
||||
msg = 'Episode has no air date and marked %s, no change'
|
||||
else:
|
||||
msg = 'Episode has no air date, marking it %s'
|
||||
self.status = UNAIRED
|
||||
|
||||
# if the airdate is in the past
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue