1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-13 19:42:20 -05:00

Added in seperate interval settings for backlog and rss updates

This commit is contained in:
echel0n 2014-05-12 03:34:18 -07:00
parent 1d01d2bc52
commit 8f2663da55
4 changed files with 46 additions and 26 deletions

View File

@ -45,10 +45,21 @@
</label> </label>
</div> </div>
<div class="field-pair">
<label class="nocheck clearfix">
<span class="component-title">Backlog Search Frequency</span>
<input type="text" name="backlog_frequency" value="$sickbeard.BACKLOG_FREQUENCY" size="5" />
</label>
<label class="nocheck clearfix">
<span class="component-title">&nbsp;</span>
<span class="component-desc">Time in minutes between searches (eg. 60)</span>
</label>
</div>
<div class="field-pair"> <div class="field-pair">
<label class="nocheck clearfix"> <label class="nocheck clearfix">
<span class="component-title">RSS Cache Update Frequency</span> <span class="component-title">RSS Cache Update Frequency</span>
<input type="text" name="search_frequency" value="$sickbeard.SEARCH_FREQUENCY" size="5" /> <input type="text" name="rssupdate_frequency" value="$sickbeard.RSSUPDATE_FREQUENCY" size="5" />
</label> </label>
<label class="nocheck clearfix"> <label class="nocheck clearfix">
<span class="component-title">&nbsp;</span> <span class="component-title">&nbsp;</span>

View File

@ -173,9 +173,9 @@ DOWNLOAD_PROPERS = None
PREFER_EPISODE_RELEASES = None PREFER_EPISODE_RELEASES = None
ALLOW_HIGH_PRIORITY = None ALLOW_HIGH_PRIORITY = None
SEARCH_FREQUENCY = None RSSUPDATE_FREQUENCY = None
UPDATE_FREQUENCY = None UPDATE_FREQUENCY = None
BACKLOG_SEARCH_FREQUENCY = 21 BACKLOG_FREQUENCY = 21
BACKLOG_STARTUP = None BACKLOG_STARTUP = None
MIN_SEARCH_FREQUENCY = 10 MIN_SEARCH_FREQUENCY = 10
@ -479,11 +479,6 @@ TMDB_API_KEY = 'edc5f123313769de83a71e157758030b'
__INITIALIZED__ = False __INITIALIZED__ = False
def get_backlog_cycle_time():
cycletime = SEARCH_FREQUENCY * 2 + 7
return max([cycletime, 720])
def initialize(consoleLogging=True): def initialize(consoleLogging=True):
with INIT_LOCK: with INIT_LOCK:
@ -501,7 +496,7 @@ def initialize(consoleLogging=True):
NEWZNAB_DATA, NZBS, NZBS_UID, NZBS_HASH, EZRSS, TVTORRENTS, TVTORRENTS_DIGEST, TVTORRENTS_HASH, TVTORRENTS_OPTIONS, BTN, BTN_API_KEY, BTN_OPTIONS, \ NEWZNAB_DATA, NZBS, NZBS_UID, NZBS_HASH, EZRSS, TVTORRENTS, TVTORRENTS_DIGEST, TVTORRENTS_HASH, TVTORRENTS_OPTIONS, BTN, BTN_API_KEY, BTN_OPTIONS, \
THEPIRATEBAY, THEPIRATEBAY_TRUSTED, THEPIRATEBAY_PROXY, THEPIRATEBAY_PROXY_URL, THEPIRATEBAY_BLACKLIST, THEPIRATEBAY_OPTIONS, TORRENTLEECH, TORRENTLEECH_USERNAME, TORRENTLEECH_PASSWORD, TORRENTLEECH_OPTIONS, \ THEPIRATEBAY, THEPIRATEBAY_TRUSTED, THEPIRATEBAY_PROXY, THEPIRATEBAY_PROXY_URL, THEPIRATEBAY_BLACKLIST, THEPIRATEBAY_OPTIONS, TORRENTLEECH, TORRENTLEECH_USERNAME, TORRENTLEECH_PASSWORD, TORRENTLEECH_OPTIONS, \
IPTORRENTS, IPTORRENTS_USERNAME, IPTORRENTS_PASSWORD, IPTORRENTS_FREELEECH, IPTORRENTS_OPTIONS, KAT, KAT_VERIFIED, KAT_OPTIONS, PUBLICHD, PUBLICHD_OPTIONS, SCC, SCC_USERNAME, SCC_PASSWORD, SCC_OPTIONS, HDTORRENTS, HDTORRENTS_USERNAME, HDTORRENTS_PASSWORD, HDTORRENTS_UID, HDTORRENTS_HASH, HDTORRENTS_OPTIONS, TORRENTDAY, TORRENTDAY_USERNAME, TORRENTDAY_PASSWORD, TORRENTDAY_UID, TORRENTDAY_HASH, TORRENTDAY_FREELEECH, TORRENTDAY_OPTIONS, \ IPTORRENTS, IPTORRENTS_USERNAME, IPTORRENTS_PASSWORD, IPTORRENTS_FREELEECH, IPTORRENTS_OPTIONS, KAT, KAT_VERIFIED, KAT_OPTIONS, PUBLICHD, PUBLICHD_OPTIONS, SCC, SCC_USERNAME, SCC_PASSWORD, SCC_OPTIONS, HDTORRENTS, HDTORRENTS_USERNAME, HDTORRENTS_PASSWORD, HDTORRENTS_UID, HDTORRENTS_HASH, HDTORRENTS_OPTIONS, TORRENTDAY, TORRENTDAY_USERNAME, TORRENTDAY_PASSWORD, TORRENTDAY_UID, TORRENTDAY_HASH, TORRENTDAY_FREELEECH, TORRENTDAY_OPTIONS, \
HDBITS, HDBITS_USERNAME, HDBITS_PASSKEY, HDBITS_OPTIONS, TORRENT_DIR, USENET_RETENTION, SOCKET_TIMEOUT, SEARCH_FREQUENCY, DEFAULT_SEARCH_FREQUENCY, BACKLOG_SEARCH_FREQUENCY, BACKLOG_STARTUP, INDEXER_DEFAULT, \ HDBITS, HDBITS_USERNAME, HDBITS_PASSKEY, HDBITS_OPTIONS, TORRENT_DIR, USENET_RETENTION, SOCKET_TIMEOUT, RSSUPDATE_FREQUENCY, DEFAULT_SEARCH_FREQUENCY, BACKLOG_FREQUENCY, BACKLOG_STARTUP, INDEXER_DEFAULT, \
NEXTGEN, NEXTGEN_USERNAME, NEXTGEN_PASSWORD, NEXTGEN_FREELEECH, NEXTGEN_OPTIONS, SPEEDCD, SPEEDCD_USERNAME, SPEEDCD_PASSWORD, SPEEDCD_FREELEECH,\ NEXTGEN, NEXTGEN_USERNAME, NEXTGEN_PASSWORD, NEXTGEN_FREELEECH, NEXTGEN_OPTIONS, SPEEDCD, SPEEDCD_USERNAME, SPEEDCD_PASSWORD, SPEEDCD_FREELEECH,\
EZRSS_RATIO, TVTORRENTS_RATIO, BTN_RATIO, THEPIRATEBAY_RATIO, TORRENTLEECH_RATIO, IPTORRENTS_RATIO, KAT_RATIO, PUBLICHD_RATIO, TORRENTDAY_RATIO, SCC_RATIO, HDTORRENTS_RATIO, HDBITS_RATIO, NEXTGEN_RATIO, SPEEDCD_RATIO, \ EZRSS_RATIO, TVTORRENTS_RATIO, BTN_RATIO, THEPIRATEBAY_RATIO, TORRENTLEECH_RATIO, IPTORRENTS_RATIO, KAT_RATIO, PUBLICHD_RATIO, TORRENTDAY_RATIO, SCC_RATIO, HDTORRENTS_RATIO, HDBITS_RATIO, NEXTGEN_RATIO, SPEEDCD_RATIO, \
QUALITY_DEFAULT, FLATTEN_FOLDERS_DEFAULT, SUBTITLES_DEFAULT, STATUS_DEFAULT, \ QUALITY_DEFAULT, FLATTEN_FOLDERS_DEFAULT, SUBTITLES_DEFAULT, STATUS_DEFAULT, \
@ -670,9 +665,13 @@ def initialize(consoleLogging=True):
USENET_RETENTION = check_setting_int(CFG, 'General', 'usenet_retention', 500) USENET_RETENTION = check_setting_int(CFG, 'General', 'usenet_retention', 500)
SEARCH_FREQUENCY = check_setting_int(CFG, 'General', 'search_frequency', 40) RSSUPDATE_FREQUENCY = check_setting_int(CFG, 'General', 'rssupdate_frequency', 40)
if SEARCH_FREQUENCY < MIN_SEARCH_FREQUENCY: if RSSUPDATE_FREQUENCY < MIN_SEARCH_FREQUENCY:
SEARCH_FREQUENCY = MIN_SEARCH_FREQUENCY RSSUPDATE_FREQUENCY = MIN_SEARCH_FREQUENCY
BACKLOG_FREQUENCY = check_setting_int(CFG, 'General', 'backlog_frequency', 40)
if BACKLOG_FREQUENCY < MIN_SEARCH_FREQUENCY:
BACKLOG_FREQUENCY = MIN_SEARCH_FREQUENCY
UPDATE_FREQUENCY = check_setting_int(CFG, 'General', 'update_frequency', 12) UPDATE_FREQUENCY = check_setting_int(CFG, 'General', 'update_frequency', 12)
if UPDATE_FREQUENCY < MIN_UPDATE_FREQUENCY: if UPDATE_FREQUENCY < MIN_UPDATE_FREQUENCY:
@ -1063,7 +1062,7 @@ def initialize(consoleLogging=True):
runImmediately=True) runImmediately=True)
updateRSSScheduler = scheduler.Scheduler(rssupdater.RSSUpdater(), updateRSSScheduler = scheduler.Scheduler(rssupdater.RSSUpdater(),
cycleTime=datetime.timedelta(minutes=SEARCH_FREQUENCY), cycleTime=datetime.timedelta(minutes=RSSUPDATE_FREQUENCY),
threadName="RSSUPDATER", threadName="RSSUPDATER",
silent=True, silent=True,
runImmediately=True) runImmediately=True)
@ -1104,10 +1103,9 @@ def initialize(consoleLogging=True):
backlogSearchScheduler = searchBacklog.BacklogSearchScheduler(searchBacklog.BacklogSearcher(), backlogSearchScheduler = searchBacklog.BacklogSearchScheduler(searchBacklog.BacklogSearcher(),
cycleTime=datetime.timedelta( cycleTime=datetime.timedelta(
minutes=get_backlog_cycle_time()), minutes=BACKLOG_FREQUENCY),
threadName="BACKLOG", threadName="BACKLOG",
runImmediately=True) runImmediately=True)
backlogSearchScheduler.action.cycleTime = BACKLOG_SEARCH_FREQUENCY
if not BACKLOG_STARTUP: if not BACKLOG_STARTUP:
backlogSearchScheduler.silent = True backlogSearchScheduler.silent = True
@ -1379,7 +1377,8 @@ def save_config():
new_config['General']['nzb_method'] = NZB_METHOD new_config['General']['nzb_method'] = NZB_METHOD
new_config['General']['torrent_method'] = TORRENT_METHOD new_config['General']['torrent_method'] = TORRENT_METHOD
new_config['General']['usenet_retention'] = int(USENET_RETENTION) new_config['General']['usenet_retention'] = int(USENET_RETENTION)
new_config['General']['search_frequency'] = int(SEARCH_FREQUENCY) new_config['General']['rssupdate_frequency'] = int(RSSUPDATE_FREQUENCY)
new_config['General']['backlog_frequency'] = int(BACKLOG_FREQUENCY)
new_config['General']['update_frequency'] = int(UPDATE_FREQUENCY) new_config['General']['update_frequency'] = int(UPDATE_FREQUENCY)
new_config['General']['download_propers'] = int(DOWNLOAD_PROPERS) new_config['General']['download_propers'] = int(DOWNLOAD_PROPERS)
new_config['General']['prefer_episode_releases'] = int(PREFER_EPISODE_RELEASES) new_config['General']['prefer_episode_releases'] = int(PREFER_EPISODE_RELEASES)

View File

@ -21,13 +21,13 @@ import os.path
import datetime import datetime
import re import re
import time import time
import sickbeard
from sickbeard import helpers from sickbeard import helpers
from sickbeard import logger from sickbeard import logger
from sickbeard import naming from sickbeard import naming
from sickbeard import db from sickbeard import db
import sickbeard
naming_ep_type = ("%(seasonnumber)dx%(episodenumber)02d", naming_ep_type = ("%(seasonnumber)dx%(episodenumber)02d",
"s%(seasonnumber)02de%(episodenumber)02d", "s%(seasonnumber)02de%(episodenumber)02d",
"S%(seasonnumber)02dE%(episodenumber)02d", "S%(seasonnumber)02dE%(episodenumber)02d",
@ -157,13 +157,21 @@ def change_TV_DOWNLOAD_DIR(tv_download_dir):
return True return True
def change_SEARCH_FREQUENCY(freq): def change_RSSUPDATE_FREQUENCY(freq):
sickbeard.SEARCH_FREQUENCY = to_int(freq, default=sickbeard.DEFAULT_SEARCH_FREQUENCY) sickbeard.RSSUPDATE_FREQUENCY = to_int(freq, default=sickbeard.DEFAULT_SEARCH_FREQUENCY)
if sickbeard.SEARCH_FREQUENCY < sickbeard.MIN_SEARCH_FREQUENCY: if sickbeard.RSSUPDATE_FREQUENCY < sickbeard.MIN_SEARCH_FREQUENCY:
sickbeard.SEARCH_FREQUENCY = sickbeard.MIN_SEARCH_FREQUENCY sickbeard.RSSUPDATE_FREQUENCY = sickbeard.MIN_SEARCH_FREQUENCY
sickbeard.backlogSearchScheduler.cycleTime = datetime.timedelta(minutes=sickbeard.get_backlog_cycle_time()) sickbeard.updateRSSScheduler.cycleTime = datetime.timedelta(minutes=sickbeard.RSSUPDATE_FREQUENCY)
def change_BACKLOG_FREQUENCY(freq):
sickbeard.BACKLOG_FREQUENCY = to_int(freq, default=sickbeard.DEFAULT_SEARCH_FREQUENCY)
if sickbeard.BACKLOG_FREQUENCY < sickbeard.MIN_SEARCH_FREQUENCY:
sickbeard.BACKLOG_FREQUENCY = sickbeard.MIN_SEARCH_FREQUENCY
sickbeard.backlogSearchScheduler.cycleTime = datetime.timedelta(minutes=sickbeard.BACKLOG_FREQUENCY)
def change_UPDATE_FREQUENCY(freq): def change_UPDATE_FREQUENCY(freq):
sickbeard.UPDATE_FREQUENCY = to_int(freq, default=sickbeard.DEFAULT_UPDATE_FREQUENCY) sickbeard.UPDATE_FREQUENCY = to_int(freq, default=sickbeard.DEFAULT_UPDATE_FREQUENCY)

View File

@ -1051,7 +1051,7 @@ class ConfigSearch:
def saveSearch(self, use_nzbs=None, use_torrents=None, nzb_dir=None, sab_username=None, sab_password=None, 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, sab_apikey=None, sab_category=None, sab_host=None, nzbget_username=None, nzbget_password=None,
nzbget_category=None, nzbget_host=None, nzbget_use_https=None, nzbget_category=None, nzbget_host=None, nzbget_use_https=None,
nzb_method=None, torrent_method=None, usenet_retention=None, search_frequency=None, nzb_method=None, torrent_method=None, usenet_retention=None, rssupdate_frequency=None, backlog_frequency=None,
download_propers=None, prefer_episode_releases=None, allow_high_priority=None, backlog_startup=None, download_propers=None, prefer_episode_releases=None, allow_high_priority=None, backlog_startup=None,
torrent_dir=None, torrent_username=None, torrent_password=None, torrent_host=None, torrent_dir=None, torrent_username=None, torrent_password=None, torrent_host=None,
torrent_label=None, torrent_path=None, torrent_verify_cert=None, torrent_label=None, torrent_path=None, torrent_verify_cert=None,
@ -1065,7 +1065,7 @@ class ConfigSearch:
if not config.change_TORRENT_DIR(torrent_dir): if not config.change_TORRENT_DIR(torrent_dir):
results += ["Unable to create directory " + os.path.normpath(torrent_dir) + ", dir not changed."] results += ["Unable to create directory " + os.path.normpath(torrent_dir) + ", dir not changed."]
config.change_SEARCH_FREQUENCY(search_frequency) config.change_RSSUPDATE_FREQUENCY(rssupdate_frequency)
sickbeard.USE_NZBS = config.checkbox_to_value(use_nzbs) sickbeard.USE_NZBS = config.checkbox_to_value(use_nzbs)
sickbeard.USE_TORRENTS = config.checkbox_to_value(use_torrents) sickbeard.USE_TORRENTS = config.checkbox_to_value(use_torrents)
@ -1084,6 +1084,8 @@ class ConfigSearch:
sickbeard.PREFER_EPISODE_RELEASES = config.checkbox_to_value(prefer_episode_releases) sickbeard.PREFER_EPISODE_RELEASES = config.checkbox_to_value(prefer_episode_releases)
sickbeard.ALLOW_HIGH_PRIORITY = config.checkbox_to_value(allow_high_priority) sickbeard.ALLOW_HIGH_PRIORITY = config.checkbox_to_value(allow_high_priority)
config.change_BACKLOG_FREQUENCY(backlog_frequency)
sickbeard.BACKLOG_STARTUP = config.checkbox_to_value(backlog_startup) sickbeard.BACKLOG_STARTUP = config.checkbox_to_value(backlog_startup)
if sickbeard.BACKLOG_STARTUP: if sickbeard.BACKLOG_STARTUP:
sickbeard.backlogSearchScheduler.silent = False sickbeard.backlogSearchScheduler.silent = False