mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-13 11:32:20 -05:00
Replaced provider backlog only search option with 2 new options that allow you to enable daily searches and backlog searches individually per provider, default is enabled for both.
This commit is contained in:
parent
11af0269dc
commit
bcffc09589
@ -156,14 +156,24 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
|
|||||||
</div>
|
</div>
|
||||||
#end if
|
#end if
|
||||||
|
|
||||||
#if $hasattr($curNewznabProvider, 'backlog_only'):
|
#if $hasattr($curNewznabProvider, 'enable_daily'):
|
||||||
<div class="field-pair">
|
<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 ""#/>
|
<input type="checkbox" name="${curNewznabProvider.getID()}_enable_daily" id="${curNewznabProvider.getID()}_enable_daily" #if $curNewznabProvider.enable_daily then "checked=\"checked\"" else ""#/>
|
||||||
<label class="clearfix" for="${curNewznabProvider.getID()}_backlog_only">
|
<label class="clearfix" for="${curNewznabProvider.getID()}_enable_daily">
|
||||||
<span class="component-title">Backlog Only</span>
|
<span class="component-title">Enable Daily Searches</span>
|
||||||
<span class="component-desc">
|
<span class="component-desc">
|
||||||
Sets the provider to only be used for<br>
|
Enables daily searches</span>
|
||||||
backlog searches.</span>
|
</label>
|
||||||
|
</div>
|
||||||
|
#end if
|
||||||
|
|
||||||
|
#if $hasattr($curNewznabProvider, 'enable_backlog'):
|
||||||
|
<div class="field-pair">
|
||||||
|
<input type="checkbox" name="${curNewznabProvider.getID()}_enable_backlog" id="${curNewznabProvider.getID()}_enable_backlog" #if $curNewznabProvider.enable_backlog then "checked=\"checked\"" else ""#/>
|
||||||
|
<label class="clearfix" for="${curNewznabProvider.getID()}_enable_backlog">
|
||||||
|
<span class="component-title">Enable Backlog Searches</span>
|
||||||
|
<span class="component-desc">
|
||||||
|
Enables backlog searches</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
#end if
|
#end if
|
||||||
@ -183,10 +193,10 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
|
|||||||
#end if
|
#end if
|
||||||
|
|
||||||
#if $hasattr($curNewznabProvider, 'search_mode'):
|
#if $hasattr($curNewznabProvider, 'search_mode'):
|
||||||
<div class="field-pair">
|
|
||||||
<label class="nocheck clearfix">
|
<label class="nocheck clearfix">
|
||||||
<span class="component-title">Season Search Mode</span>
|
<span class="component-title">Season Search Mode</span>
|
||||||
<span class="component-desc">
|
<span class="component-desc">
|
||||||
|
<div class="field-pair">
|
||||||
When searching for complete seasons<br>
|
When searching for complete seasons<br>
|
||||||
you can choose to have it look for season<br>
|
you can choose to have it look for season<br>
|
||||||
packs ONLY or choose to have it build a<br>
|
packs ONLY or choose to have it build a<br>
|
||||||
@ -224,14 +234,24 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
|
|||||||
</div>
|
</div>
|
||||||
#end if
|
#end if
|
||||||
|
|
||||||
#if $hasattr($curNzbProvider, 'backlog_only'):
|
#if $hasattr($curNzbProvider, 'enable_daily'):
|
||||||
<div class="field-pair">
|
<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 ""#/>
|
<input type="checkbox" name="${curNzbProvider.getID()}_enable_daily" id="${curNzbProvider.getID()}_enable_daily" #if $curNzbProvider.enable_daily then "checked=\"checked\"" else ""#/>
|
||||||
<label class="clearfix" for="${curNzbProvider.getID()}_backlog_only">
|
<label class="clearfix" for="${curNzbProvider.getID()}_enable_daily">
|
||||||
<span class="component-title">Backlog Only</span>
|
<span class="component-title">Enable Daily Searches</span>
|
||||||
<span class="component-desc">
|
<span class="component-desc">
|
||||||
Sets the provider to only be used for<br>
|
Enables daily searches</span>
|
||||||
backlog searches.</span>
|
</label>
|
||||||
|
</div>
|
||||||
|
#end if
|
||||||
|
|
||||||
|
#if $hasattr($curNzbProvider, 'enable_backlog'):
|
||||||
|
<div class="field-pair">
|
||||||
|
<input type="checkbox" name="${curNzbProvider.getID()}_enable_backlog" id="${curNzbProvider.getID()}_enable_backlog" #if $curNzbProvider.enable_backlog then "checked=\"checked\"" else ""#/>
|
||||||
|
<label class="clearfix" for="${curNzbProvider.getID()}_enable_backlog">
|
||||||
|
<span class="component-title">Enable Backlog Searches</span>
|
||||||
|
<span class="component-desc">
|
||||||
|
Enables backlog searches</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
#end if
|
#end if
|
||||||
@ -440,14 +460,24 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
|
|||||||
</div>
|
</div>
|
||||||
#end if
|
#end if
|
||||||
|
|
||||||
#if $hasattr($curTorrentProvider, 'backlog_only'):
|
#if $hasattr($curTorrentProvider, 'enable_daily'):
|
||||||
<div class="field-pair">
|
<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 ""#/>
|
<input type="checkbox" name="${curTorrentProvider.getID()}_enable_daily" id="${curTorrentProvider.getID()}_enable_daily" #if $curTorrentProvider.enable_daily then "checked=\"checked\"" else ""#/>
|
||||||
<label class="clearfix" for="${curTorrentProvider.getID()}_backlog_only">
|
<label class="clearfix" for="${curTorrentProvider.getID()}_enable_daily">
|
||||||
<span class="component-title">Backlog Only</span>
|
<span class="component-title">Enable Daily Searches</span>
|
||||||
<span class="component-desc">
|
<span class="component-desc">
|
||||||
Sets the provider to only be used for<br>
|
Enables daily searches</span>
|
||||||
backlog searches.</span>
|
</label>
|
||||||
|
</div>
|
||||||
|
#end if
|
||||||
|
|
||||||
|
#if $hasattr($curTorrentProvider, 'enable_backlog'):
|
||||||
|
<div class="field-pair">
|
||||||
|
<input type="checkbox" name="${curTorrentProvider.getID()}_enable_backlog" id="${curTorrentProvider.getID()}_enable_backlog" #if $curTorrentProvider.enable_backlog then "checked=\"checked\"" else ""#/>
|
||||||
|
<label class="clearfix" for="${curTorrentProvider.getID()}_enable_backlog">
|
||||||
|
<span class="component-title">Enable Backlog Searches</span>
|
||||||
|
<span class="component-desc">
|
||||||
|
Enables backlog searches</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
#end if
|
#end if
|
||||||
|
@ -981,10 +981,16 @@ def initialize(consoleLogging=True):
|
|||||||
curTorrentProvider.search_fallback = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
curTorrentProvider.search_fallback = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
||||||
curTorrentProvider.getID() + '_search_fallback',
|
curTorrentProvider.getID() + '_search_fallback',
|
||||||
0))
|
0))
|
||||||
if hasattr(curTorrentProvider, 'backlog_only'):
|
|
||||||
curTorrentProvider.backlog_only = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
if hasattr(curTorrentProvider, 'enable_daily'):
|
||||||
curTorrentProvider.getID() + '_backlog_only',
|
curTorrentProvider.enable_daily = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
||||||
0))
|
curTorrentProvider.getID() + '_enable_daily',
|
||||||
|
1))
|
||||||
|
|
||||||
|
if hasattr(curTorrentProvider, 'enable_backlog'):
|
||||||
|
curTorrentProvider.enable_backlog = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
||||||
|
curTorrentProvider.getID() + '_enable_backlog',
|
||||||
|
1))
|
||||||
|
|
||||||
for curNzbProvider in [curProvider for curProvider in providers.sortedProviderList() if
|
for curNzbProvider in [curProvider for curProvider in providers.sortedProviderList() if
|
||||||
curProvider.providerType == GenericProvider.NZB]:
|
curProvider.providerType == GenericProvider.NZB]:
|
||||||
@ -1004,10 +1010,15 @@ def initialize(consoleLogging=True):
|
|||||||
curNzbProvider.search_fallback = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
|
curNzbProvider.search_fallback = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
|
||||||
curNzbProvider.getID() + '_search_fallback',
|
curNzbProvider.getID() + '_search_fallback',
|
||||||
0))
|
0))
|
||||||
if hasattr(curNzbProvider, 'backlog_only'):
|
if hasattr(curNzbProvider, 'enable_daily'):
|
||||||
curNzbProvider.backlog_only = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
|
curNzbProvider.enable_daily = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
|
||||||
curNzbProvider.getID() + '_backlog_only',
|
curNzbProvider.getID() + '_enable_daily',
|
||||||
0))
|
1))
|
||||||
|
|
||||||
|
if hasattr(curNzbProvider, 'enable_backlog'):
|
||||||
|
curNzbProvider.enable_backlog = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
|
||||||
|
curNzbProvider.getID() + '_enable_backlog',
|
||||||
|
1))
|
||||||
|
|
||||||
if not os.path.isfile(CONFIG_FILE):
|
if not os.path.isfile(CONFIG_FILE):
|
||||||
logger.log(u"Unable to find '" + CONFIG_FILE + "', all settings will be default!", logger.DEBUG)
|
logger.log(u"Unable to find '" + CONFIG_FILE + "', all settings will be default!", logger.DEBUG)
|
||||||
@ -1124,6 +1135,7 @@ def initialize(consoleLogging=True):
|
|||||||
__INITIALIZED__ = True
|
__INITIALIZED__ = True
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
global __INITIALIZED__, backlogSearchScheduler, \
|
global __INITIALIZED__, backlogSearchScheduler, \
|
||||||
showUpdateScheduler, versionCheckScheduler, showQueueScheduler, \
|
showUpdateScheduler, versionCheckScheduler, showQueueScheduler, \
|
||||||
@ -1278,6 +1290,7 @@ def halt():
|
|||||||
__INITIALIZED__ = False
|
__INITIALIZED__ = False
|
||||||
started = False
|
started = False
|
||||||
|
|
||||||
|
|
||||||
def sig_handler(signum=None, frame=None):
|
def sig_handler(signum=None, frame=None):
|
||||||
if type(signum) != type(None):
|
if type(signum) != type(None):
|
||||||
logger.log(u"Signal %i caught, saving and exiting..." % int(signum))
|
logger.log(u"Signal %i caught, saving and exiting..." % int(signum))
|
||||||
@ -1462,9 +1475,12 @@ def save_config():
|
|||||||
if hasattr(curTorrentProvider, 'search_fallback'):
|
if hasattr(curTorrentProvider, 'search_fallback'):
|
||||||
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_search_fallback'] = int(
|
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_search_fallback'] = int(
|
||||||
curTorrentProvider.search_fallback)
|
curTorrentProvider.search_fallback)
|
||||||
if hasattr(curTorrentProvider, 'backlog_only'):
|
if hasattr(curTorrentProvider, 'enable_daily'):
|
||||||
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_backlog_only'] = int(
|
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_enable_daily'] = int(
|
||||||
curTorrentProvider.backlog_only)
|
curTorrentProvider.enable_daily)
|
||||||
|
if hasattr(curTorrentProvider, 'enable_backlog'):
|
||||||
|
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_enable_backlog'] = int(
|
||||||
|
curTorrentProvider.enable_backlog)
|
||||||
|
|
||||||
for curNzbProvider in [curProvider for curProvider in providers.sortedProviderList() if
|
for curNzbProvider in [curProvider for curProvider in providers.sortedProviderList() if
|
||||||
curProvider.providerType == GenericProvider.NZB]:
|
curProvider.providerType == GenericProvider.NZB]:
|
||||||
@ -1483,9 +1499,12 @@ def save_config():
|
|||||||
if hasattr(curNzbProvider, 'search_fallback'):
|
if hasattr(curNzbProvider, 'search_fallback'):
|
||||||
new_config[curNzbProvider.getID().upper()][curNzbProvider.getID() + '_search_fallback'] = int(
|
new_config[curNzbProvider.getID().upper()][curNzbProvider.getID() + '_search_fallback'] = int(
|
||||||
curNzbProvider.search_fallback)
|
curNzbProvider.search_fallback)
|
||||||
if hasattr(curNzbProvider, 'backlog_only'):
|
if hasattr(curNzbProvider, 'enable_daily'):
|
||||||
new_config[curNzbProvider.getID().upper()][curNzbProvider.getID() + '_backlog_only'] = int(
|
new_config[curNzbProvider.getID().upper()][curNzbProvider.getID() + '_enable_daily'] = int(
|
||||||
curNzbProvider.backlog_only)
|
curNzbProvider.enable_daily)
|
||||||
|
if hasattr(curNzbProvider, 'enable_backlog'):
|
||||||
|
new_config[curNzbProvider.getID().upper()][curNzbProvider.getID() + '_enable_backlog'] = int(
|
||||||
|
curNzbProvider.enable_backlog)
|
||||||
|
|
||||||
new_config['NZBs'] = {}
|
new_config['NZBs'] = {}
|
||||||
new_config['NZBs']['nzbs'] = int(NZBS)
|
new_config['NZBs']['nzbs'] = int(NZBS)
|
||||||
|
@ -42,7 +42,7 @@ class DailySearcher():
|
|||||||
|
|
||||||
didSearch = False
|
didSearch = False
|
||||||
|
|
||||||
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive() and not x.backlog_only]
|
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive() and x.enable_daily]
|
||||||
for curProviderCount, curProvider in enumerate(providers):
|
for curProviderCount, curProvider in enumerate(providers):
|
||||||
|
|
||||||
logger.log(u"Updating [" + curProvider.name + "] RSS cache ...")
|
logger.log(u"Updating [" + curProvider.name + "] RSS cache ...")
|
||||||
|
@ -63,6 +63,7 @@ def sortedProviderList():
|
|||||||
|
|
||||||
return newList
|
return newList
|
||||||
|
|
||||||
|
|
||||||
def makeProviderList():
|
def makeProviderList():
|
||||||
return [x.provider for x in [getProviderModule(y) for y in __all__] if x]
|
return [x.provider for x in [getProviderModule(y) for y in __all__] if x]
|
||||||
|
|
||||||
@ -96,6 +97,8 @@ def getNewznabProviderList(data):
|
|||||||
providerDict[curDefault.name].needs_auth = curDefault.needs_auth
|
providerDict[curDefault.name].needs_auth = curDefault.needs_auth
|
||||||
providerDict[curDefault.name].search_mode = curDefault.search_mode
|
providerDict[curDefault.name].search_mode = curDefault.search_mode
|
||||||
providerDict[curDefault.name].search_fallback = curDefault.search_fallback
|
providerDict[curDefault.name].search_fallback = curDefault.search_fallback
|
||||||
|
providerDict[curDefault.name].enable_daily = curDefault.enable_daily
|
||||||
|
providerDict[curDefault.name].enable_backlog = curDefault.enable_backlog
|
||||||
|
|
||||||
return filter(lambda x: x, providerList)
|
return filter(lambda x: x, providerList)
|
||||||
|
|
||||||
@ -106,10 +109,13 @@ def makeNewznabProvider(configString):
|
|||||||
|
|
||||||
search_mode = 'eponly'
|
search_mode = 'eponly'
|
||||||
search_fallback = 0
|
search_fallback = 0
|
||||||
|
enable_daily = 0
|
||||||
|
enable_backlog = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
name, url, key, catIDs, enabled, search_mode, search_fallback = configString.split('|')
|
name, url, key, catIDs, enabled, search_mode, search_fallback, enable_daily, enable_backlog = configString.split(
|
||||||
except ValueError:
|
'|')
|
||||||
|
except ValueError, e:
|
||||||
try:
|
try:
|
||||||
name, url, key, catIDs, enabled = configString.split('|')
|
name, url, key, catIDs, enabled = configString.split('|')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
@ -119,7 +125,8 @@ def makeNewznabProvider(configString):
|
|||||||
newznab = sys.modules['sickbeard.providers.newznab']
|
newznab = sys.modules['sickbeard.providers.newznab']
|
||||||
|
|
||||||
newProvider = newznab.NewznabProvider(name, url, key=key, catIDs=catIDs, search_mode=search_mode,
|
newProvider = newznab.NewznabProvider(name, url, key=key, catIDs=catIDs, search_mode=search_mode,
|
||||||
search_fallback=search_fallback)
|
search_fallback=search_fallback, enable_daily=enable_daily,
|
||||||
|
enable_backlog=enable_backlog)
|
||||||
newProvider.enabled = enabled == '1'
|
newProvider.enabled = enabled == '1'
|
||||||
|
|
||||||
return newProvider
|
return newProvider
|
||||||
@ -146,18 +153,21 @@ def makeTorrentRssProvider(configString):
|
|||||||
cookies = None
|
cookies = None
|
||||||
search_mode = 'eponly'
|
search_mode = 'eponly'
|
||||||
search_fallback = 0
|
search_fallback = 0
|
||||||
backlog_only = 0
|
enable_daily = 0
|
||||||
|
enable_backlog = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
name, url, cookies, enabled, search_mode, search_fallback, backlog_only = configString.split('|')
|
name, url, cookies, enabled, search_mode, search_fallback, enable_daily, enable_backlog = configString.split(
|
||||||
|
'|')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
try:
|
try:
|
||||||
name, url, enabled, search_mode, search_fallback, backlog_only = configString.split('|')
|
name, url, enabled, search_mode, search_fallback, enable_daily, enable_backlog = configString.split('|')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
try:
|
try:
|
||||||
name, url, enabled = configString.split('|')
|
name, url, enabled = configString.split('|')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logger.log(u"Skipping RSS Torrent provider string: '" + configString + "', incorrect format", logger.ERROR)
|
logger.log(u"Skipping RSS Torrent provider string: '" + configString + "', incorrect format",
|
||||||
|
logger.ERROR)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -165,14 +175,15 @@ def makeTorrentRssProvider(configString):
|
|||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
newProvider = torrentRss.TorrentRssProvider(name, url, cookies, search_mode, search_fallback, backlog_only)
|
newProvider = torrentRss.TorrentRssProvider(name, url, cookies, search_mode, search_fallback, enable_daily,
|
||||||
|
enable_backlog)
|
||||||
newProvider.enabled = enabled == '1'
|
newProvider.enabled = enabled == '1'
|
||||||
|
|
||||||
return newProvider
|
return newProvider
|
||||||
|
|
||||||
|
|
||||||
def getDefaultNewznabProviders():
|
def getDefaultNewznabProviders():
|
||||||
return 'Sick Beard Index|http://lolo.sickbeard.com/|0|5030,5040|0|eponly|0!!!NZBs.org|https://nzbs.org/||5030,5040|0|eponly|0!!!Usenet-Crawler|https://www.usenet-crawler.com/||5030,5040|0|eponly|0'
|
return 'Sick Beard Index|http://lolo.sickbeard.com/|0|5030,5040|0|eponly|0|0|0!!!NZBs.org|https://nzbs.org/|0|5030,5040|0|eponly|0|0|0!!!Usenet-Crawler|https://www.usenet-crawler.com/|0|5030,5040|0|eponly|0|0|0'
|
||||||
|
|
||||||
|
|
||||||
def getProviderModule(name):
|
def getProviderModule(name):
|
||||||
|
@ -55,7 +55,8 @@ class GenericProvider:
|
|||||||
|
|
||||||
self.search_mode = None
|
self.search_mode = None
|
||||||
self.search_fallback = False
|
self.search_fallback = False
|
||||||
self.backlog_only = False
|
self.enable_daily = False
|
||||||
|
self.enable_backlog = False
|
||||||
|
|
||||||
self.cache = tvcache.TVCache(self)
|
self.cache = tvcache.TVCache(self)
|
||||||
|
|
||||||
|
@ -33,14 +33,14 @@ from sickbeard import classes
|
|||||||
from sickbeard import helpers
|
from sickbeard import helpers
|
||||||
from sickbeard import scene_exceptions
|
from sickbeard import scene_exceptions
|
||||||
from sickbeard import encodingKludge as ek
|
from sickbeard import encodingKludge as ek
|
||||||
from sickbeard.common import cpu_presets
|
|
||||||
from sickbeard import logger
|
from sickbeard import logger
|
||||||
from sickbeard import tvcache
|
from sickbeard import tvcache
|
||||||
from sickbeard.exceptions import ex, AuthException
|
from sickbeard.exceptions import ex, AuthException
|
||||||
|
|
||||||
|
|
||||||
class NewznabProvider(generic.NZBProvider):
|
class NewznabProvider(generic.NZBProvider):
|
||||||
def __init__(self, name, url, key='', catIDs='5030,5040', search_mode='eponly', search_fallback=False):
|
def __init__(self, name, url, key='', catIDs='5030,5040', search_mode='eponly', search_fallback=False,
|
||||||
|
enable_daily=False, enable_backlog=False):
|
||||||
|
|
||||||
generic.NZBProvider.__init__(self, name)
|
generic.NZBProvider.__init__(self, name)
|
||||||
|
|
||||||
@ -52,6 +52,8 @@ class NewznabProvider(generic.NZBProvider):
|
|||||||
|
|
||||||
self.search_mode = search_mode
|
self.search_mode = search_mode
|
||||||
self.search_fallback = search_fallback
|
self.search_fallback = search_fallback
|
||||||
|
self.enable_daily = enable_daily
|
||||||
|
self.enable_backlog = enable_backlog
|
||||||
|
|
||||||
# a 0 in the key spot indicates that no key is needed
|
# a 0 in the key spot indicates that no key is needed
|
||||||
if self.key == '0':
|
if self.key == '0':
|
||||||
@ -71,10 +73,13 @@ class NewznabProvider(generic.NZBProvider):
|
|||||||
|
|
||||||
def configStr(self):
|
def configStr(self):
|
||||||
return self.name + '|' + self.url + '|' + self.key + '|' + self.catIDs + '|' + str(
|
return self.name + '|' + self.url + '|' + self.key + '|' + self.catIDs + '|' + str(
|
||||||
int(self.enabled)) + '|' + self.search_mode + '|' + str(int(self.search_fallback))
|
int(self.enabled)) + '|' + self.search_mode + '|' + str(int(self.search_fallback)) + '|' + str(
|
||||||
|
int(self.enable_daily)) + '|' + str(int(self.enable_backlog))
|
||||||
|
|
||||||
def imageName(self):
|
def imageName(self):
|
||||||
if ek.ek(os.path.isfile, ek.ek(os.path.join, sickbeard.PROG_DIR, 'gui', sickbeard.GUI_NAME, 'images', 'providers', self.getID() + '.png')):
|
if ek.ek(os.path.isfile,
|
||||||
|
ek.ek(os.path.join, sickbeard.PROG_DIR, 'gui', sickbeard.GUI_NAME, 'images', 'providers',
|
||||||
|
self.getID() + '.png')):
|
||||||
return self.getID() + '.png'
|
return self.getID() + '.png'
|
||||||
return 'newznab.png'
|
return 'newznab.png'
|
||||||
|
|
||||||
@ -136,7 +141,8 @@ class NewznabProvider(generic.NZBProvider):
|
|||||||
to_return.append(params)
|
to_return.append(params)
|
||||||
else:
|
else:
|
||||||
# add new query strings for exceptions
|
# add new query strings for exceptions
|
||||||
name_exceptions = list(set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]))
|
name_exceptions = list(
|
||||||
|
set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]))
|
||||||
for cur_exception in name_exceptions:
|
for cur_exception in name_exceptions:
|
||||||
params['q'] = helpers.sanitizeSceneName(cur_exception)
|
params['q'] = helpers.sanitizeSceneName(cur_exception)
|
||||||
to_return.append(params)
|
to_return.append(params)
|
||||||
@ -234,7 +240,9 @@ class NewznabProvider(generic.NZBProvider):
|
|||||||
# if there are more items available then the amount given in one call, grab some more
|
# if there are more items available then the amount given in one call, grab some more
|
||||||
if (total - params['limit']) > offset == params['offset']:
|
if (total - params['limit']) > offset == params['offset']:
|
||||||
params['offset'] += params['limit']
|
params['offset'] += params['limit']
|
||||||
logger.log(str(total - params['offset']) + " more items to be fetched from provider. Fetching another " + str(params['limit']) + " items.", logger.DEBUG)
|
logger.log(str(
|
||||||
|
total - params['offset']) + " more items to be fetched from provider. Fetching another " + str(
|
||||||
|
params['limit']) + " items.", logger.DEBUG)
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -34,8 +34,10 @@ from lib import requests
|
|||||||
from lib.requests import exceptions
|
from lib.requests import exceptions
|
||||||
from lib.bencode import bdecode
|
from lib.bencode import bdecode
|
||||||
|
|
||||||
|
|
||||||
class TorrentRssProvider(generic.TorrentProvider):
|
class TorrentRssProvider(generic.TorrentProvider):
|
||||||
def __init__(self, name, url, cookies='', search_mode='eponly', search_fallback=False, backlog_only=False):
|
def __init__(self, name, url, cookies='', search_mode='eponly', search_fallback=False, enable_daily=False,
|
||||||
|
enable_backlog=False):
|
||||||
generic.TorrentProvider.__init__(self, name)
|
generic.TorrentProvider.__init__(self, name)
|
||||||
self.cache = TorrentRssCache(self)
|
self.cache = TorrentRssCache(self)
|
||||||
self.url = re.sub('\/$', '', url)
|
self.url = re.sub('\/$', '', url)
|
||||||
@ -46,14 +48,19 @@ class TorrentRssProvider(generic.TorrentProvider):
|
|||||||
|
|
||||||
self.search_mode = search_mode
|
self.search_mode = search_mode
|
||||||
self.search_fallback = search_fallback
|
self.search_fallback = search_fallback
|
||||||
self.backlog_only = backlog_only
|
self.enable_daily = enable_daily
|
||||||
|
self.enable_backlog = enable_backlog
|
||||||
self.cookies = cookies
|
self.cookies = cookies
|
||||||
|
|
||||||
def configStr(self):
|
def configStr(self):
|
||||||
return self.name + '|' + self.url + '|' + self.cookies + '|' + str(int(self.enabled)) + '|' + self.search_mode + '|' + str(int(self.search_fallback)) + '|' + str(int(self.backlog_only))
|
return self.name + '|' + self.url + '|' + self.cookies + '|' + str(
|
||||||
|
int(self.enabled)) + '|' + self.search_mode + '|' + str(int(self.search_fallback)) + '|' + str(
|
||||||
|
int(self.enable_daily)) + '|' + str(int(self.enable_backlog))
|
||||||
|
|
||||||
def imageName(self):
|
def imageName(self):
|
||||||
if ek.ek(os.path.isfile, ek.ek(os.path.join, sickbeard.PROG_DIR, 'gui', sickbeard.GUI_NAME, 'images', 'providers', self.getID() + '.png')):
|
if ek.ek(os.path.isfile,
|
||||||
|
ek.ek(os.path.join, sickbeard.PROG_DIR, 'gui', sickbeard.GUI_NAME, 'images', 'providers',
|
||||||
|
self.getID() + '.png')):
|
||||||
return self.getID() + '.png'
|
return self.getID() + '.png'
|
||||||
return 'torrentrss.png'
|
return 'torrentrss.png'
|
||||||
|
|
||||||
@ -91,7 +98,7 @@ class TorrentRssProvider(generic.TorrentProvider):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if self.cookies:
|
if self.cookies:
|
||||||
cookie_validator=re.compile("^(\w+=\w+)(;\w+=\w+)*$")
|
cookie_validator = re.compile("^(\w+=\w+)(;\w+=\w+)*$")
|
||||||
if not cookie_validator.match(self.cookies):
|
if not cookie_validator.match(self.cookies):
|
||||||
return (False, 'Cookie is not correctly formatted: ' + self.cookies)
|
return (False, 'Cookie is not correctly formatted: ' + self.cookies)
|
||||||
|
|
||||||
@ -144,6 +151,7 @@ class TorrentRssProvider(generic.TorrentProvider):
|
|||||||
def seedRatio(self):
|
def seedRatio(self):
|
||||||
return self.ratio
|
return self.ratio
|
||||||
|
|
||||||
|
|
||||||
class TorrentRssCache(tvcache.TVCache):
|
class TorrentRssCache(tvcache.TVCache):
|
||||||
def __init__(self, provider):
|
def __init__(self, provider):
|
||||||
tvcache.TVCache.__init__(self, provider)
|
tvcache.TVCache.__init__(self, provider)
|
||||||
@ -154,7 +162,7 @@ class TorrentRssCache(tvcache.TVCache):
|
|||||||
|
|
||||||
request_headers = None
|
request_headers = None
|
||||||
if self.provider.cookies:
|
if self.provider.cookies:
|
||||||
request_headers = { 'Cookie': self.provider.cookies }
|
request_headers = {'Cookie': self.provider.cookies}
|
||||||
|
|
||||||
data = self.getRSSFeed(self.provider.url, request_headers=request_headers)
|
data = self.getRSSFeed(self.provider.url, request_headers=request_headers)
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ def searchForNeededEpisodes(show, episodes):
|
|||||||
|
|
||||||
origThreadName = threading.currentThread().name
|
origThreadName = threading.currentThread().name
|
||||||
|
|
||||||
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive() and not x.backlog_only]
|
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive() and x.enable_daily]
|
||||||
for curProviderCount, curProvider in enumerate(providers):
|
for curProviderCount, curProvider in enumerate(providers):
|
||||||
if curProvider.anime_only and not show.is_anime:
|
if curProvider.anime_only and not show.is_anime:
|
||||||
logger.log(u"" + str(show.name) + " is not an anime, skiping", logger.DEBUG)
|
logger.log(u"" + str(show.name) + " is not an anime, skiping", logger.DEBUG)
|
||||||
@ -418,7 +418,7 @@ def searchProviders(show, season, episodes, manualSearch=False):
|
|||||||
|
|
||||||
origThreadName = threading.currentThread().name
|
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 x.enable_backlog]
|
||||||
for providerNum, curProvider in enumerate(providers):
|
for providerNum, curProvider in enumerate(providers):
|
||||||
if curProvider.anime_only and not show.is_anime:
|
if curProvider.anime_only and not show.is_anime:
|
||||||
logger.log(u"" + str(show.name) + " is not an anime, skiping", logger.DEBUG)
|
logger.log(u"" + str(show.name) + " is not an anime, skiping", logger.DEBUG)
|
||||||
|
@ -2161,12 +2161,19 @@ class ConfigProviders(MainHandler):
|
|||||||
except:
|
except:
|
||||||
curTorrentProvider.search_fallback = 0
|
curTorrentProvider.search_fallback = 0
|
||||||
|
|
||||||
if hasattr(curTorrentProvider, 'backlog_only'):
|
if hasattr(curTorrentProvider, 'enable_daily'):
|
||||||
try:
|
try:
|
||||||
curTorrentProvider.backlog_only = config.checkbox_to_value(
|
curTorrentProvider.enable_daily = config.checkbox_to_value(
|
||||||
kwargs[curTorrentProvider.getID() + '_backlog_only'])
|
kwargs[curTorrentProvider.getID() + '_enable_daily'])
|
||||||
except:
|
except:
|
||||||
curTorrentProvider.backlog_only = 0
|
curTorrentProvider.enable_daily = 0
|
||||||
|
|
||||||
|
if hasattr(curTorrentProvider, 'enable_backlog'):
|
||||||
|
try:
|
||||||
|
curTorrentProvider.enable_backlog = config.checkbox_to_value(
|
||||||
|
kwargs[curTorrentProvider.getID() + '_enable_backlog'])
|
||||||
|
except:
|
||||||
|
curTorrentProvider.enable_backlog = 0
|
||||||
|
|
||||||
for curNzbProvider in [curProvider for curProvider in sickbeard.providers.sortedProviderList() if
|
for curNzbProvider in [curProvider for curProvider in sickbeard.providers.sortedProviderList() if
|
||||||
curProvider.providerType == sickbeard.GenericProvider.NZB]:
|
curProvider.providerType == sickbeard.GenericProvider.NZB]:
|
||||||
@ -2196,12 +2203,19 @@ class ConfigProviders(MainHandler):
|
|||||||
except:
|
except:
|
||||||
curNzbProvider.search_fallback = 0
|
curNzbProvider.search_fallback = 0
|
||||||
|
|
||||||
if hasattr(curNzbProvider, 'backlog_only'):
|
if hasattr(curNzbProvider, 'enable_daily'):
|
||||||
try:
|
try:
|
||||||
curNzbProvider.backlog_only = config.checkbox_to_value(
|
curNzbProvider.enable_daily = config.checkbox_to_value(
|
||||||
kwargs[curNzbProvider.getID() + '_backlog_only'])
|
kwargs[curNzbProvider.getID() + '_enable_daily'])
|
||||||
except:
|
except:
|
||||||
curNzbProvider.backlog_only = 0
|
curNzbProvider.enable_daily = 0
|
||||||
|
|
||||||
|
if hasattr(curNzbProvider, 'enable_backlog'):
|
||||||
|
try:
|
||||||
|
curNzbProvider.enable_backlog = config.checkbox_to_value(
|
||||||
|
kwargs[curNzbProvider.getID() + '_enable_backlog'])
|
||||||
|
except:
|
||||||
|
curNzbProvider.enable_backlog = 0
|
||||||
|
|
||||||
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