Change add output to log when backlog hasn't run due to 'disable' setting (in case user wonders why backlog isn't running).

Change add clarity to backlog search setting display when backlog is disabled.
This commit is contained in:
JackDandy 2016-10-26 14:34:36 +01:00
parent 3ca199157a
commit b831b865b6
2 changed files with 22 additions and 22 deletions

View file

@ -104,9 +104,9 @@
<div class="field-pair" id="content_backlog_nofull"> <div class="field-pair" id="content_backlog_nofull">
<label> <label>
<span class="component-title">Backlog search spread</span> <span class="component-title"><em class="grey-text">Backlog search spread</em></span>
<span class="component-desc"> <span class="component-desc">
<p>&nbsp;^&nbsp; auto full backlog disabled</p> <p><em class="grey-text">to access this setting, unselect "<span class="boldest">Disable auto full backlog</span>" search above</em></p>
</span> </span>
</label> </label>
</div> </div>

View file

@ -136,11 +136,11 @@ class BacklogSearcher:
if i % parts == 0: if i % parts == 0:
p += 1 p += 1
cl.append(['INSERT INTO backlogparts (part, indexerid, indexer) VALUES (?,?,?)', cl.append(['INSERT INTO backlogparts (part, indexerid, indexer) VALUES (?,?,?)',
[p, s['indexerid'], s['indexer']]]) [p, s['indexerid'], s['indexer']]])
if 0 < len(cl): if 0 < len(cl):
my_db.mass_action(cl) my_db.mass_action(cl)
except: except (StandardError, Exception):
pass pass
def search_backlog(self, which_shows=None, force_type=NORMAL_BACKLOG, force=False): def search_backlog(self, which_shows=None, force_type=NORMAL_BACKLOG, force=False):
@ -157,13 +157,12 @@ class BacklogSearcher:
standard_backlog = True standard_backlog = True
now = datetime.datetime.now() now = datetime.datetime.now()
torrent_only = continued_backlog = False any_torrent_enabled = continued_backlog = False
if not force and standard_backlog and (datetime.datetime.now() - datetime.datetime.fromtimestamp( if not force and standard_backlog and (datetime.datetime.now() - datetime.datetime.fromtimestamp(
self._get_last_runtime())) < datetime.timedelta(hours=23): self._get_last_runtime())) < datetime.timedelta(hours=23):
if [x for x in sickbeard.providers.sortedProviderList() if x.is_active() and x.enable_backlog and any_torrent_enabled = any([x for x in sickbeard.providers.sortedProviderList() if x.is_active()
x.providerType == GenericProvider.TORRENT]: and x.enable_backlog and x.providerType == GenericProvider.TORRENT])
torrent_only = True if not any_torrent_enabled:
else:
logger.log('Last scheduled Backlog run was within the last day, skipping this run.', logger.DEBUG) logger.log('Last scheduled Backlog run was within the last day, skipping this run.', logger.DEBUG)
return return
@ -176,14 +175,17 @@ class BacklogSearcher:
limited_from_date = datetime.date.today() - datetime.timedelta(days=sickbeard.BACKLOG_DAYS) limited_from_date = datetime.date.today() - datetime.timedelta(days=sickbeard.BACKLOG_DAYS)
limited_backlog = False limited_backlog = False
if not which_shows and (torrent_only or sickbeard.BACKLOG_NOFULL): if standard_backlog and (any_torrent_enabled or sickbeard.BACKLOG_NOFULL):
logger.log(u'Running limited backlog for episodes missed during the last %s day(s)' % logger.log(u'Running limited backlog for episodes missed during the last %s day(s)' %
str(sickbeard.BACKLOG_DAYS)) str(sickbeard.BACKLOG_DAYS))
from_date = limited_from_date from_date = limited_from_date
limited_backlog = True limited_backlog = True
runparts = [] runparts = []
if standard_backlog and not torrent_only and not sickbeard.BACKLOG_NOFULL: if standard_backlog and not any_torrent_enabled and sickbeard.BACKLOG_NOFULL:
logger.log(u'Skipping automated full backlog search because it is disabled in search settings')
if standard_backlog and not any_torrent_enabled and not sickbeard.BACKLOG_NOFULL:
my_db = db.DBConnection('cache.db') my_db = db.DBConnection('cache.db')
sql_result = my_db.select('SELECT * FROM backlogparts WHERE part in (SELECT MIN(part) FROM backlogparts)') sql_result = my_db.select('SELECT * FROM backlogparts WHERE part in (SELECT MIN(part) FROM backlogparts)')
if sql_result: if sql_result:
@ -198,9 +200,7 @@ class BacklogSearcher:
continued_backlog = True continued_backlog = True
my_db.action('DELETE FROM backlogparts WHERE part = ?', [part_nr]) my_db.action('DELETE FROM backlogparts WHERE part = ?', [part_nr])
forced = False forced = standard_backlog and force_type != NORMAL_BACKLOG
if not which_shows and force_type != NORMAL_BACKLOG:
forced = True
wanted_list = [] wanted_list = []
for curShow in show_list: for curShow in show_list:
@ -211,7 +211,7 @@ class BacklogSearcher:
wanted_list.append(w) wanted_list.append(w)
parts = [] parts = []
if standard_backlog and not torrent_only and not continued_backlog and not sickbeard.BACKLOG_NOFULL: if standard_backlog and not any_torrent_enabled and not continued_backlog and not sickbeard.BACKLOG_NOFULL:
fullbacklogparts = sum([len(w) for w in wanted_list if w]) // sickbeard.BACKLOG_FREQUENCY fullbacklogparts = sum([len(w) for w in wanted_list if w]) // sickbeard.BACKLOG_FREQUENCY
h_part = [] h_part = []
counter = 0 counter = 0
@ -238,7 +238,7 @@ class BacklogSearcher:
wanted_list = [w for w in wanted_list if w and in_showlist(w.itervalues().next()[0].show, runparts)] wanted_list = [w for w in wanted_list if w and in_showlist(w.itervalues().next()[0].show, runparts)]
limited_wanted_list = [] limited_wanted_list = []
if standard_backlog and not torrent_only and runparts: if standard_backlog and not any_torrent_enabled and runparts:
for curShow in sickbeard.showList: for curShow in sickbeard.showList:
if not curShow.paused and not in_showlist(curShow, runparts): if not curShow.paused and not in_showlist(curShow, runparts):
w = wanted_episodes(curShow, limited_from_date, make_dict=True, w = wanted_episodes(curShow, limited_from_date, make_dict=True,
@ -246,11 +246,11 @@ class BacklogSearcher:
if w: if w:
limited_wanted_list.append(w) limited_wanted_list.append(w)
self.add_backlog_item(wanted_list, standard_backlog, limited_backlog, forced, torrent_only) self.add_backlog_item(wanted_list, standard_backlog, limited_backlog, forced, any_torrent_enabled)
if standard_backlog and not torrent_only and limited_wanted_list: if standard_backlog and not any_torrent_enabled and limited_wanted_list:
self.add_backlog_item(limited_wanted_list, standard_backlog, True, forced, torrent_only) self.add_backlog_item(limited_wanted_list, standard_backlog, True, forced, any_torrent_enabled)
if standard_backlog and not sickbeard.BACKLOG_NOFULL and not torrent_only and not continued_backlog: if standard_backlog and not sickbeard.BACKLOG_NOFULL and not any_torrent_enabled and not continued_backlog:
cl = ([], [['DELETE FROM backlogparts']])[len(parts) > 1] cl = ([], [['DELETE FROM backlogparts']])[len(parts) > 1]
for i, l in enumerate(parts): for i, l in enumerate(parts):
if 0 == i: if 0 == i:
@ -264,11 +264,11 @@ class BacklogSearcher:
# don't consider this an actual backlog search if we only did recent eps # don't consider this an actual backlog search if we only did recent eps
# or if we only did certain shows # or if we only did certain shows
if from_date == datetime.date.fromordinal(1) and not which_shows: if from_date == datetime.date.fromordinal(1) and standard_backlog:
self._set_last_backlog(cur_date) self._set_last_backlog(cur_date)
self._get_last_backlog() self._get_last_backlog()
if standard_backlog and not torrent_only: if standard_backlog and not any_torrent_enabled:
self._set_last_runtime(now) self._set_last_runtime(now)
self.amActive = False self.amActive = False