1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-10-31 15:35:01 -04:00

Added search options to NZB providers

This commit is contained in:
echel0n 2014-05-19 19:29:51 -07:00
parent 5f328eba5f
commit 6a02edd7fc
3 changed files with 90 additions and 1 deletions

View File

@ -201,6 +201,7 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
</label>
</div>
#end if
</div>
#end for
@ -223,6 +224,52 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
</label>
</div>
#end if
#if $hasattr($curNewznabProvider, 'backlog_only'):
<div class="field-pair">
<input type="checkbox" name="${curNzbProvider.getID()}_backlog_only" id="${curNzbProvider.getID()}_backlog_only" #if $curNzbProvider.backlog_only then "checked=\"checked\"" else ""#/>
<label class="clearfix" for="${curNzbProvider.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($curNzbProvider, 'search_fallback'):
<div class="field-pair">
<input type="checkbox" name="${curNzbProvider.getID()}_search_fallback" id="${curNzbProvider.getID()}_search_fallback" #if $curNzbProvider.search_fallback then "checked=\"checked\"" else ""#/>
<label class="clearfix" for="${curNzbProvider.getID()}_search_fallback">
<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
#if $hasattr($curNzbProvider, 'search_mode'):
<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<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="${curNzbProvider.getID()}_search_mode" id="${curNzbProvider.getID()}_search_mode_sponly" value="sponly" class="radio" #if $curNzbProvider.search_mode=="sponly" then "checked=\"checked\"" else ""# />Season Packs ONLY!<br />
<span class="component-title"></span>
<input type="radio" name="${curNzbProvider.getID()}_search_mode" id="${curNzbProvider.getID()}_search_mode_eponly" value="eponly" class="radio" #if $curNzbProvider.search_mode=="eponly" then "checked=\"checked\"" else ""# />Episodes ONLY!<br />
</span>
</label>
</div>
#end if
</div>
#end for

View File

@ -1038,6 +1038,19 @@ def initialize(consoleLogging=True):
if hasattr(curNzbProvider, 'username'):
curNzbProvider.username = check_setting_str(CFG, curNzbProvider.getID().upper(),
curNzbProvider.getID() + '_username', '')
if hasattr(curNzbProvider, 'search_mode'):
curNzbProvider.search_mode = check_setting_str(CFG, curNzbProvider.getID().upper(),
curNzbProvider.getID() + '_search_mode',
'eponly')
if hasattr(curNzbProvider, 'search_fallback'):
curNzbProvider.search_fallback = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
curNzbProvider.getID() + '_search_fallback',
0))
if hasattr(curNzbProvider, 'backlog_only'):
curNzbProvider.backlog_only = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
curNzbProvider.getID() + '_backlog_only',
0))
try:
url = 'http://raw.github.com/echel0n/sickrage-init/master/settings.ini'
clear_cache = ElementTree.XML(helpers.getURL(url)).find('cache/clear').text
@ -1442,6 +1455,15 @@ def save_config():
if hasattr(curNzbProvider, 'username'):
new_config[curNzbProvider.getID().upper()][
curNzbProvider.getID() + '_username'] = curNzbProvider.username
if hasattr(curNzbProvider, 'search_mode'):
new_config[curNzbProvider.getID().upper()][
curNzbProvider.getID() + '_search_mode'] = curNzbProvider.search_mode
if hasattr(curNzbProvider, 'search_fallback'):
new_config[curNzbProvider.getID().upper()][curNzbProvider.getID() + '_search_fallback'] = int(
curNzbProvider.search_fallback)
if hasattr(curNzbProvider, 'backlog_only'):
new_config[curNzbProvider.getID().upper()][curNzbProvider.getID() + '_backlog_only'] = int(
curNzbProvider.backlog_only)
new_config['NZBs'] = {}
new_config['NZBs']['nzbs'] = int(NZBS)

View File

@ -1668,11 +1668,31 @@ class ConfigProviders:
curNzbProvider.api_key = None
if hasattr(curNzbProvider, 'username'):
try:
try:
curNzbProvider.username = str(kwargs[curNzbProvider.getID() + '_username']).strip()
except:
curNzbProvider.username = None
if hasattr(curNzbProvider, 'search_mode'):
try:
curNzbProvider.search_mode = str(kwargs[curNzbProvider.getID() + '_search_mode']).strip()
except:
curNzbProvider.search_mode = 'eponly'
if hasattr(curNzbProvider, 'search_fallback'):
try:
curNzbProvider.search_fallback = config.checkbox_to_value(
kwargs[curNzbProvider.getID() + '_search_fallback'])
except:
curNzbProvider.search_fallback = 0
if hasattr(curNzbProvider, 'backlog_only'):
try:
curNzbProvider.backlog_only = config.checkbox_to_value(
kwargs[curNzbProvider.getID() + '_backlog_only'])
except:
curNzbProvider.backlog_only = 0
sickbeard.NEWZNAB_DATA = '!!!'.join([x.configStr() for x in sickbeard.newznabProviderList])
sickbeard.PROVIDER_ORDER = provider_list