diff --git a/couchpotato/core/helpers/variable.py b/couchpotato/core/helpers/variable.py index ab44655f..fa8a8b51 100644 --- a/couchpotato/core/helpers/variable.py +++ b/couchpotato/core/helpers/variable.py @@ -181,5 +181,6 @@ def possibleTitles(raw_title): def randomString(size = 8, chars = string.ascii_uppercase + string.digits): return ''.join(random.choice(chars) for x in range(size)) -def splitString(str, split_on = ','): - return filter(None, [x.strip() for x in str.split(split_on)] if str else []) +def splitString(str, split_on = ',', clean = True): + list = [x.strip() for x in str.split(split_on)] if str else [] + return filter(None, list) if clean else list diff --git a/couchpotato/core/providers/nzb/newznab/main.py b/couchpotato/core/providers/nzb/newznab/main.py index c57dfeb9..8eb3e84e 100644 --- a/couchpotato/core/providers/nzb/newznab/main.py +++ b/couchpotato/core/providers/nzb/newznab/main.py @@ -95,17 +95,24 @@ class Newznab(NZBProvider, RSS): def getHosts(self): - uses = splitString(str(self.conf('use'))) - hosts = splitString(self.conf('host')) - api_keys = splitString(self.conf('api_key')) - extra_score = splitString(self.conf('extra_score')) + uses = splitString(str(self.conf('use')), clean = False) + hosts = splitString(self.conf('host'), clean = False) + api_keys = splitString(self.conf('api_key'), clean = False) + extra_score = splitString(self.conf('extra_score'), clean = False) list = [] for nr in range(len(hosts)): + + try: key = api_keys[nr] + except: key = '' + + try: host = hosts[nr] + except: host = '' + list.append({ 'use': uses[nr], - 'host': hosts[nr], - 'api_key': api_keys[nr], + 'host': host, + 'api_key': key, 'extra_score': tryInt(extra_score[nr]) if len(extra_score) > nr else 0 })