SplitString don't clean

This commit is contained in:
Ruud
2013-06-22 01:37:27 +02:00
parent bc8d8dcd04
commit 9bb99319ba
2 changed files with 16 additions and 8 deletions

View File

@@ -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

View File

@@ -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
})