Added ability to set number of days to start backlog searches from, eg 7 days would search for episodes 7 days and older

This commit is contained in:
echel0n 2014-09-15 01:57:50 -07:00
parent 67bd1a9e98
commit 417047f590
5 changed files with 27 additions and 6 deletions

View File

@ -66,6 +66,17 @@
</div>
</div>
<div class="field-pair">
<label class="nocheck clearfix">
<span class="component-title">Backlog Search Day(s)</span>
<input type="text" name="backlog_days" value="$sickbeard.BACKLOG_DAYS" size="5" />
</label>
<label class="nocheck clearfix">
<span class="component-title">&nbsp;</span>
<span class="component-desc">Day(s) to search from (eg. 7)</span>
</label>
</div>
<div class="field-pair">
<label class="nocheck clearfix">
<span class="component-title">Backlog Search Frequency</span>

View File

@ -205,6 +205,8 @@ DEFAULT_BACKLOG_FREQUENCY = 10080
DEFAULT_DAILYSEARCH_FREQUENCY = 60
DEFAULT_UPDATE_FREQUENCY = 1
BACKLOG_DAYS = 7
ADD_SHOWS_WO_DIR = False
CREATE_MISSING_SHOW_DIRS = False
RENAME_EPISODES = False
@ -488,7 +490,7 @@ def initialize(consoleLogging=True):
USE_FAILED_DOWNLOADS, DELETE_FAILED, ANON_REDIRECT, LOCALHOST_IP, TMDB_API_KEY, DEBUG, PROXY_SETTING, \
AUTOPOSTPROCESSER_FREQUENCY, DEFAULT_AUTOPOSTPROCESSER_FREQUENCY, MIN_AUTOPOSTPROCESSER_FREQUENCY, \
ANIME_DEFAULT, NAMING_ANIME, ANIMESUPPORT, USE_ANIDB, ANIDB_USERNAME, ANIDB_PASSWORD, ANIDB_USE_MYLIST, \
ANIME_SPLIT_HOME, SCENE_DEFAULT, PLAY_VIDEOS
ANIME_SPLIT_HOME, SCENE_DEFAULT, PLAY_VIDEOS, BACKLOG_DAYS
if __INITIALIZED__:
return False
@ -669,6 +671,8 @@ def initialize(consoleLogging=True):
if UPDATE_FREQUENCY < MIN_UPDATE_FREQUENCY:
UPDATE_FREQUENCY = MIN_UPDATE_FREQUENCY
BACKLOG_DAYS = check_setting_int(CFG, 'General', 'backlog_days', 7)
NZB_DIR = check_setting_str(CFG, 'Blackhole', 'nzb_dir', '')
TORRENT_DIR = check_setting_str(CFG, 'Blackhole', 'torrent_dir', '')
@ -1403,6 +1407,8 @@ def save_config():
new_config['General']['metadata_tivo'] = METADATA_TIVO
new_config['General']['metadata_mede8er'] = METADATA_MEDE8ER
new_config['General']['backlog_days'] = int(BACKLOG_DAYS)
new_config['General']['cache_dir'] = ACTUAL_CACHE_DIR if ACTUAL_CACHE_DIR else 'cache'
new_config['General']['root_dirs'] = ROOT_DIRS if ROOT_DIRS else ''
new_config['General']['tv_download_dir'] = TV_DOWNLOAD_DIR

View File

@ -40,7 +40,7 @@ class DailySearcher():
self.amActive = True
logger.log(u"Searching for coming episodes and 1 weeks worth of previously WANTED episodes ...")
logger.log(u"Searching for new released episodes ...")
curDate = datetime.date.today().toordinal()
@ -71,6 +71,8 @@ class DailySearcher():
wantedEp[show].append(ep)
sql_l.append(ep.get_sql())
else:
logger.log(u"No new released episodes found ...")
if len(sql_l) > 0:
myDB = db.DBConnection()

View File

@ -85,8 +85,8 @@ class BacklogSearcher:
fromDate = datetime.date.fromordinal(1)
if not which_shows and not curDate - self._lastBacklog >= self.cycleTime:
logger.log(u"Running limited backlog on recently missed episodes only")
fromDate = datetime.date.today() - datetime.timedelta(days=7)
logger.log(u"Running limited backlog on missed episodes " + sickbeard.BACKLOG_DAYS + " day(s) and older only")
fromDate = datetime.date.today() - datetime.timedelta(days=sickbeard.BACKLOG_DAYS)
self.amActive = True
self.amPaused = False

View File

@ -1617,8 +1617,8 @@ class ConfigSearch(MainHandler):
def saveSearch(self, use_nzbs=None, use_torrents=None, nzb_dir=None, sab_username=None, sab_password=None,
sab_apikey=None, sab_category=None, sab_host=None, nzbget_username=None, nzbget_password=None,
nzbget_category=None, nzbget_priority=100, nzbget_host=None, nzbget_use_https=None,
dailysearch_frequency=None,
nzb_method=None, torrent_method=None, usenet_retention=None, backlog_frequency=None,
backlog_days=None, backlog_frequency=None, dailysearch_frequency=None,
nzb_method=None, torrent_method=None, usenet_retention=None,
download_propers=None, check_propers_interval=None, allow_high_priority=None,
backlog_startup=None, dailysearch_startup=None,
torrent_dir=None, torrent_username=None, torrent_password=None, torrent_host=None,
@ -1633,6 +1633,8 @@ class ConfigSearch(MainHandler):
if not config.change_TORRENT_DIR(torrent_dir):
results += ["Unable to create directory " + os.path.normpath(torrent_dir) + ", dir not changed."]
sickbeard.BACKLOG_DAYS = config.to_int(backlog_days, default=7)
config.change_DAILYSEARCH_FREQUENCY(dailysearch_frequency)
config.change_BACKLOG_FREQUENCY(backlog_frequency)