From 550051b3f6b6b8a27f126dddb62f34f1e7ce2caf Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 26 Oct 2013 15:09:30 +0200 Subject: [PATCH] Use order for quality allow calculation. fix #2396 --- couchpotato/core/plugins/quality/main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/quality/main.py b/couchpotato/core/plugins/quality/main.py index 66e59f9..4ce8b70 100644 --- a/couchpotato/core/plugins/quality/main.py +++ b/couchpotato/core/plugins/quality/main.py @@ -31,6 +31,7 @@ class QualityPlugin(Plugin): pre_releases = ['cam', 'ts', 'tc', 'r5', 'scr'] cached_qualities = None + cached_order = None def __init__(self): addEvent('quality.all', self.all) @@ -266,6 +267,12 @@ class QualityPlugin(Plugin): score[quality['identifier']] += add_score + # Set order for allow calculation (and cache) + if not self.cached_order: + self.cached_order = {} + for q in self.qualities: + self.cached_order[q.get('identifier')] = self.qualities.index(q) + if add_score != 0: for allow in quality.get('allow', []): - score[allow] -= 40 + score[allow] -= 40 if self.cached_order[allow] < self.cached_order[quality['identifier']] else 5