1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Added per-provider option 'backlog only' which allows you to disclude any provider from the daily search but still use it for backlogs, currently working for torrents only and will add to nzb providers later on today.

Cleaned up details on search options for providers and made it look nicer
This commit is contained in:
echel0n 2014-05-18 09:39:30 -07:00
parent f0d78dbfbb
commit de20d13c61
5 changed files with 68 additions and 18 deletions

View File

@ -157,12 +157,28 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
</div>
#end if
#if $hasattr($curNewznabProvider, 'backlog_only'):
<div class="field-pair">
<input type="checkbox" name="${curNewznabProvider.getID()}_backlog_only" id="${curNewznabProvider.getID()}_backlog_only" #if $curNewznabProvider.backlog_only then "checked=\"checked\"" else ""#/>
<label class="clearfix" for="${curNewznabProvider.getID()}_backlog_only">
<span class="component-title">Backlog Only</span>
<span class="component-desc">
Sets the provider to only be used for<br>
backlog searches.</span>
</label>
</div>
#end if
#if $hasattr($curNewznabProvider, 'search_fallback'):
<div class="field-pair">
<input type="checkbox" name="${curNewznabProvider.getID()}_search_fallback" id="${curNewznabProvider.getID()}_search_fallback" #if $curNewznabProvider.search_fallback then "checked=\"checked\"" else ""#/>
<label class="clearfix" for="${curNewznabProvider.getID()}_search_fallback">
<span class="component-title">Search Fallback</span>
<span class="component-desc">This will restart the search using the alternative method from Search Mode if first attempt fails to return any results to snatch.</span>
<span class="component-title">Season Search Fallback</span>
<span class="component-desc">
When searching for a complete season<br>
depending on search mode you may return<br>
no results, this helps by restarting the<br>
search using the opposite search mode.</span>
</label>
</div>
#end if
@ -170,14 +186,16 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
#if $hasattr($curNewznabProvider, 'search_mode'):
<div class="field-pair">
<label class="nocheck clearfix">
<span class="component-title">Search Mode</span>
<span class="component-title">Season Search Mode</span>
<span class="component-desc">
When searching for complete seasons<br>
you can choose to have it look for season<br>
packs ONLY or choose to have it build a<br>
complete season from just single episodes.</span>
<span class="component-title"></span>
<input type="radio" name="${curNewznabProvider.getID()}_search_mode" id="${curNewznabProvider.getID()}_search_mode_sponly" value="sponly" class="radio" #if $curNewznabProvider.search_mode=="sponly" then "checked=\"checked\"" else ""# />Season Packs ONLY!<br />
</span>
</label>
<label class="nocheck clearfix">
<span class="component-title"></span>
<span class="component-desc">
<span class="component-title"></span>
<input type="radio" name="${curNewznabProvider.getID()}_search_mode" id="${curNewznabProvider.getID()}_search_mode_eponly" value="eponly" class="radio" #if $curNewznabProvider.search_mode=="eponly" then "checked=\"checked\"" else ""# />Episodes ONLY!<br />
</span>
</label>
@ -335,12 +353,28 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
</div>
#end if
#if $hasattr($curTorrentProvider, 'backlog_only'):
<div class="field-pair">
<input type="checkbox" name="${curTorrentProvider.getID()}_backlog_only" id="${curTorrentProvider.getID()}_backlog_only" #if $curTorrentProvider.backlog_only then "checked=\"checked\"" else ""#/>
<label class="clearfix" for="${curTorrentProvider.getID()}_backlog_only">
<span class="component-title">Backlog Only</span>
<span class="component-desc">
Sets the provider to only be used for<br>
backlog searches.</span>
</label>
</div>
#end if
#if $hasattr($curTorrentProvider, 'search_fallback'):
<div class="field-pair">
<input type="checkbox" name="${curTorrentProvider.getID()}_search_fallback" id="${curTorrentProvider.getID()}_search_fallback" #if $curTorrentProvider.search_fallback then "checked=\"checked\"" else ""#/>
<label class="clearfix" for="${curTorrentProvider.getID()}_search_fallback">
<span class="component-title">Season Search Fallback</span>
<span class="component-desc">When searching for a complete season depending on search mode you may return no results, this helps by restarting the search using the opposite search mode</span>
<span class="component-desc">
When searching for a complete season<br>
depending on search mode you may return<br>
no results, this helps by restarting the<br>
search using the opposite search mode.</span>
</label>
</div>
#end if
@ -349,13 +383,15 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
<div class="field-pair">
<label class="nocheck clearfix">
<span class="component-title">Season Search Mode</span>
<span class="component-desc">When searching for complete seasons you can choose to have it look for season packs ONLY or choose to have it build a complete season from just single episodes</span>
<input type="radio" name="${curTorrentProvider.getID()}_search_mode" id="${curTorrentProvider.getID()}_search_mode_sponly" value="sponly" class="radio" #if $curTorrentProvider.search_mode=="sponly" then "checked=\"checked\"" else ""# />Season Packs ONLY!<br />
</span>
</label>
<label class="nocheck clearfix">
<span class="component-title"></span>
<span class="component-desc">
When searching for complete seasons<br>
you can choose to have it look for season<br>
packs ONLY or choose to have it build a<br>
complete season from just single episodes.</span>
<span class="component-title"></span>
<input type="radio" name="${curTorrentProvider.getID()}_search_mode" id="${curTorrentProvider.getID()}_search_mode_sponly" value="sponly" class="radio" #if $curTorrentProvider.search_mode=="sponly" then "checked=\"checked\"" else ""# />Season Packs ONLY!<br />
<span class="component-title"></span>
<input type="radio" name="${curTorrentProvider.getID()}_search_mode" id="${curTorrentProvider.getID()}_search_mode_eponly" value="eponly" class="radio" #if $curTorrentProvider.search_mode=="eponly" then "checked=\"checked\"" else ""# />Episodes ONLY!<br />
</span>
</label>

View File

@ -1026,7 +1026,11 @@ def initialize(consoleLogging=True):
'eponly')
if hasattr(curTorrentProvider, 'search_fallback'):
curTorrentProvider.search_fallback = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_search_mode',
curTorrentProvider.getID() + '_search_fallback',
0))
if hasattr(curTorrentProvider, 'backlog_only'):
curTorrentProvider.backlog_only = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_backlog_only',
0))
try:
url = 'http://raw.github.com/echel0n/sickrage-init/master/settings.ini'
@ -1415,6 +1419,9 @@ def save_config():
if hasattr(curTorrentProvider, 'search_fallback'):
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_search_fallback'] = int(
curTorrentProvider.search_fallback)
if hasattr(curTorrentProvider, 'backlog_only'):
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_backlog_only'] = int(
curTorrentProvider.backlog_only)
new_config['NZBs'] = {}
new_config['NZBs']['nzbs'] = int(NZBS)

View File

@ -57,7 +57,8 @@ class GenericProvider:
self.search_mode = None
self.search_fallback = False
self.backlog_only = False
self.cache = tvcache.TVCache(self)
self.session = requests.session()

View File

@ -323,7 +323,7 @@ def searchForNeededEpisodes(episodes):
# ask all providers for any episodes it finds
origThreadName = threading.currentThread().name
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive() and not x.backlog_only]
for curProviderCount, curProvider in enumerate(providers):
threading.currentThread().name = origThreadName + " :: [" + curProvider.name + "]"

View File

@ -1633,6 +1633,12 @@ class ConfigProviders:
except:
curTorrentProvider.search_fallback = 0
if hasattr(curTorrentProvider, 'backlog_only'):
try:
curTorrentProvider.backlog_only = config.checkbox_to_value(kwargs[curTorrentProvider.getID() + '_backlog_only'])
except:
curTorrentProvider.backlog_only = 0
sickbeard.OMGWTFNZBS_USERNAME = kwargs['omgwtfnzbs_username'].strip()
sickbeard.OMGWTFNZBS_APIKEY = kwargs['omgwtfnzbs_apikey'].strip()