Fix Backlog Init

Fix the limited backlog to execute as and when expected and in line with SickBeard.

The backlog scheduled frequency is the higher of either 12 hours or 2 x the "Recent search frequency" + 7 minutes.

On application startup and every backlog scheduled frequency the backlog will either ...
a) do a full run if the number of days passed since the full backlog has reached the setting(1)...
b) do a limited run if the number of days passed since the full backlog is less than setting(1)...
... (1) "Backlog search frequency" in Search Settings.

Change the default full "Backlog search frequency" to 21 days within a range of 2 - 35 (see Search Settings).
This commit is contained in:
Prinz23 2015-04-09 19:24:35 +02:00
parent a6274c5910
commit 53f272515a
6 changed files with 18 additions and 18 deletions

View file

@ -1,6 +1,7 @@
### 0.x.x (2015-xx-xx xx:xx:xx UTC)
### 0.x.x (2015-xx-xx xx:xx:xx UTC)
* Add ToTV provider
* Fix Backlog scheduler initialization and change backlog frequency from minutes to days
### 0.8.1 (2015-04-15 04:16:00 UTC)

View file

@ -95,7 +95,7 @@
<span class="component-title">Backlog search frequency</span>
<span class="component-desc">
<input type="text" name="backlog_frequency" value="$sickbeard.BACKLOG_FREQUENCY" class="form-control input-sm input75">
<p>minutes between searches (minimum $sickbeard.MIN_BACKLOG_FREQUENCY)</p>
<p>days between full backlog searches (min $sickbeard.MIN_BACKLOG_FREQUENCY, default $sickbeard.DEFAULT_BACKLOG_FREQUENCY, max $sickbeard.MAX_BACKLOG_FREQUENCY)</p>
</span>
</label>
</div>

View file

@ -62,6 +62,7 @@
%>&nbsp;/&nbsp;<span class="footerhighlight">$ep_total</span> episodes downloaded $ep_percentage
| recent search: <span class="footerhighlight"><%= str(sickbeard.recentSearchScheduler.timeLeft()).split('.')[0] %></span>
| backlog search: <span class="footerhighlight"><%= str(sickbeard.backlogSearchScheduler.timeLeft()).split('.')[0] %></span>
| full backlog: <span class="footerhighlight"><%= sbdatetime.sbdatetime.sbfdate(sickbeard.backlogSearchScheduler.nextRun()) %></span>
#slurp
</div>
</footer>

View file

@ -60,7 +60,7 @@ CFG = None
CONFIG_FILE = None
# This is the version of the config we EXPECT to find
CONFIG_VERSION = 9
CONFIG_VERSION = 10
# Default encryption version (0 for None)
ENCRYPTION_VERSION = 0
@ -220,7 +220,8 @@ DEFAULT_UPDATE_FREQUENCY = 1
MIN_AUTOPOSTPROCESSER_FREQUENCY = 1
MIN_RECENTSEARCH_FREQUENCY = 10
MIN_BACKLOG_FREQUENCY = 10
MIN_BACKLOG_FREQUENCY = 2
MAX_BACKLOG_FREQUENCY = 35
MIN_UPDATE_FREQUENCY = 1
BACKLOG_DAYS = 7
@ -496,7 +497,7 @@ def initialize(consoleLogging=True):
USE_KODI, KODI_ALWAYS_ON, KODI_NOTIFY_ONSNATCH, KODI_NOTIFY_ONDOWNLOAD, KODI_NOTIFY_ONSUBTITLEDOWNLOAD, KODI_UPDATE_FULL, KODI_UPDATE_ONLYFIRST, KODI_UPDATE_LIBRARY, KODI_HOST, KODI_USERNAME, KODI_PASSWORD, \
USE_TRAKT, TRAKT_USERNAME, TRAKT_PASSWORD, TRAKT_API, TRAKT_REMOVE_WATCHLIST, TRAKT_USE_WATCHLIST, TRAKT_METHOD_ADD, TRAKT_START_PAUSED, traktCheckerScheduler, TRAKT_USE_RECOMMENDED, TRAKT_SYNC, TRAKT_DEFAULT_INDEXER, TRAKT_REMOVE_SERIESLIST, \
USE_PLEX, PLEX_NOTIFY_ONSNATCH, PLEX_NOTIFY_ONDOWNLOAD, PLEX_NOTIFY_ONSUBTITLEDOWNLOAD, PLEX_UPDATE_LIBRARY, \
PLEX_SERVER_HOST, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, DEFAULT_BACKLOG_FREQUENCY, MIN_BACKLOG_FREQUENCY, BACKLOG_STARTUP, SKIP_REMOVED_FILES, \
PLEX_SERVER_HOST, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, DEFAULT_BACKLOG_FREQUENCY, MIN_BACKLOG_FREQUENCY, MAX_BACKLOG_FREQUENCY, BACKLOG_STARTUP, SKIP_REMOVED_FILES, \
showUpdateScheduler, __INITIALIZED__, LAUNCH_BROWSER, TRASH_REMOVE_SHOW, TRASH_ROTATE_LOGS, HOME_SEARCH_FOCUS, SORT_ARTICLE, showList, loadingShowList, UPDATE_SHOWS_ON_START, SHOW_UPDATE_HOUR, \
NEWZNAB_DATA, NZBS, NZBS_UID, NZBS_HASH, INDEXER_DEFAULT, INDEXER_TIMEOUT, USENET_RETENTION, TORRENT_DIR, \
QUALITY_DEFAULT, FLATTEN_FOLDERS_DEFAULT, SUBTITLES_DEFAULT, STATUS_DEFAULT, WANTED_BEGIN_DEFAULT, WANTED_LATEST_DEFAULT, RECENTSEARCH_STARTUP, \
@ -727,10 +728,8 @@ def initialize(consoleLogging=True):
if RECENTSEARCH_FREQUENCY < MIN_RECENTSEARCH_FREQUENCY:
RECENTSEARCH_FREQUENCY = MIN_RECENTSEARCH_FREQUENCY
MIN_BACKLOG_FREQUENCY = get_backlog_cycle_time()
BACKLOG_FREQUENCY = check_setting_int(CFG, 'General', 'backlog_frequency', DEFAULT_BACKLOG_FREQUENCY)
if BACKLOG_FREQUENCY < MIN_BACKLOG_FREQUENCY:
BACKLOG_FREQUENCY = MIN_BACKLOG_FREQUENCY
BACKLOG_FREQUENCY = minimax(BACKLOG_FREQUENCY, DEFAULT_BACKLOG_FREQUENCY, MIN_BACKLOG_FREQUENCY, MAX_BACKLOG_FREQUENCY)
UPDATE_FREQUENCY = check_setting_int(CFG, 'General', 'update_frequency', DEFAULT_UPDATE_FREQUENCY)
if UPDATE_FREQUENCY < MIN_UPDATE_FREQUENCY:
@ -1173,9 +1172,8 @@ def initialize(consoleLogging=True):
run_delay=update_now if RECENTSEARCH_STARTUP
else datetime.timedelta(minutes=5))
update_interval = datetime.timedelta(minutes=BACKLOG_FREQUENCY)
backlogSearchScheduler = searchBacklog.BacklogSearchScheduler(searchBacklog.BacklogSearcher(),
cycleTime=update_interval,
cycleTime=datetime.timedelta(minutes=get_backlog_cycle_time()),
threadName="BACKLOG",
run_delay=update_now if BACKLOG_STARTUP
else datetime.timedelta(minutes=10))

View file

@ -164,13 +164,9 @@ def change_RECENTSEARCH_FREQUENCY(freq):
def change_BACKLOG_FREQUENCY(freq):
sickbeard.BACKLOG_FREQUENCY = to_int(freq, default=sickbeard.DEFAULT_BACKLOG_FREQUENCY)
sickbeard.BACKLOG_FREQUENCY = minimax(freq, sickbeard.DEFAULT_BACKLOG_FREQUENCY, sickbeard.MIN_BACKLOG_FREQUENCY, sickbeard.MAX_BACKLOG_FREQUENCY)
sickbeard.MIN_BACKLOG_FREQUENCY = sickbeard.get_backlog_cycle_time()
if sickbeard.BACKLOG_FREQUENCY < sickbeard.MIN_BACKLOG_FREQUENCY:
sickbeard.BACKLOG_FREQUENCY = sickbeard.MIN_BACKLOG_FREQUENCY
sickbeard.backlogSearchScheduler.cycleTime = datetime.timedelta(minutes=sickbeard.BACKLOG_FREQUENCY)
sickbeard.backlogSearchScheduler.action.cycleTime = sickbeard.BACKLOG_FREQUENCY
def change_UPDATE_FREQUENCY(freq):
@ -740,4 +736,8 @@ class ConfigMigrator():
def _migrate_v9(self):
sickbeard.PUSHBULLET_ACCESS_TOKEN = check_setting_str(self.config_obj, 'Pushbullet', 'pushbullet_api', '')
sickbeard.PUSHBULLET_DEVICE_IDEN = check_setting_str(self.config_obj, 'Pushbullet', 'pushbullet_device', '')
sickbeard.PUSHBULLET_DEVICE_IDEN = check_setting_str(self.config_obj, 'Pushbullet', 'pushbullet_device', '')
def _migrate_v10(self):
# reset backlog frequency to default
sickbeard.BACKLOG_FREQUENCY = sickbeard.DEFAULT_BACKLOG_FREQUENCY

View file

@ -48,7 +48,7 @@ class BacklogSearcher:
def __init__(self):
self._lastBacklog = self._get_lastBacklog()
self.cycleTime = sickbeard.BACKLOG_FREQUENCY / 60 / 24
self.cycleTime = sickbeard.BACKLOG_FREQUENCY
self.lock = threading.Lock()
self.amActive = False
self.amPaused = False