From e353cd13c7b2a0a416c51af3dbdb4a7db30d2b60 Mon Sep 17 00:00:00 2001 From: echel0n Date: Mon, 12 May 2014 22:48:00 -0700 Subject: [PATCH] Added ability to turn RSS Cache updates on startup and let it start when its interval is reached and continue from there. This can be set from same place you set backlog startups. --- .../interfaces/default/config_search.tmpl | 9 ++++++++- sickbeard/__init__.py | 19 ++++++++++++------- sickbeard/search_queue.py | 15 +++++++-------- sickbeard/webserve.py | 3 ++- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/gui/slick/interfaces/default/config_search.tmpl b/gui/slick/interfaces/default/config_search.tmpl index 1bc155c2..89a6d662 100644 --- a/gui/slick/interfaces/default/config_search.tmpl +++ b/gui/slick/interfaces/default/config_search.tmpl @@ -107,11 +107,18 @@ Prefer to download seperate episodes, not complete seasons? +
+ + +
diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index bc94ba74..44d6bcf3 100644 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -176,6 +176,7 @@ ALLOW_HIGH_PRIORITY = None RSSUPDATE_FREQUENCY = None UPDATE_FREQUENCY = None BACKLOG_FREQUENCY = 21 +RSSUPDATE_STARTUP = None BACKLOG_STARTUP = None MIN_SEARCH_FREQUENCY = 10 @@ -496,8 +497,8 @@ 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, 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,\ + HDBITS, HDBITS_USERNAME, HDBITS_PASSKEY, HDBITS_OPTIONS, TORRENT_DIR, USENET_RETENTION, SOCKET_TIMEOUT, RSSUPDATE_FREQUENCY, DEFAULT_SEARCH_FREQUENCY, BACKLOG_FREQUENCY, BACKLOG_STARTUP, INDEXER_DEFAULT, RSSUPDATE_STARTUP, \ + 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, \ 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, \ @@ -507,7 +508,7 @@ def initialize(consoleLogging=True): USE_PUSHALOT, PUSHALOT_NOTIFY_ONSNATCH, PUSHALOT_NOTIFY_ONDOWNLOAD, PUSHALOT_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHALOT_AUTHORIZATIONTOKEN, \ USE_PUSHBULLET, PUSHBULLET_NOTIFY_ONSNATCH, PUSHBULLET_NOTIFY_ONDOWNLOAD, PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHBULLET_API, PUSHBULLET_DEVICE, \ versionCheckScheduler, VERSION_NOTIFY, AUTO_UPDATE, PROCESS_AUTOMATICALLY, UNPACK, \ - KEEP_PROCESSED_DIR, PROCESS_METHOD, TV_DOWNLOAD_DIR, MIN_SEARCH_FREQUENCY, DEFAULT_UPDATE_FREQUENCY,MIN_UPDATE_FREQUENCY,UPDATE_FREQUENCY,\ + KEEP_PROCESSED_DIR, PROCESS_METHOD, TV_DOWNLOAD_DIR, MIN_SEARCH_FREQUENCY, DEFAULT_UPDATE_FREQUENCY, MIN_UPDATE_FREQUENCY, UPDATE_FREQUENCY, \ showQueueScheduler, searchQueueScheduler, ROOT_DIRS, CACHE_DIR, ACTUAL_CACHE_DIR, \ NAMING_PATTERN, NAMING_MULTI_EP, NAMING_FORCE_FOLDERS, NAMING_ABD_PATTERN, NAMING_CUSTOM_ABD, NAMING_SPORTS_PATTERN, NAMING_CUSTOM_SPORTS, NAMING_STRIP_YEAR, \ RENAME_EPISODES, properFinderScheduler, PROVIDER_ORDER, autoPostProcesserScheduler, \ @@ -638,7 +639,8 @@ def initialize(consoleLogging=True): NAMING_PATTERN = check_setting_str(CFG, 'General', 'naming_pattern', 'Season %0S/%SN - S%0SE%0E - %EN') NAMING_ABD_PATTERN = check_setting_str(CFG, 'General', 'naming_abd_pattern', '%Y/%0M/%SN - %A.D - %EN') NAMING_CUSTOM_ABD = check_setting_int(CFG, 'General', 'naming_custom_abd', 0) - NAMING_SPORTS_PATTERN = check_setting_str(CFG, 'General', 'naming_sports_pattern', 'Season %0S/%SN - S%0SE%0E - %EN') + NAMING_SPORTS_PATTERN = check_setting_str(CFG, 'General', 'naming_sports_pattern', + 'Season %0S/%SN - S%0SE%0E - %EN') NAMING_CUSTOM_SPORTS = check_setting_int(CFG, 'General', 'naming_custom_sports', 0) NAMING_MULTI_EP = check_setting_int(CFG, 'General', 'naming_multi_ep', 1) NAMING_FORCE_FOLDERS = naming.check_force_season_folders() @@ -661,6 +663,7 @@ def initialize(consoleLogging=True): ALLOW_HIGH_PRIORITY = bool(check_setting_int(CFG, 'General', 'allow_high_priority', 1)) + RSSUPDATE_STARTUP = bool(check_setting_int(CFG, 'General', 'rssupdate_startup', 1)) BACKLOG_STARTUP = bool(check_setting_int(CFG, 'General', 'backlog_startup', 1)) USENET_RETENTION = check_setting_int(CFG, 'General', 'usenet_retention', 500) @@ -864,7 +867,8 @@ def initialize(consoleLogging=True): USE_BOXCAR2 = bool(check_setting_int(CFG, 'Boxcar2', 'use_boxcar2', 0)) BOXCAR2_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Boxcar2', 'boxcar2_notify_onsnatch', 0)) BOXCAR2_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Boxcar2', 'boxcar2_notify_ondownload', 0)) - BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'Boxcar2', 'boxcar2_notify_onsubtitledownload', 0)) + BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD = bool( + check_setting_int(CFG, 'Boxcar2', 'boxcar2_notify_onsubtitledownload', 0)) BOXCAR2_ACCESSTOKEN = check_setting_str(CFG, 'Boxcar2', 'boxcar2_accesstoken', '') USE_PUSHOVER = bool(check_setting_int(CFG, 'Pushover', 'use_pushover', 0)) @@ -1065,7 +1069,7 @@ def initialize(consoleLogging=True): cycleTime=datetime.timedelta(minutes=RSSUPDATE_FREQUENCY), threadName="RSSUPDATER", silent=True, - runImmediately=True) + runImmediately=RSSUPDATE_STARTUP) showQueueScheduler = scheduler.Scheduler(show_queue.ShowQueue(), cycleTime=datetime.timedelta(seconds=3), @@ -1103,7 +1107,7 @@ def initialize(consoleLogging=True): backlogSearchScheduler = searchBacklog.BacklogSearchScheduler(searchBacklog.BacklogSearcher(), cycleTime=datetime.timedelta( - minutes=BACKLOG_FREQUENCY), + minutes=BACKLOG_FREQUENCY), threadName="BACKLOG", silent=True, runImmediately=BACKLOG_STARTUP) @@ -1382,6 +1386,7 @@ def save_config(): new_config['General']['download_propers'] = int(DOWNLOAD_PROPERS) new_config['General']['prefer_episode_releases'] = int(PREFER_EPISODE_RELEASES) new_config['General']['allow_high_priority'] = int(ALLOW_HIGH_PRIORITY) + new_config['General']['rssupdate_startup'] = int(RSSUPDATE_STARTUP) new_config['General']['backlog_startup'] = int(BACKLOG_STARTUP) new_config['General']['quality_default'] = int(QUALITY_DEFAULT) new_config['General']['status_default'] = int(STATUS_DEFAULT) diff --git a/sickbeard/search_queue.py b/sickbeard/search_queue.py index c7dbc870..f7431f57 100644 --- a/sickbeard/search_queue.py +++ b/sickbeard/search_queue.py @@ -258,15 +258,14 @@ class FailedQueueItem(generic_queue.QueueItem): generic_queue.QueueItem.execute(self) for i, epObj in enumerate(self.episodes): - with epObj.lock: - (release, provider) = failed_history.findRelease(self.show, epObj.season, epObj.episode) - if release: - logger.log(u"Marking release as bad: " + release) - failed_history.markFailed(self.show, epObj.season, epObj.episode) - failed_history.logFailed(release) - history.logFailed(self.show.indexerid, epObj.season, epObj.episode, epObj.status, release, provider) + (release, provider) = failed_history.findRelease(self.show, epObj.season, epObj.episode) + if release: + logger.log(u"Marking release as bad: " + release) + failed_history.markFailed(self.show, epObj.season, epObj.episode) + failed_history.logFailed(release) + history.logFailed(self.show.indexerid, epObj.season, epObj.episode, epObj.status, release, provider) - failed_history.revertEpisode(self.show, epObj.season, epObj.episode) + failed_history.revertEpisode(self.show, epObj.season, epObj.episode) try: logger.log( diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index a24a2035..4ca85c3a 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -1053,7 +1053,7 @@ class ConfigSearch: nzbget_category=None, nzbget_host=None, nzbget_use_https=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, - torrent_dir=None, torrent_username=None, torrent_password=None, torrent_host=None, + torrent_dir=None, torrent_username=None, torrent_password=None, torrent_host=None, rssupdate_startup=None, torrent_label=None, torrent_path=None, torrent_verify_cert=None, torrent_ratio=None, torrent_seed_time=None, torrent_paused=None, torrent_high_bandwidth=None, ignore_words=None): @@ -1086,6 +1086,7 @@ class ConfigSearch: sickbeard.ALLOW_HIGH_PRIORITY = config.checkbox_to_value(allow_high_priority) config.change_BACKLOG_FREQUENCY(backlog_frequency) + sickbeard.RSSUPDATE_STARTUP = config.checkbox_to_value(rssupdate_startup) sickbeard.BACKLOG_STARTUP = config.checkbox_to_value(backlog_startup) sickbeard.SAB_USERNAME = sab_username