diff --git a/CHANGES.md b/CHANGES.md
index c234a9ed..66538dfa 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -61,6 +61,7 @@
* Add enable, disable and delete public IMDb watchlists to Config/General/Interface with a default 'SickGear' list
* Change prevent duplicate show ids from presenting items on 'Add from... Browse Shows'
* Change add 'nocache' kwarg to helpers.getURL to facilitate non-cached requests
+* Change instantly use saved value from Search Settings/Episode Search/"Check propers every" instead of after a restart
### 0.11.11 (2016-04-05 19:20:00 UTC)
diff --git a/gui/slick/interfaces/default/config_search.tmpl b/gui/slick/interfaces/default/config_search.tmpl
index 2eba60d8..d9004fb6 100755
--- a/gui/slick/interfaces/default/config_search.tmpl
+++ b/gui/slick/interfaces/default/config_search.tmpl
@@ -58,10 +58,8 @@
Check propers every:
diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py
index 48953d75..57daa177 100755
--- a/sickbeard/__init__.py
+++ b/sickbeard/__init__.py
@@ -1172,15 +1172,16 @@ def initialize(consoleLogging=True):
else datetime.timedelta(minutes=10),
prevent_cycle_run=searchQueueScheduler.action.is_standard_backlog_in_progress)
- search_intervals = {'15m': 15, '45m': 45, '90m': 90, '4h': 4 * 60, 'daily': 24 * 60}
- if CHECK_PROPERS_INTERVAL in search_intervals:
- update_interval = datetime.timedelta(minutes=search_intervals[CHECK_PROPERS_INTERVAL])
+ propers_searcher = search_propers.ProperSearcher()
+ item = [(k, n, v) for (k, n, v) in propers_searcher.search_intervals if k == CHECK_PROPERS_INTERVAL]
+ if item:
+ update_interval = datetime.timedelta(minutes=item[0][2])
run_at = None
else:
update_interval = datetime.timedelta(hours=1)
run_at = datetime.time(hour=1) # 1 AM
- properFinderScheduler = scheduler.Scheduler(search_propers.ProperSearcher(),
+ properFinderScheduler = scheduler.Scheduler(propers_searcher,
cycleTime=update_interval,
threadName='FINDPROPERS',
start_time=run_at,
diff --git a/sickbeard/properFinder.py b/sickbeard/properFinder.py
index 69e42be3..286871db 100644
--- a/sickbeard/properFinder.py
+++ b/sickbeard/properFinder.py
@@ -58,12 +58,16 @@ def search_propers():
_set_last_proper_search(datetime.datetime.today().toordinal())
run_at = ''
- if None is sickbeard.properFinderScheduler.start_time:
- run_in = sickbeard.properFinderScheduler.lastRun + sickbeard.properFinderScheduler.cycleTime - datetime.datetime.now()
- hours, remainder = divmod(run_in.seconds, 3600)
- minutes, seconds = divmod(remainder, 60)
- run_at = u', next check in approx. ' + (
- '%dh, %dm' % (hours, minutes) if 0 < hours else '%dm, %ds' % (minutes, seconds))
+ proper_sch = sickbeard.properFinderScheduler
+ if None is proper_sch.start_time:
+ run_in = proper_sch.lastRun + proper_sch.cycleTime - datetime.datetime.now()
+ run_at = u', next check '
+ if datetime.timedelta() > run_in:
+ run_at += u'imminent'
+ else:
+ hours, remainder = divmod(run_in.seconds, 3600)
+ minutes, seconds = divmod(remainder, 60)
+ run_at += u'in approx. ' + ('%dh, %dm' % (hours, minutes) if 0 < hours else '%dm, %ds' % (minutes, seconds))
logger.log(u'Completed the search for new propers%s' % run_at)
diff --git a/sickbeard/search_propers.py b/sickbeard/search_propers.py
index 8d3d9d4d..e2cb2817 100644
--- a/sickbeard/search_propers.py
+++ b/sickbeard/search_propers.py
@@ -26,6 +26,8 @@ class ProperSearcher:
def __init__(self):
self.lock = threading.Lock()
self.amActive = False
+ self.search_intervals = [('daily', '24 hours', 24 * 60), ('4h', '4 hours', 4 * 60),
+ ('90m', '90 mins', 90), ('45m', '45 mins', 45), ('15m', '15 mins', 15)]
def run(self):
diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py
index 5fe83015..e1774d59 100644
--- a/sickbeard/webserve.py
+++ b/sickbeard/webserve.py
@@ -37,7 +37,7 @@ from six import iteritems
import sickbeard
from sickbeard import config, sab, clients, history, notifiers, processTV, ui, logger, helpers, exceptions, classes, \
- db, search_queue, image_cache, naming, scene_exceptions, subtitles, network_timezones, sbdatetime
+ db, search_queue, image_cache, naming, scene_exceptions, search_propers, subtitles, network_timezones, sbdatetime
from sickbeard import encodingKludge as ek
from sickbeard.providers import newznab, rsstorrent
from sickbeard.common import Quality, Overview, statusStrings, qualityPresetStrings
@@ -4331,6 +4331,7 @@ class ConfigSearch(Config):
for show in sickbeard.showList if show.rls_require_words and
show.rls_require_words.strip()]
t.using_rls_require_words.sort(lambda x, y: cmp(x[1], y[1]), reverse=False)
+ t.propers_intervals = search_propers.ProperSearcher().search_intervals
return t.respond()
def saveSearch(self, use_nzbs=None, use_torrents=None, nzb_dir=None, sab_username=None, sab_password=None,
@@ -4367,7 +4368,24 @@ class ConfigSearch(Config):
sickbeard.REQUIRE_WORDS = require_words if require_words else ''
sickbeard.DOWNLOAD_PROPERS = config.checkbox_to_value(download_propers)
- sickbeard.CHECK_PROPERS_INTERVAL = check_propers_interval
+ if sickbeard.CHECK_PROPERS_INTERVAL != check_propers_interval:
+ sickbeard.CHECK_PROPERS_INTERVAL = check_propers_interval
+
+ if sickbeard.DOWNLOAD_PROPERS:
+ proper_sch = sickbeard.properFinderScheduler
+ item = [(k, n, v) for (k, n, v) in proper_sch.action.search_intervals if k == check_propers_interval]
+ if item and None is proper_sch.start_time:
+ interval = datetime.timedelta(minutes=item[0][2])
+ run_in = proper_sch.lastRun + interval - datetime.datetime.now()
+ proper_sch.cycleTime = interval
+
+ run_at = 'imminent'
+ if datetime.timedelta() < run_in:
+ hours, remainder = divmod(run_in.seconds, 3600)
+ minutes, seconds = divmod(remainder, 60)
+ run_at = u'in approx. ' + ('%dh, %dm' % (hours, minutes) if 0 < hours else
+ '%dm, %ds' % (minutes, seconds))
+ logger.log(u'Change search PROPERS interval, next check %s' % run_at)
sickbeard.SEARCH_UNAIRED = config.checkbox_to_value(search_unaired)