mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Converted NZB providers to new dynamic config style format.
This commit is contained in:
parent
ab8d9e6405
commit
5f328eba5f
@ -204,20 +204,27 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
|
|||||||
</div>
|
</div>
|
||||||
#end for
|
#end for
|
||||||
|
|
||||||
<div class="providerDiv" id="omgwtfnzbsDiv">
|
#for $curNzbProvider in [$curProvider for $curProvider in $sickbeard.providers.sortedProviderList() if $curProvider.providerType == $GenericProvider.NZB]:
|
||||||
|
<div class="providerDiv" id="${curNzbProvider.getID()}Div">
|
||||||
|
#if $hasattr($curNzbProvider, 'username'):
|
||||||
<div class="field-pair">
|
<div class="field-pair">
|
||||||
<label class="clearfix">
|
<label class="clearfix">
|
||||||
<span class="component-title">UserName:</span>
|
<span class="component-title">UserName:</span>
|
||||||
<input class="component-desc" type="text" name="omgwtfnzbs_username" value="$sickbeard.OMGWTFNZBS_USERNAME" size="10" />
|
<input class="component-desc" type="text" name="${curNzbProvider.getID()}_username" value="$curNzbProvider.username" size="40" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
#end if
|
||||||
|
|
||||||
|
#if $hasattr($curNzbProvider, 'api_key'):
|
||||||
<div class="field-pair">
|
<div class="field-pair">
|
||||||
<label class="clearfix">
|
<label class="clearfix">
|
||||||
<span class="component-title">API Key:</span>
|
<span class="component-title">API Key:</span>
|
||||||
<input class="component-desc" type="text" name="omgwtfnzbs_apikey" value="$sickbeard.OMGWTFNZBS_APIKEY" size="40" />
|
<input class="component-desc" type="text" name="${curNzbProvider.getID()}_api_key" value="$curNzbProvider.api_key" size="40" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /omgwtfnzbsDiv //-->
|
#end if
|
||||||
|
</div>
|
||||||
|
#end for
|
||||||
|
|
||||||
#for $curTorrentProvider in [$curProvider for $curProvider in $sickbeard.providers.sortedProviderList() if $curProvider.providerType == $GenericProvider.TORRENT]:
|
#for $curTorrentProvider in [$curProvider for $curProvider in $sickbeard.providers.sortedProviderList() if $curProvider.providerType == $GenericProvider.TORRENT]:
|
||||||
<div class="providerDiv" id="${curTorrentProvider.getID()}Div">
|
<div class="providerDiv" id="${curTorrentProvider.getID()}Div">
|
||||||
@ -256,7 +263,7 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
|
|||||||
<div class="field-pair" style="margin-top: -2px !important;">
|
<div class="field-pair" style="margin-top: -2px !important;">
|
||||||
<label class="clearfix" >
|
<label class="clearfix" >
|
||||||
<span class="component-title" style="width: 130px !important;">Seeding Goal Ratio(%):</span>
|
<span class="component-title" style="width: 130px !important;">Seeding Goal Ratio(%):</span>
|
||||||
<input class="seed_option" type="text" id="tvtorrents_seed_ratio" size="5" style="margin-left: -5px !important;"/>
|
<input class="seed_option" type="text" id="tvtorrents_seed_ratio" size="5" style="margin-left: -5px !important;"/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="field-pair" style="margin-top: -10px !important;">
|
<div class="field-pair" style="margin-top: -10px !important;">
|
||||||
|
@ -640,12 +640,6 @@ def initialize(consoleLogging=True):
|
|||||||
NEWZBIN_USERNAME = check_setting_str(CFG, 'Newzbin', 'newzbin_username', '')
|
NEWZBIN_USERNAME = check_setting_str(CFG, 'Newzbin', 'newzbin_username', '')
|
||||||
NEWZBIN_PASSWORD = check_setting_str(CFG, 'Newzbin', 'newzbin_password', '')
|
NEWZBIN_PASSWORD = check_setting_str(CFG, 'Newzbin', 'newzbin_password', '')
|
||||||
|
|
||||||
WOMBLE = bool(check_setting_int(CFG, 'Womble', 'womble', 0))
|
|
||||||
|
|
||||||
OMGWTFNZBS = bool(check_setting_int(CFG, 'omgwtfnzbs', 'omgwtfnzbs', 0))
|
|
||||||
OMGWTFNZBS_USERNAME = check_setting_str(CFG, 'omgwtfnzbs', 'omgwtfnzbs_username', '')
|
|
||||||
OMGWTFNZBS_APIKEY = check_setting_str(CFG, 'omgwtfnzbs', 'omgwtfnzbs_apikey', '')
|
|
||||||
|
|
||||||
SAB_USERNAME = check_setting_str(CFG, 'SABnzbd', 'sab_username', '')
|
SAB_USERNAME = check_setting_str(CFG, 'SABnzbd', 'sab_username', '')
|
||||||
SAB_PASSWORD = check_setting_str(CFG, 'SABnzbd', 'sab_password', '')
|
SAB_PASSWORD = check_setting_str(CFG, 'SABnzbd', 'sab_password', '')
|
||||||
SAB_APIKEY = check_setting_str(CFG, 'SABnzbd', 'sab_apikey', '')
|
SAB_APIKEY = check_setting_str(CFG, 'SABnzbd', 'sab_apikey', '')
|
||||||
@ -1033,6 +1027,17 @@ def initialize(consoleLogging=True):
|
|||||||
curTorrentProvider.backlog_only = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
curTorrentProvider.backlog_only = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
||||||
curTorrentProvider.getID() + '_backlog_only',
|
curTorrentProvider.getID() + '_backlog_only',
|
||||||
0))
|
0))
|
||||||
|
|
||||||
|
for curNzbProvider in [curProvider for curProvider in providers.sortedProviderList() if
|
||||||
|
curProvider.providerType == GenericProvider.NZB]:
|
||||||
|
curNzbProvider.enabled = bool(
|
||||||
|
check_setting_int(CFG, curNzbProvider.getID().upper(), curNzbProvider.getID(), 0))
|
||||||
|
if hasattr(curNzbProvider, 'api_key'):
|
||||||
|
curNzbProvider.api_key = check_setting_str(CFG, curNzbProvider.getID().upper(),
|
||||||
|
curNzbProvider.getID() + '_api_key', '')
|
||||||
|
if hasattr(curNzbProvider, 'username'):
|
||||||
|
curNzbProvider.username = check_setting_str(CFG, curNzbProvider.getID().upper(),
|
||||||
|
curNzbProvider.getID() + '_username', '')
|
||||||
try:
|
try:
|
||||||
url = 'http://raw.github.com/echel0n/sickrage-init/master/settings.ini'
|
url = 'http://raw.github.com/echel0n/sickrage-init/master/settings.ini'
|
||||||
clear_cache = ElementTree.XML(helpers.getURL(url)).find('cache/clear').text
|
clear_cache = ElementTree.XML(helpers.getURL(url)).find('cache/clear').text
|
||||||
@ -1426,6 +1431,18 @@ def save_config():
|
|||||||
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_backlog_only'] = int(
|
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_backlog_only'] = int(
|
||||||
curTorrentProvider.backlog_only)
|
curTorrentProvider.backlog_only)
|
||||||
|
|
||||||
|
for curNzbProvider in [curProvider for curProvider in providers.sortedProviderList() if
|
||||||
|
curProvider.providerType == GenericProvider.NZB]:
|
||||||
|
new_config[curNzbProvider.getID().upper()] = {}
|
||||||
|
new_config[curNzbProvider.getID().upper()][curNzbProvider.getID()] = int(curNzbProvider.enabled)
|
||||||
|
|
||||||
|
if hasattr(curNzbProvider, 'api_key'):
|
||||||
|
new_config[curNzbProvider.getID().upper()][
|
||||||
|
curNzbProvider.getID() + '_api_key'] = curNzbProvider.api_key
|
||||||
|
if hasattr(curNzbProvider, 'username'):
|
||||||
|
new_config[curNzbProvider.getID().upper()][
|
||||||
|
curNzbProvider.getID() + '_username'] = curNzbProvider.username
|
||||||
|
|
||||||
new_config['NZBs'] = {}
|
new_config['NZBs'] = {}
|
||||||
new_config['NZBs']['nzbs'] = int(NZBS)
|
new_config['NZBs']['nzbs'] = int(NZBS)
|
||||||
new_config['NZBs']['nzbs_uid'] = NZBS_UID
|
new_config['NZBs']['nzbs_uid'] = NZBS_UID
|
||||||
@ -1436,14 +1453,6 @@ def save_config():
|
|||||||
new_config['Newzbin']['newzbin_username'] = NEWZBIN_USERNAME
|
new_config['Newzbin']['newzbin_username'] = NEWZBIN_USERNAME
|
||||||
new_config['Newzbin']['newzbin_password'] = helpers.encrypt(NEWZBIN_PASSWORD, ENCRYPTION_VERSION)
|
new_config['Newzbin']['newzbin_password'] = helpers.encrypt(NEWZBIN_PASSWORD, ENCRYPTION_VERSION)
|
||||||
|
|
||||||
new_config['Womble'] = {}
|
|
||||||
new_config['Womble']['womble'] = int(WOMBLE)
|
|
||||||
|
|
||||||
new_config['omgwtfnzbs'] = {}
|
|
||||||
new_config['omgwtfnzbs']['omgwtfnzbs'] = int(OMGWTFNZBS)
|
|
||||||
new_config['omgwtfnzbs']['omgwtfnzbs_username'] = OMGWTFNZBS_USERNAME
|
|
||||||
new_config['omgwtfnzbs']['omgwtfnzbs_apikey'] = OMGWTFNZBS_APIKEY
|
|
||||||
|
|
||||||
new_config['SABnzbd'] = {}
|
new_config['SABnzbd'] = {}
|
||||||
new_config['SABnzbd']['sab_username'] = SAB_USERNAME
|
new_config['SABnzbd']['sab_username'] = SAB_USERNAME
|
||||||
new_config['SABnzbd']['sab_password'] = helpers.encrypt(SAB_PASSWORD, ENCRYPTION_VERSION)
|
new_config['SABnzbd']['sab_password'] = helpers.encrypt(SAB_PASSWORD, ENCRYPTION_VERSION)
|
||||||
|
@ -42,16 +42,19 @@ except ImportError:
|
|||||||
class OmgwtfnzbsProvider(generic.NZBProvider):
|
class OmgwtfnzbsProvider(generic.NZBProvider):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
generic.NZBProvider.__init__(self, "omgwtfnzbs")
|
generic.NZBProvider.__init__(self, "omgwtfnzbs")
|
||||||
|
self.enabled = False
|
||||||
|
self.username = None
|
||||||
|
self.api_key = None
|
||||||
self.cache = OmgwtfnzbsCache(self)
|
self.cache = OmgwtfnzbsCache(self)
|
||||||
self.url = 'https://omgwtfnzbs.org/'
|
self.url = 'https://omgwtfnzbs.org/'
|
||||||
self.supportsBacklog = True
|
self.supportsBacklog = True
|
||||||
|
|
||||||
def isEnabled(self):
|
def isEnabled(self):
|
||||||
return sickbeard.OMGWTFNZBS
|
return self.enabled
|
||||||
|
|
||||||
def _checkAuth(self):
|
def _checkAuth(self):
|
||||||
|
|
||||||
if not sickbeard.OMGWTFNZBS_USERNAME or not sickbeard.OMGWTFNZBS_APIKEY:
|
if not self.username or not self.api_key:
|
||||||
raise AuthException("Your authentication credentials for " + self.name + " are missing, check your config.")
|
raise AuthException("Your authentication credentials for " + self.name + " are missing, check your config.")
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@ -98,8 +101,8 @@ class OmgwtfnzbsProvider(generic.NZBProvider):
|
|||||||
|
|
||||||
self._checkAuth()
|
self._checkAuth()
|
||||||
|
|
||||||
params = {'user': sickbeard.OMGWTFNZBS_USERNAME,
|
params = {'user': self.username,
|
||||||
'api': sickbeard.OMGWTFNZBS_APIKEY,
|
'api': self.api_key,
|
||||||
'eng': 1,
|
'eng': 1,
|
||||||
'catid': '19,20', # SD,HD
|
'catid': '19,20', # SD,HD
|
||||||
'retention': sickbeard.USENET_RETENTION,
|
'retention': sickbeard.USENET_RETENTION,
|
||||||
@ -155,8 +158,8 @@ class OmgwtfnzbsCache(tvcache.TVCache):
|
|||||||
self.minTime = 20
|
self.minTime = 20
|
||||||
|
|
||||||
def _getRSSData(self):
|
def _getRSSData(self):
|
||||||
params = {'user': sickbeard.OMGWTFNZBS_USERNAME,
|
params = {'user': provider.username,
|
||||||
'api': sickbeard.OMGWTFNZBS_APIKEY,
|
'api': provider.api_key,
|
||||||
'eng': 1,
|
'eng': 1,
|
||||||
'catid': '19,20'} # SD,HD
|
'catid': '19,20'} # SD,HD
|
||||||
|
|
||||||
|
@ -26,11 +26,12 @@ from sickbeard import tvcache
|
|||||||
class WombleProvider(generic.NZBProvider):
|
class WombleProvider(generic.NZBProvider):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
generic.NZBProvider.__init__(self, "Womble's Index")
|
generic.NZBProvider.__init__(self, "Womble's Index")
|
||||||
|
self.enabled = False
|
||||||
self.cache = WombleCache(self)
|
self.cache = WombleCache(self)
|
||||||
self.url = 'http://newshost.co.za/'
|
self.url = 'http://newshost.co.za/'
|
||||||
|
|
||||||
def isEnabled(self):
|
def isEnabled(self):
|
||||||
return sickbeard.WOMBLE
|
return self.enabled
|
||||||
|
|
||||||
|
|
||||||
class WombleCache(tvcache.TVCache):
|
class WombleCache(tvcache.TVCache):
|
||||||
|
@ -1562,11 +1562,13 @@ class ConfigProviders:
|
|||||||
provider_list.append(curProvider)
|
provider_list.append(curProvider)
|
||||||
|
|
||||||
# dynamically set providers enabled/disabled
|
# dynamically set providers enabled/disabled
|
||||||
for provider in sickbeard.providers.sortedProviderList():
|
providers = sickbeard.providers.sortedProviderList()
|
||||||
|
for provider in providers:
|
||||||
if provider.getID() != curProvider or not hasattr(provider, 'enabled'):
|
if provider.getID() != curProvider or not hasattr(provider, 'enabled'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
provider.enabled = curEnabled
|
provider.enabled = curEnabled
|
||||||
|
break
|
||||||
|
|
||||||
# dynamically load provider settings
|
# dynamically load provider settings
|
||||||
for curTorrentProvider in [curProvider for curProvider in sickbeard.providers.sortedProviderList() if
|
for curTorrentProvider in [curProvider for curProvider in sickbeard.providers.sortedProviderList() if
|
||||||
@ -1656,8 +1658,20 @@ class ConfigProviders:
|
|||||||
except:
|
except:
|
||||||
curTorrentProvider.backlog_only = 0
|
curTorrentProvider.backlog_only = 0
|
||||||
|
|
||||||
sickbeard.OMGWTFNZBS_USERNAME = kwargs['omgwtfnzbs_username'].strip()
|
for curNzbProvider in [curProvider for curProvider in sickbeard.providers.sortedProviderList() if
|
||||||
sickbeard.OMGWTFNZBS_APIKEY = kwargs['omgwtfnzbs_apikey'].strip()
|
curProvider.providerType == sickbeard.GenericProvider.NZB]:
|
||||||
|
|
||||||
|
if hasattr(curNzbProvider, 'api_key'):
|
||||||
|
try:
|
||||||
|
curNzbProvider.api_key = str(kwargs[curNzbProvider.getID() + '_api_key']).strip()
|
||||||
|
except:
|
||||||
|
curNzbProvider.api_key = None
|
||||||
|
|
||||||
|
if hasattr(curNzbProvider, 'username'):
|
||||||
|
try:
|
||||||
|
curNzbProvider.username = str(kwargs[curNzbProvider.getID() + '_username']).strip()
|
||||||
|
except:
|
||||||
|
curNzbProvider.username = None
|
||||||
|
|
||||||
sickbeard.NEWZNAB_DATA = '!!!'.join([x.configStr() for x in sickbeard.newznabProviderList])
|
sickbeard.NEWZNAB_DATA = '!!!'.join([x.configStr() for x in sickbeard.newznabProviderList])
|
||||||
sickbeard.PROVIDER_ORDER = provider_list
|
sickbeard.PROVIDER_ORDER = provider_list
|
||||||
|
Loading…
Reference in New Issue
Block a user