From 875c3e1393fd0a390c58c595690a3869954b1454 Mon Sep 17 00:00:00 2001 From: rembo10 Date: Sat, 8 Dec 2012 21:29:45 -0500 Subject: [PATCH] Added minimum search interval time of 6 hours --- headphones/__init__.py | 7 ++++++- headphones/webserve.py | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/headphones/__init__.py b/headphones/__init__.py index 63373819..2d99b679 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -350,7 +350,7 @@ def initialize(): AUTOWANT_UPCOMING = bool(check_setting_int(CFG, 'General', 'autowant_upcoming', 1)) AUTOWANT_ALL = bool(check_setting_int(CFG, 'General', 'autowant_all', 0)) - SEARCH_INTERVAL = check_setting_int(CFG, 'General', 'search_interval', 360) + SEARCH_INTERVAL = check_setting_int(CFG, 'General', 'search_interval', 1440) LIBRARYSCAN = bool(check_setting_int(CFG, 'General', 'libraryscan', 1)) LIBRARYSCAN_INTERVAL = check_setting_int(CFG, 'General', 'libraryscan_interval', 300) DOWNLOAD_SCAN_INTERVAL = check_setting_int(CFG, 'General', 'download_scan_interval', 5) @@ -529,6 +529,11 @@ def initialize(): os.makedirs(CACHE_DIR) except OSError: logger.error('Could not create cache dir. Check permissions of datadir: ' + DATA_DIR) + + # Sanity check for search interval. Set it to at least 6 hours + if SEARCH_INTERVAL < 360: + logger.info("Search interval too low. Resetting to 6 hour minimum") + SEARCH_INTERVAL = 360 # Initialize the database logger.info('Checking to see if the database has all tables....') diff --git a/headphones/webserve.py b/headphones/webserve.py index 813416b6..f7b52f01 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -832,6 +832,11 @@ class WebInterface(object): headphones.EXTRAS = ','.join(str(n) for n in temp_extras_list) + # Sanity checking + if headphones.SEARCH_INTERVAL < 360: + logger.info("Search interval too low. Resetting to 6 hour minimum") + headphones.SEARCH_INTERVAL = 360 + # Write the config headphones.config_write()