From 8d368ecf29dbfe476b08ee6dde918242740ad6f6 Mon Sep 17 00:00:00 2001 From: Dean Gardiner Date: Thu, 3 Oct 2013 00:59:15 +1300 Subject: [PATCH] 'searcher.correct_release' can now return a float indicating the weight/accuracy which is used to scale the score. Fix to IPT _buildUrl method. --- couchpotato/core/providers/base.py | 14 ++++++++++++-- .../core/providers/torrent/iptorrents/main.py | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/providers/base.py b/couchpotato/core/providers/base.py index 249ae857..2fc1e389 100644 --- a/couchpotato/core/providers/base.py +++ b/couchpotato/core/providers/base.py @@ -302,12 +302,22 @@ class ResultList(list): new_result = self.fillResult(result) - is_correct_movie = fireEvent('searcher.correct_release', new_result, self.movie, self.quality, + is_correct = fireEvent('searcher.correct_release', new_result, self.movie, self.quality, imdb_results = self.kwargs.get('imdb_results', False), single = True) - if is_correct_movie and new_result['id'] not in self.result_ids: + if is_correct and new_result['id'] not in self.result_ids: + is_correct_weight = float(is_correct) + new_result['score'] += fireEvent('score.calculate', new_result, self.movie, single = True) + old_score = new_result['score'] + new_result['score'] = int(old_score * is_correct_weight) + log.info('Found correct release with weight %.02f, old_score(%d) now scaled to score(%d)', ( + is_correct_weight, + old_score, + new_result['score'] + )) + self.found(new_result) self.result_ids.append(result['id']) diff --git a/couchpotato/core/providers/torrent/iptorrents/main.py b/couchpotato/core/providers/torrent/iptorrents/main.py index 7d358cb9..55fa815f 100644 --- a/couchpotato/core/providers/torrent/iptorrents/main.py +++ b/couchpotato/core/providers/torrent/iptorrents/main.py @@ -33,7 +33,7 @@ class Base(TorrentProvider): cat_ids = self.getCatId(quality_identifier, cat_ids_group) - if not len(cat_ids): + if not cat_ids or not len(cat_ids): log.warning('Unable to find category for quality %s', quality_identifier) return