From bcffc09589297d6a7ab199dc75febc4ca3783434 Mon Sep 17 00:00:00 2001 From: echel0n Date: Thu, 28 Aug 2014 22:16:25 -0700 Subject: [PATCH 01/13] 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. --- .../interfaces/default/config_providers.tmpl | 68 +++++++++++++------ sickbeard/__init__.py | 47 +++++++++---- sickbeard/dailysearcher.py | 2 +- sickbeard/providers/__init__.py | 31 ++++++--- sickbeard/providers/generic.py | 3 +- sickbeard/providers/newznab.py | 20 ++++-- sickbeard/providers/rsstorrent.py | 22 ++++-- sickbeard/search.py | 4 +- sickbeard/webserve.py | 30 +++++--- 9 files changed, 159 insertions(+), 68 deletions(-) diff --git a/gui/slick/interfaces/default/config_providers.tmpl b/gui/slick/interfaces/default/config_providers.tmpl index 453f0213..b1ad67e0 100644 --- a/gui/slick/interfaces/default/config_providers.tmpl +++ b/gui/slick/interfaces/default/config_providers.tmpl @@ -156,14 +156,24 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#; #end if - #if $hasattr($curNewznabProvider, 'backlog_only'): + #if $hasattr($curNewznabProvider, 'enable_daily'):
- -
+ #end if + + #if $hasattr($curNewznabProvider, 'enable_backlog'): +
+ +
#end if @@ -183,10 +193,10 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#; #end if #if $hasattr($curNewznabProvider, 'search_mode'): -
#end if - #if $hasattr($curTorrentProvider, 'backlog_only'): + #if $hasattr($curTorrentProvider, 'enable_daily'):
- -
+ #end if + + #if $hasattr($curTorrentProvider, 'enable_backlog'): +
+ +
#end if diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index c9390ac2..8b13f599 100755 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -981,10 +981,16 @@ def initialize(consoleLogging=True): curTorrentProvider.search_fallback = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(), 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)) + + if hasattr(curTorrentProvider, 'enable_daily'): + curTorrentProvider.enable_daily = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(), + 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 curProvider.providerType == GenericProvider.NZB]: @@ -1004,10 +1010,15 @@ def initialize(consoleLogging=True): 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)) + if hasattr(curNzbProvider, 'enable_daily'): + curNzbProvider.enable_daily = bool(check_setting_int(CFG, curNzbProvider.getID().upper(), + curNzbProvider.getID() + '_enable_daily', + 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): 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 return True + def start(): global __INITIALIZED__, backlogSearchScheduler, \ showUpdateScheduler, versionCheckScheduler, showQueueScheduler, \ @@ -1278,6 +1290,7 @@ def halt(): __INITIALIZED__ = False started = False + def sig_handler(signum=None, frame=None): if type(signum) != type(None): logger.log(u"Signal %i caught, saving and exiting..." % int(signum)) @@ -1462,9 +1475,12 @@ 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) + if hasattr(curTorrentProvider, 'enable_daily'): + new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_enable_daily'] = int( + 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 curProvider.providerType == GenericProvider.NZB]: @@ -1483,9 +1499,12 @@ def save_config(): 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) + if hasattr(curNzbProvider, 'enable_daily'): + new_config[curNzbProvider.getID().upper()][curNzbProvider.getID() + '_enable_daily'] = int( + 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']['nzbs'] = int(NZBS) diff --git a/sickbeard/dailysearcher.py b/sickbeard/dailysearcher.py index e7c4d13e..02460084 100644 --- a/sickbeard/dailysearcher.py +++ b/sickbeard/dailysearcher.py @@ -42,7 +42,7 @@ class DailySearcher(): 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): logger.log(u"Updating [" + curProvider.name + "] RSS cache ...") diff --git a/sickbeard/providers/__init__.py b/sickbeard/providers/__init__.py index 0076a0cf..45ee4d60 100755 --- a/sickbeard/providers/__init__.py +++ b/sickbeard/providers/__init__.py @@ -11,7 +11,7 @@ # SickRage is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with SickRage. If not, see . @@ -63,6 +63,7 @@ def sortedProviderList(): return newList + def makeProviderList(): 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].search_mode = curDefault.search_mode 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) @@ -106,10 +109,13 @@ def makeNewznabProvider(configString): search_mode = 'eponly' search_fallback = 0 + enable_daily = 0 + enable_backlog = 0 try: - name, url, key, catIDs, enabled, search_mode, search_fallback = configString.split('|') - except ValueError: + name, url, key, catIDs, enabled, search_mode, search_fallback, enable_daily, enable_backlog = configString.split( + '|') + except ValueError, e: try: name, url, key, catIDs, enabled = configString.split('|') except ValueError: @@ -119,7 +125,8 @@ def makeNewznabProvider(configString): newznab = sys.modules['sickbeard.providers.newznab'] 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' return newProvider @@ -146,18 +153,21 @@ def makeTorrentRssProvider(configString): cookies = None search_mode = 'eponly' search_fallback = 0 - backlog_only = 0 + enable_daily = 0 + enable_backlog = 0 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: 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: try: name, url, enabled = configString.split('|') 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 try: @@ -165,14 +175,15 @@ def makeTorrentRssProvider(configString): except: 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' return newProvider 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): diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index 6241e2a8..c638d939 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -55,7 +55,8 @@ class GenericProvider: self.search_mode = None self.search_fallback = False - self.backlog_only = False + self.enable_daily = False + self.enable_backlog = False self.cache = tvcache.TVCache(self) diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index 9065efc5..bd9d41e2 100755 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -33,14 +33,14 @@ from sickbeard import classes from sickbeard import helpers from sickbeard import scene_exceptions from sickbeard import encodingKludge as ek -from sickbeard.common import cpu_presets from sickbeard import logger from sickbeard import tvcache from sickbeard.exceptions import ex, AuthException 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) @@ -52,6 +52,8 @@ class NewznabProvider(generic.NZBProvider): self.search_mode = search_mode 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 if self.key == '0': @@ -71,10 +73,13 @@ class NewznabProvider(generic.NZBProvider): def configStr(self): 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): - 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 'newznab.png' @@ -136,7 +141,8 @@ class NewznabProvider(generic.NZBProvider): to_return.append(params) else: # 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: params['q'] = helpers.sanitizeSceneName(cur_exception) 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 (total - params['limit']) > offset == params['offset']: 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: break diff --git a/sickbeard/providers/rsstorrent.py b/sickbeard/providers/rsstorrent.py index 936b4623..b793c228 100644 --- a/sickbeard/providers/rsstorrent.py +++ b/sickbeard/providers/rsstorrent.py @@ -34,8 +34,10 @@ from lib import requests from lib.requests import exceptions from lib.bencode import bdecode + 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) self.cache = TorrentRssCache(self) self.url = re.sub('\/$', '', url) @@ -46,14 +48,19 @@ class TorrentRssProvider(generic.TorrentProvider): self.search_mode = search_mode self.search_fallback = search_fallback - self.backlog_only = backlog_only + self.enable_daily = enable_daily + self.enable_backlog = enable_backlog self.cookies = cookies 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): - 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 'torrentrss.png' @@ -91,12 +98,12 @@ class TorrentRssProvider(generic.TorrentProvider): try: 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): return (False, 'Cookie is not correctly formatted: ' + self.cookies) items = self.cache._getDailyData() - + if not len(items) > 0: return (False, 'No items found in the RSS feed ' + self.url) @@ -144,6 +151,7 @@ class TorrentRssProvider(generic.TorrentProvider): def seedRatio(self): return self.ratio + class TorrentRssCache(tvcache.TVCache): def __init__(self, provider): tvcache.TVCache.__init__(self, provider) @@ -154,7 +162,7 @@ class TorrentRssCache(tvcache.TVCache): request_headers = None 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) diff --git a/sickbeard/search.py b/sickbeard/search.py index 0668c216..f3355fb4 100644 --- a/sickbeard/search.py +++ b/sickbeard/search.py @@ -343,7 +343,7 @@ def searchForNeededEpisodes(show, episodes): 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): if curProvider.anime_only and not show.is_anime: 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 - 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): if curProvider.anime_only and not show.is_anime: logger.log(u"" + str(show.name) + " is not an anime, skiping", logger.DEBUG) diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 5c24086f..72b29b2b 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -2161,12 +2161,19 @@ class ConfigProviders(MainHandler): except: curTorrentProvider.search_fallback = 0 - if hasattr(curTorrentProvider, 'backlog_only'): + if hasattr(curTorrentProvider, 'enable_daily'): try: - curTorrentProvider.backlog_only = config.checkbox_to_value( - kwargs[curTorrentProvider.getID() + '_backlog_only']) + curTorrentProvider.enable_daily = config.checkbox_to_value( + kwargs[curTorrentProvider.getID() + '_enable_daily']) 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 curProvider.providerType == sickbeard.GenericProvider.NZB]: @@ -2196,12 +2203,19 @@ class ConfigProviders(MainHandler): except: curNzbProvider.search_fallback = 0 - if hasattr(curNzbProvider, 'backlog_only'): + if hasattr(curNzbProvider, 'enable_daily'): try: - curNzbProvider.backlog_only = config.checkbox_to_value( - kwargs[curNzbProvider.getID() + '_backlog_only']) + curNzbProvider.enable_daily = config.checkbox_to_value( + kwargs[curNzbProvider.getID() + '_enable_daily']) 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.PROVIDER_ORDER = provider_list From 18efdb2370a973fb6d55a9200a39501f130c3bab Mon Sep 17 00:00:00 2001 From: echel0n Date: Thu, 28 Aug 2014 22:22:55 -0700 Subject: [PATCH 02/13] Fixed TorrentSearchResult instance has no attribute 'content' errpr --- sickbeard/classes.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sickbeard/classes.py b/sickbeard/classes.py index 3622d6ea..962df06e 100644 --- a/sickbeard/classes.py +++ b/sickbeard/classes.py @@ -148,8 +148,10 @@ class TorrentSearchResult(SearchResult): resultType = "torrent" # torrent hash + content = None hash = None + class AllShowsListUI: """ This class is for indexer api. Instead of prompting with a UI to pick the @@ -178,7 +180,7 @@ class AllShowsListUI: seriesnames.append(curShow['seriesname']) if 'aliasnames' in curShow: seriesnames.extend(curShow['aliasnames'].split('|')) - + for name in seriesnames: if searchterm.lower() in name.lower(): if 'firstaired' not in curShow: @@ -192,6 +194,7 @@ class AllShowsListUI: return searchResults + class ShowListUI: """ This class is for tvdb-api. Instead of prompting with a UI to pick the @@ -225,7 +228,7 @@ class Proper: self.quality = Quality.UNKNOWN self.release_group = None self.version = -1 - + self.show = show self.indexer = None self.indexerid = -1 From ae5644ba91c36b475d46bb24f4b6368b137f4f04 Mon Sep 17 00:00:00 2001 From: echel0n Date: Thu, 28 Aug 2014 22:30:30 -0700 Subject: [PATCH 03/13] Fix for migrating to new newznab provider config format --- sickbeard/providers/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sickbeard/providers/__init__.py b/sickbeard/providers/__init__.py index 45ee4d60..3ae9c75d 100755 --- a/sickbeard/providers/__init__.py +++ b/sickbeard/providers/__init__.py @@ -115,12 +115,16 @@ def makeNewznabProvider(configString): try: name, url, key, catIDs, enabled, search_mode, search_fallback, enable_daily, enable_backlog = configString.split( '|') - except ValueError, e: + except ValueError: try: - name, url, key, catIDs, enabled = configString.split('|') + name, url, key, catIDs, enabled, search_mode, search_fallback, enable_backlog = configString.split( + '|') except ValueError: - logger.log(u"Skipping Newznab provider string: '" + configString + "', incorrect format", logger.ERROR) - return None + try: + name, url, key, catIDs, enabled = configString.split('|') + except ValueError: + logger.log(u"Skipping Newznab provider string: '" + configString + "', incorrect format", logger.ERROR) + return None newznab = sys.modules['sickbeard.providers.newznab'] From 6fd19de7e23627785b31283c6d3d69c254f80181 Mon Sep 17 00:00:00 2001 From: echel0n Date: Thu, 28 Aug 2014 22:52:02 -0700 Subject: [PATCH 04/13] Fix for migrating to new newznab and torrent provider config formats --- sickbeard/providers/__init__.py | 43 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/sickbeard/providers/__init__.py b/sickbeard/providers/__init__.py index 3ae9c75d..e4b97e7d 100755 --- a/sickbeard/providers/__init__.py +++ b/sickbeard/providers/__init__.py @@ -113,18 +113,18 @@ def makeNewznabProvider(configString): enable_backlog = 0 try: - name, url, key, catIDs, enabled, search_mode, search_fallback, enable_daily, enable_backlog = configString.split( - '|') + values = configString.split('|') + if len(values) == 9: + name, url, key, catIDs, enabled, search_mode, search_fallback, enable_daily, enable_backlog = values + else: + name = values[0] + url = values[1] + key = values[2] + catIDs = values[3] + enabled = values[4] except ValueError: - try: - name, url, key, catIDs, enabled, search_mode, search_fallback, enable_backlog = configString.split( - '|') - except ValueError: - try: - name, url, key, catIDs, enabled = configString.split('|') - except ValueError: - logger.log(u"Skipping Newznab provider string: '" + configString + "', incorrect format", logger.ERROR) - return None + logger.log(u"Skipping Newznab provider string: '" + configString + "', incorrect format", logger.ERROR) + return None newznab = sys.modules['sickbeard.providers.newznab'] @@ -161,18 +161,17 @@ def makeTorrentRssProvider(configString): enable_backlog = 0 try: - name, url, cookies, enabled, search_mode, search_fallback, enable_daily, enable_backlog = configString.split( - '|') + values = configString.split('|') + if len(values) == 8: + name, url, cookies, enabled, search_mode, search_fallback, enable_daily, enable_backlog = values + else: + name = values[0] + url = values[1] + enabled = values[3] except ValueError: - try: - name, url, enabled, search_mode, search_fallback, enable_daily, enable_backlog = configString.split('|') - except ValueError: - try: - name, url, enabled = configString.split('|') - except ValueError: - logger.log(u"Skipping RSS Torrent provider string: '" + configString + "', incorrect format", - logger.ERROR) - return None + logger.log(u"Skipping RSS Torrent provider string: '" + configString + "', incorrect format", + logger.ERROR) + return None try: torrentRss = sys.modules['sickbeard.providers.rsstorrent'] From ea66c2c41be7b9e68e1b3a7828b663b635bbdbe7 Mon Sep 17 00:00:00 2001 From: echel0n Date: Thu, 28 Aug 2014 23:15:51 -0700 Subject: [PATCH 05/13] Newznab providers now search by tvrage ID if available and show name incase tvrage ID doesnt return any results --- sickbeard/providers/newznab.py | 36 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index bd9d41e2..c751517d 100755 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -104,16 +104,17 @@ class NewznabProvider(generic.NZBProvider): # search rid = helpers.mapIndexersToShow(ep_obj.show)[2] if rid: - cur_params['rid'] = rid + cur_return = cur_params.copy() + cur_return['rid'] = rid + to_return.append(cur_return) + + # add new query strings for exceptions + name_exceptions = list( + set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name])) + for cur_exception in name_exceptions: + if 'q' in cur_params: + cur_params['q'] = helpers.sanitizeSceneName(cur_exception) + '.' + cur_params['q'] to_return.append(cur_params) - else: - # add new query strings for exceptions - name_exceptions = list( - set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name])) - for cur_exception in name_exceptions: - if 'q' in cur_params: - cur_params['q'] = helpers.sanitizeSceneName(cur_exception) + '.' + cur_params['q'] - to_return.append(cur_params) return to_return @@ -137,15 +138,16 @@ class NewznabProvider(generic.NZBProvider): # search rid = helpers.mapIndexersToShow(ep_obj.show)[2] if rid: - params['rid'] = rid + cur_return = params.copy() + cur_return['rid'] = rid + to_return.append(cur_return) + + # add new query strings for exceptions + name_exceptions = list( + set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name])) + for cur_exception in name_exceptions: + params['q'] = helpers.sanitizeSceneName(cur_exception) to_return.append(params) - else: - # add new query strings for exceptions - name_exceptions = list( - set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name])) - for cur_exception in name_exceptions: - params['q'] = helpers.sanitizeSceneName(cur_exception) - to_return.append(params) return to_return From 3cb1c573a3166f747ac1dd0880a12256eebc81da Mon Sep 17 00:00:00 2001 From: echel0n Date: Fri, 29 Aug 2014 03:29:56 -0700 Subject: [PATCH 06/13] Fix for newznab provider settings not saving properly Added new show option, delete now removes show from showlist and deletes from hard drive, remove will just remove show from showlist but leave files on hard drive untouched --- .../interfaces/default/config_providers.tmpl | 12 ++-- gui/slick/interfaces/default/inc_top.tmpl | 1 + sickbeard/__init__.py | 4 +- sickbeard/browser.py | 8 ++- sickbeard/tv.py | 22 ++++++- sickbeard/webserve.py | 62 ++++++++++++++----- 6 files changed, 83 insertions(+), 26 deletions(-) diff --git a/gui/slick/interfaces/default/config_providers.tmpl b/gui/slick/interfaces/default/config_providers.tmpl index b1ad67e0..b0aae4eb 100644 --- a/gui/slick/interfaces/default/config_providers.tmpl +++ b/gui/slick/interfaces/default/config_providers.tmpl @@ -193,19 +193,19 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#; #end if #if $hasattr($curNewznabProvider, 'search_mode'): +