Browse Source

Properly split and strip words. fixes #137

tags/build/2.0.0.pre1
Ruud 13 years ago
parent
commit
ac15df31d8
  1. 4
      couchpotato/core/notifications/core/main.py
  2. 2
      couchpotato/core/notifications/notifymyandroid/main.py
  3. 2
      couchpotato/core/notifications/notifymywp/main.py
  4. 2
      couchpotato/core/plugins/manage/main.py
  5. 6
      couchpotato/core/plugins/movie/main.py
  6. 2
      couchpotato/core/plugins/score/scores.py
  7. 4
      couchpotato/core/plugins/searcher/main.py
  8. 6
      couchpotato/core/providers/nzb/newznab/main.py

4
couchpotato/core/notifications/core/main.py

@ -56,7 +56,7 @@ class CoreNotifier(Notification):
addEvent('library.update_finish', lambda data: fireEvent('notify.frontend', type = 'library.update', data = data))
def markAsRead(self):
ids = getParam('ids').split(',')
ids = [x.strip() for x in getParam('ids').split(',')]
db = get_session()
@ -78,7 +78,7 @@ class CoreNotifier(Notification):
q = db.query(Notif)
if limit_offset:
splt = limit_offset.split(',')
splt = [x.strip() for x in limit_offset.split(',')]
limit = splt[0]
offset = 0 if len(splt) is 1 else splt[1]
q = q.limit(limit).offset(offset)

2
couchpotato/core/notifications/notifymyandroid/main.py

@ -11,7 +11,7 @@ class NotifyMyAndroid(Notification):
if self.isDisabled(): return
nma = pynma.PyNMA()
keys = self.conf('api_key').split(',')
keys = [x.strip() for x in self.conf('api_key').split(',')]
nma.addkey(keys)
nma.developerkey(self.conf('dev_key'))

2
couchpotato/core/notifications/notifymywp/main.py

@ -10,7 +10,7 @@ class NotifyMyWP(Notification):
def notify(self, message = '', data = {}):
if self.isDisabled(): return
keys = self.conf('api_key').split(',')
keys = [x.strip() for x in self.conf('api_key').split(',')]
p = PyNMWP(keys, self.conf('dev_key'))
response = p.push(application = self.default_title, event = message, description = message, priority = self.conf('priority'), batch_mode = len(keys) > 1)

2
couchpotato/core/plugins/manage/main.py

@ -77,6 +77,6 @@ class Manage(Plugin):
def directories(self):
try:
return self.conf('library', default = '').split('::')
return [x.strip() for x in self.conf('library', default = '').split('::')]
except:
return []

6
couchpotato/core/plugins/movie/main.py

@ -139,7 +139,7 @@ class MoviePlugin(Plugin):
if limit_offset:
splt = limit_offset.split(',')
splt = [x.strip() for x in limit_offset.split(',')]
limit = splt[0]
offset = 0 if len(splt) is 1 else splt[1]
q2 = q2.limit(limit).offset(offset)
@ -324,7 +324,7 @@ class MoviePlugin(Plugin):
available_status = fireEvent('status.get', 'available', single = True)
ids = params.get('id').split(',')
ids = [x.strip() for x in params.get('id').split(',')]
for movie_id in ids:
m = db.query(Movie).filter_by(id = movie_id).first()
@ -356,7 +356,7 @@ class MoviePlugin(Plugin):
params = getParams()
ids = params.get('id').split(',')
ids = [x.strip() for x in params.get('id').split(',')]
for movie_id in ids:
self.delete(movie_id)

2
couchpotato/core/plugins/score/scores.py

@ -40,7 +40,7 @@ def nameScore(name, year):
# Contains preferred word
nzb_words = re.split('\W+', simplifyString(name))
preferred_words = Env.setting('preferred_words', section = 'searcher').split(',')
preferred_words = [x.strip() for x in Env.setting('preferred_words', section = 'searcher').split(',')]
for word in preferred_words:
if word.strip() and word.strip().lower() in nzb_words:
score = score + 100

4
couchpotato/core/plugins/searcher/main.py

@ -192,13 +192,13 @@ class Searcher(Plugin):
movie_name = simplifyString(nzb['name'])
nzb_words = re.split('\W+', movie_name)
required_words = self.conf('required_words').split(',')
required_words = [x.strip() for x in self.conf('required_words').split(',')]
if self.conf('required_words') and not list(set(nzb_words) & set(required_words)):
log.info("NZB doesn't contain any of the required words.")
return False
ignored_words = self.conf('ignored_words').split(',')
ignored_words = [x.strip() for x in self.conf('ignored_words').split(',')]
blacklisted = list(set(nzb_words) & set(ignored_words))
if self.conf('ignored_words') and blacklisted:
log.info("Wrong: '%s' blacklisted words: %s" % (nzb['name'], ", ".join(blacklisted)))

6
couchpotato/core/providers/nzb/newznab/main.py

@ -157,9 +157,9 @@ class Newznab(NZBProvider, RSS):
def getHosts(self):
uses = str(self.conf('use')).split(',')
hosts = self.conf('host').split(',')
api_keys = self.conf('api_key').split(',')
uses = [x.strip() for x in str(self.conf('use')).split(',')]
hosts = [x.strip() for x in self.conf('host').split(',')]
api_keys = [x.strip() for x in self.conf('api_key').split(',')]
list = []
for nr in range(len(hosts)):

Loading…
Cancel
Save