SplitString don't clean
This commit is contained in:
1 parent
bc8d8dcd04
commit
9bb99319ba
2 files changed
+16
-8
No files matched your search
@@ -181,5 +181,6 @@ def possibleTitles(raw_title):
|
|||||||
def randomString(size = 8, chars = string.ascii_uppercase + string.digits):
|
def randomString(size = 8, chars = string.ascii_uppercase + string.digits):
|
||||||
return ''.join(random.choice(chars) for x in range(size))
|
return ''.join(random.choice(chars) for x in range(size))
|
||||||
|
|
||||||
def splitString(str, split_on = ','):
|
def splitString(str, split_on = ',', clean = True):
|
||||||
return filter(None, [x.strip() for x in str.split(split_on)] if str else [])
|
list = [x.strip() for x in str.split(split_on)] if str else []
|
||||||
|
return filter(None, list) if clean else list
|
||||||
@@ -95,17 +95,24 @@ class Newznab(NZBProvider, RSS):
|
|||||||
|
|
||||||
def getHosts(self):
|
def getHosts(self):
|
||||||
|
|
||||||
uses = splitString(str(self.conf('use')))
|
uses = splitString(str(self.conf('use')), clean = False)
|
||||||
hosts = splitString(self.conf('host'))
|
hosts = splitString(self.conf('host'), clean = False)
|
||||||
api_keys = splitString(self.conf('api_key'))
|
api_keys = splitString(self.conf('api_key'), clean = False)
|
||||||
extra_score = splitString(self.conf('extra_score'))
|
extra_score = splitString(self.conf('extra_score'), clean = False)
|
||||||
|
|
||||||
list = []
|
list = []
|
||||||
for nr in range(len(hosts)):
|
for nr in range(len(hosts)):
|
||||||
|
|
||||||
|
try: key = api_keys[nr]
|
||||||
|
except: key = ''
|
||||||
|
|
||||||
|
try: host = hosts[nr]
|
||||||
|
except: host = ''
|
||||||
|
|
||||||
list.append({
|
list.append({
|
||||||
'use': uses[nr],
|
'use': uses[nr],
|
||||||
'host': hosts[nr],
|
'host': host,
|
||||||
'api_key': api_keys[nr],
|
'api_key': key,
|
||||||
'extra_score': tryInt(extra_score[nr]) if len(extra_score) > nr else 0
|
'extra_score': tryInt(extra_score[nr]) if len(extra_score) > nr else 0
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user