mirror of
https://github.com/SickGear/SickGear.git
synced 2025-03-15 09:07:43 +00:00
Merge branch 'hotfix/0.13.13'
This commit is contained in:
commit
62dfcdd7ae
4 changed files with 31 additions and 4 deletions
|
@ -1,4 +1,10 @@
|
||||||
### 0.13.12 (2018-01-16 01:10:00 UTC)
|
### 0.13.13 (2018-01-19 00:45:00 UTC)
|
||||||
|
|
||||||
|
* Fix setting episode status when testing for if it should be deleted
|
||||||
|
* Restrict setting newly added old episodes to WANTED to the last 90 days, older are set to SKIPPED
|
||||||
|
|
||||||
|
|
||||||
|
### 0.13.12 (2018-01-16 01:10:00 UTC)
|
||||||
|
|
||||||
* Remove provider TorrentVault
|
* Remove provider TorrentVault
|
||||||
|
|
||||||
|
|
|
@ -1520,7 +1520,7 @@ def set_file_timestamp(filename, min_age=3, new_time=None):
|
||||||
|
|
||||||
|
|
||||||
def should_delete_episode(status):
|
def should_delete_episode(status):
|
||||||
s = Quality.splitCompositeStatus(status)
|
s = Quality.splitCompositeStatus(status)[0]
|
||||||
if s not in SNATCHED_ANY + [DOWNLOADED, ARCHIVED, IGNORED]:
|
if s not in SNATCHED_ANY + [DOWNLOADED, ARCHIVED, IGNORED]:
|
||||||
return True
|
return True
|
||||||
logger.log('not safe to delete episode from db because of status: %s' % statusStrings[s], logger.DEBUG)
|
logger.log('not safe to delete episode from db because of status: %s' % statusStrings[s], logger.DEBUG)
|
||||||
|
|
|
@ -2005,11 +2005,13 @@ class TVEpisode(object):
|
||||||
if self.status in [SKIPPED, UNAIRED, UNKNOWN, WANTED]:
|
if self.status in [SKIPPED, UNAIRED, UNKNOWN, WANTED]:
|
||||||
today = datetime.date.today()
|
today = datetime.date.today()
|
||||||
delta = datetime.timedelta(days=1)
|
delta = datetime.timedelta(days=1)
|
||||||
|
very_old_delta = datetime.timedelta(days=90)
|
||||||
show_time = network_timezones.parse_date_time(self.airdate.toordinal(), self.show.airs, self.show.network)
|
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))
|
show_length = datetime.timedelta(minutes=helpers.tryInt(self.show.runtime, 60))
|
||||||
tz_now = datetime.datetime.now(network_timezones.sb_timezone)
|
tz_now = datetime.datetime.now(network_timezones.sb_timezone)
|
||||||
future_airtime = (self.airdate > (today + delta) or
|
future_airtime = (self.airdate > (today + delta) or
|
||||||
(not self.airdate < (today - delta) and ((show_time + show_length) > tz_now)))
|
(not self.airdate < (today - delta) and ((show_time + show_length) > tz_now)))
|
||||||
|
very_old_airdate = datetime.date.fromordinal(1) < self.airdate < (today - very_old_delta)
|
||||||
|
|
||||||
# if this episode hasn't aired yet set the status to UNAIRED
|
# if this episode hasn't aired yet set the status to UNAIRED
|
||||||
if future_airtime:
|
if future_airtime:
|
||||||
|
@ -2029,7 +2031,7 @@ class TVEpisode(object):
|
||||||
msg = ('Episode status %s%s, with air date in the past, marking it ' % (
|
msg = ('Episode status %s%s, with air date in the past, marking it ' % (
|
||||||
statusStrings[self.status], ','.join([(' is a special', '')[0 < self.season],
|
statusStrings[self.status], ','.join([(' is a special', '')[0 < self.season],
|
||||||
('', ' is paused')[self.show.paused]])) + '%s')
|
('', ' is paused')[self.show.paused]])) + '%s')
|
||||||
self.status = (SKIPPED, WANTED)[0 < self.season and not self.show.paused]
|
self.status = (SKIPPED, WANTED)[0 < self.season and not self.show.paused and not very_old_airdate]
|
||||||
|
|
||||||
# if still UNKNOWN or SKIPPED with the deprecated future airdate method
|
# if still UNKNOWN or SKIPPED with the deprecated future airdate method
|
||||||
elif UNKNOWN == self.status or (SKIPPED == self.status and old_airdate_future):
|
elif UNKNOWN == self.status or (SKIPPED == self.status and old_airdate_future):
|
||||||
|
@ -2037,7 +2039,8 @@ class TVEpisode(object):
|
||||||
statusStrings[self.status], ','.join([
|
statusStrings[self.status], ','.join([
|
||||||
('', ' has old future date format')[SKIPPED == self.status and old_airdate_future],
|
('', ' has old future date format')[SKIPPED == self.status and old_airdate_future],
|
||||||
('', ' is being updated')[bool(update)], (' is a special', '')[0 < self.season]])) + '%s')
|
('', ' is being updated')[bool(update)], (' is a special', '')[0 < self.season]])) + '%s')
|
||||||
self.status = (SKIPPED, WANTED)[update and not self.show.paused and 0 < self.season]
|
self.status = (SKIPPED, WANTED)[update and not self.show.paused and 0 < self.season
|
||||||
|
and not very_old_airdate]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
msg = 'Not touching episode status %s, with air date in the past, because there is no file'
|
msg = 'Not touching episode status %s, with air date in the past, because there is no file'
|
||||||
|
|
|
@ -3,6 +3,7 @@ import sys
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
from sickbeard import helpers
|
from sickbeard import helpers
|
||||||
|
from sickbeard.common import ARCHIVED, SNATCHED, SNATCHED_BEST, SNATCHED_PROPER, DOWNLOADED, SKIPPED, IGNORED, UNAIRED, UNKNOWN, WANTED, Quality
|
||||||
|
|
||||||
|
|
||||||
sys.path.insert(1, os.path.abspath('..'))
|
sys.path.insert(1, os.path.abspath('..'))
|
||||||
|
@ -37,6 +38,23 @@ class HelpersTests(unittest.TestCase):
|
||||||
for test_name, test_result in test_names.items():
|
for test_name, test_result in test_names.items():
|
||||||
self.assertEqual(test_result, helpers.remove_non_release_groups(test_name[0], test_name[1]))
|
self.assertEqual(test_result, helpers.remove_non_release_groups(test_name[0], test_name[1]))
|
||||||
|
|
||||||
|
def test_should_delete_episode(self):
|
||||||
|
test_cases = [
|
||||||
|
((SNATCHED, Quality.HDTV), False),
|
||||||
|
((SNATCHED_PROPER, Quality.HDTV), False),
|
||||||
|
((SNATCHED_BEST, Quality.HDTV), False),
|
||||||
|
((DOWNLOADED, Quality.HDTV), False),
|
||||||
|
((ARCHIVED, Quality.HDTV), False),
|
||||||
|
((ARCHIVED, Quality.NONE), False),
|
||||||
|
((SKIPPED, Quality.NONE), True),
|
||||||
|
((IGNORED, Quality.NONE), False),
|
||||||
|
((UNAIRED, Quality.NONE), True),
|
||||||
|
((UNKNOWN, Quality.NONE), True),
|
||||||
|
((WANTED, Quality.NONE), True),
|
||||||
|
]
|
||||||
|
for c, b in test_cases:
|
||||||
|
self.assertEqual(helpers.should_delete_episode(Quality.compositeStatus(*c)), b)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
suite = unittest.TestLoader().loadTestsFromTestCase(HelpersTests)
|
suite = unittest.TestLoader().loadTestsFromTestCase(HelpersTests)
|
||||||
|
|
Loading…
Reference in a new issue