Scheduler

NZBmatrix, newznab
Scores
This commit is contained in:
Ruud committed 2011-04-17 23:36:23 +02:00
1 parent 9524306739
commit 7837adec1d
38 files changed
+856 -219

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
from couchpotato.core.event import addEvent
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from couchpotato.core.plugins.score.scores import nameScore, nameRatioScore
log = CPLog(__name__)
class Score(Plugin):
def __init__(self):
addEvent('score.calculate', self.calculate)
def calculate(self, nzb, movie):
''' Calculate the score of a NZB, used for sorting later '''
score = nameScore(nzb['name'], movie['library']['year'])
for movie_title in movie['library']['titles']:
score += nameRatioScore(nzb['name'], movie_title['title'])
return score