From a1d2c3bcb16421aaf297b0c63c901ccb0ad259fc Mon Sep 17 00:00:00 2001 From: Nils Vogels Date: Sat, 26 Apr 2014 23:24:29 +0200 Subject: [PATCH] Making frequency of version update checker (CHECKVERSION) configurable Adds an option in Config > General > Misc called "Update Frequency" Closes #54 --- .../interfaces/default/config_general.tmpl | 25 ++++++++++++++++++- sickbeard/__init__.py | 10 ++++++-- sickbeard/config.py | 1 - sickbeard/webserve.py | 3 ++- 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/gui/slick/interfaces/default/config_general.tmpl b/gui/slick/interfaces/default/config_general.tmpl index 9c195186..45e28a59 100644 --- a/gui/slick/interfaces/default/config_general.tmpl +++ b/gui/slick/interfaces/default/config_general.tmpl @@ -67,7 +67,29 @@ + + +
+ + +
+ +
+ +
@@ -284,6 +306,7 @@ Proxy to use for connecting to providers. Leave empty to not use proxy + diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index 6bd1decd..51caed11 100644 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -168,9 +168,12 @@ ALLOW_HIGH_PRIORITY = None SEARCH_FREQUENCY = None BACKLOG_SEARCH_FREQUENCY = 21 +UPDATE_FREQUENCY = None + MIN_SEARCH_FREQUENCY = 10 DEFAULT_SEARCH_FREQUENCY = 40 +DEFAULT_UPDATE_FREQUENCY = 12 EZRSS = False @@ -463,7 +466,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, \ 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, \ - HDBITS, HDBITS_USERNAME, HDBITS_PASSKEY, HDBITS_OPTIONS, TORRENT_DIR, USENET_RETENTION, SOCKET_TIMEOUT, SEARCH_FREQUENCY, DEFAULT_SEARCH_FREQUENCY, BACKLOG_SEARCH_FREQUENCY, \ + HDBITS, HDBITS_USERNAME, HDBITS_PASSKEY, HDBITS_OPTIONS, TORRENT_DIR, USENET_RETENTION, SOCKET_TIMEOUT, SEARCH_FREQUENCY, DEFAULT_SEARCH_FREQUENCY, BACKLOG_SEARCH_FREQUENCY, UPDATE_FREQUENCY, DEFAULT_UPDATE_FREQUENCY, \ NEXTGEN, NEXTGEN_USERNAME, NEXTGEN_PASSWORD, NEXTGEN_FREELEECH, NEXTGEN_OPTIONS, \ QUALITY_DEFAULT, FLATTEN_FOLDERS_DEFAULT, SUBTITLES_DEFAULT, STATUS_DEFAULT, \ GROWL_NOTIFY_ONSNATCH, GROWL_NOTIFY_ONDOWNLOAD, GROWL_NOTIFY_ONSUBTITLEDOWNLOAD, TWITTER_NOTIFY_ONSNATCH, TWITTER_NOTIFY_ONDOWNLOAD, TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD, \ @@ -622,6 +625,8 @@ def initialize(consoleLogging=True): if SEARCH_FREQUENCY < MIN_SEARCH_FREQUENCY: SEARCH_FREQUENCY = MIN_SEARCH_FREQUENCY + UPDATE_FREQUENCY = check_setting_int(CFG, 'General', 'update_frequency', DEFAULT_UPDATE_FREQUENCY) + NZB_DIR = check_setting_str(CFG, 'Blackhole', 'nzb_dir', '') TORRENT_DIR = check_setting_str(CFG, 'Blackhole', 'torrent_dir', '') @@ -977,7 +982,7 @@ def initialize(consoleLogging=True): runImmediately=False) versionCheckScheduler = scheduler.Scheduler(versionChecker.CheckVersion(), - cycleTime=datetime.timedelta(hours=12), + cycleTime=datetime.timedelta(hours=UPDATE_FREQUENCY), threadName="CHECKVERSION", runImmediately=True) @@ -1288,6 +1293,7 @@ def save_config(): new_config['General']['torrent_method'] = TORRENT_METHOD new_config['General']['usenet_retention'] = int(USENET_RETENTION) new_config['General']['search_frequency'] = int(SEARCH_FREQUENCY) + new_config['General']['update_frequency'] = int(UPDATE_FREQUENCY) new_config['General']['download_propers'] = int(DOWNLOAD_PROPERS) new_config['General']['allow_high_priority'] = int(ALLOW_HIGH_PRIORITY) new_config['General']['quality_default'] = int(QUALITY_DEFAULT) diff --git a/sickbeard/config.py b/sickbeard/config.py index 34c254fa..52948800 100644 --- a/sickbeard/config.py +++ b/sickbeard/config.py @@ -160,7 +160,6 @@ def change_SEARCH_FREQUENCY(freq): sickbeard.currentSearchScheduler.cycleTime = datetime.timedelta(minutes=sickbeard.SEARCH_FREQUENCY) sickbeard.backlogSearchScheduler.cycleTime = datetime.timedelta(minutes=sickbeard.get_backlog_cycle_time()) - def change_VERSION_NOTIFY(version_notify): oldSetting = sickbeard.VERSION_NOTIFY diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 3102982c..bbd1380d 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -974,7 +974,7 @@ class ConfigGeneral: @cherrypy.expose def saveGeneral(self, log_dir=None, web_port=None, web_log=None, encryption_version=None, web_ipv6=None, - update_shows_on_start=None, launch_browser=None, web_username=None, use_api=None, api_key=None, + update_shows_on_start=None, update_frequency=None, launch_browser=None, web_username=None, use_api=None, api_key=None, web_password=None, version_notify=None, enable_https=None, https_cert=None, https_key=None, sort_article=None, auto_update=None, proxy_setting=None, anon_redirect=None, git_path=None, calendar_unprotected=None, date_preset=None, time_preset=None): @@ -988,6 +988,7 @@ class ConfigGeneral: # sickbeard.LOG_DIR is set in config.change_LOG_DIR() sickbeard.UPDATE_SHOWS_ON_START = config.checkbox_to_value(update_shows_on_start) + sickbeard.UPDATE_FREQUENCY = config.to_int(update_frequency) sickbeard.LAUNCH_BROWSER = config.checkbox_to_value(launch_browser) sickbeard.SORT_ARTICLE = config.checkbox_to_value(sort_article) sickbeard.ANON_REDIRECT = anon_redirect