Browse Source

Better scoring and don't download releases with low score

pull/460/merge
Ruud 13 years ago
parent
commit
b87c9ebc63
  1. 2
      couchpotato/core/plugins/quality/main.py
  2. 5
      couchpotato/core/plugins/score/main.py
  3. 15
      couchpotato/core/plugins/score/scores.py
  4. 17
      couchpotato/core/plugins/searcher/main.py

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

@ -26,7 +26,7 @@ class QualityPlugin(Plugin):
{'identifier': 'r5', 'size': (600, 1000), 'label': 'R5', 'alternative': [], 'allow': ['dvdr'], 'ext':['avi', 'mpg', 'mpeg']},
{'identifier': 'tc', 'size': (600, 1000), 'label': 'TeleCine', 'alternative': ['telecine'], 'allow': [], 'ext':['avi', 'mpg', 'mpeg']},
{'identifier': 'ts', 'size': (600, 1000), 'label': 'TeleSync', 'alternative': ['telesync'], 'allow': [], 'ext':['avi', 'mpg', 'mpeg']},
{'identifier': 'cam', 'size': (600, 1000), 'label': 'Cam', 'alternative': [], 'allow': [], 'ext':['avi', 'mpg', 'mpeg']}
{'identifier': 'cam', 'size': (600, 1000), 'label': 'Cam', 'alternative': ['camrip', 'hdcam'], 'allow': [], 'ext':['avi', 'mpg', 'mpeg']}
]
pre_releases = ['cam', 'ts', 'tc', 'r5', 'scr']

5
couchpotato/core/plugins/score/main.py

@ -4,7 +4,7 @@ from couchpotato.core.helpers.variable import getTitle
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from couchpotato.core.plugins.score.scores import nameScore, nameRatioScore, \
sizeScore, providerScore, duplicateScore
sizeScore, providerScore, duplicateScore, partialIgnoredScore
log = CPLog(__name__)
@ -38,6 +38,9 @@ class Score(Plugin):
# Duplicates in name
score += duplicateScore(nzb['name'], getTitle(movie['library']))
# Partial ignored words
score += partialIgnoredScore(nzb['name'], getTitle(movie['library']))
# Extra provider specific check
extra_score = nzb.get('extra_score')
if extra_score:

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

@ -79,3 +79,18 @@ def duplicateScore(nzb_name, movie_name):
duplicates = [x for i, x in enumerate(nzb_words) if nzb_words[i:].count(x) > 1]
return len(list(set(duplicates) - set(movie_words))) * -4
def partialIgnoredScore(nzb_name, movie_name):
nzb_name = nzb_name.lower()
movie_name = movie_name.lower()
ignored_words = [x.strip().lower() for x in Env.setting('ignored_words', section = 'searcher').split(',')]
score = 0
for ignored_word in ignored_words:
if ignored_word in nzb_name and ignored_word not in movie_name:
score -= 5
return score

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

@ -145,6 +145,9 @@ class Searcher(Plugin):
for nzb in sorted_results:
if nzb['score'] <= 0:
log.debug('No more releases with score higher than 0')
break
downloaded = self.download(data = nzb, movie = movie)
if downloaded is True:
ret = True
@ -245,7 +248,7 @@ class Searcher(Plugin):
log.info("Wrong: '%s' blacklisted words: %s" % (nzb['name'], ", ".join(blacklisted)))
return False
pron_tags = ['xxx', 'sex', 'anal', 'tits', 'fuck', 'porn', 'orgy', 'milf', 'boobs']
pron_tags = ['xxx', 'sex', 'anal', 'tits', 'fuck', 'porn', 'orgy', 'milf', 'boobs', 'erotica', 'erotic']
for p_tag in pron_tags:
if p_tag in nzb_words and p_tag not in movie_words:
log.info('Wrong: %s, probably pr0n', (nzb['name']))
@ -406,16 +409,18 @@ class Searcher(Plugin):
if dates.get('theater') - 604800 < now:
return True
else:
# 6 weeks after theater release
if dates.get('theater') + 3628800 < now:
# 12 weeks after theater release
if dates.get('theater') > 0 and dates.get('theater') + 7257600 < now:
return True
# 6 weeks before dvd release
if dates.get('dvd') - 3628800 < now:
if dates.get('dvd') > 0:
# 3 weeks before dvd release
if dates.get('dvd') - 1814400 < now:
return True
# Dvd should be released
if dates.get('dvd') > 0 and dates.get('dvd') < now:
if dates.get('dvd') < now:
return True

Loading…
Cancel
Save