From 550051b3f6b6b8a27f126dddb62f34f1e7ce2caf Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 26 Oct 2013 15:09:30 +0200 Subject: [PATCH 01/10] 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 66e59f9a..4ce8b706 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 From ce47429701a494f9e23d12ecc6b8269502857b97 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 26 Oct 2013 15:12:54 +0200 Subject: [PATCH 02/10] Only show n/a if undefined --- couchpotato/core/media/movie/_base/static/movie.actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/movie/_base/static/movie.actions.js b/couchpotato/core/media/movie/_base/static/movie.actions.js index 0e9e5bf1..c13cdf10 100644 --- a/couchpotato/core/media/movie/_base/static/movie.actions.js +++ b/couchpotato/core/media/movie/_base/static/movie.actions.js @@ -381,7 +381,7 @@ MA.Release = new Class({ }, get: function(release, type){ - return release.info[type] || 'n/a' + return release.info[type] !== undefined ? release.info[type] : 'n/a' }, download: function(release){ From 4f4ba470e07837065a9b5939581ebb2b26b2dc2e Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 26 Oct 2013 15:26:19 +0200 Subject: [PATCH 03/10] Prevent files keyerror for release_download files. fix #2392 --- couchpotato/core/plugins/renamer/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer/main.py index 3efeb539..4aa0f20b 100755 --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer/main.py @@ -136,8 +136,8 @@ class Renamer(Plugin): movie_folder = movie_folder.rstrip(os.path.sep) folder = os.path.dirname(movie_folder) - if release_download['files']: - files = release_download['files'].split('|') + if release_download.get('files', ''): + files = splitString(release_download['files'], '|') # If there is only one file in the torrent, the downloader did not create a subfolder if len(files) == 1: From cc32bd7050d05e35ce3215b22b8b0422e641f4ee Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 27 Oct 2013 19:22:58 +0100 Subject: [PATCH 04/10] OMGWTF https url --- couchpotato/core/providers/nzb/omgwtfnzbs/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/providers/nzb/omgwtfnzbs/main.py b/couchpotato/core/providers/nzb/omgwtfnzbs/main.py index 0a18b8f4..8acc1a06 100644 --- a/couchpotato/core/providers/nzb/omgwtfnzbs/main.py +++ b/couchpotato/core/providers/nzb/omgwtfnzbs/main.py @@ -14,7 +14,7 @@ log = CPLog(__name__) class OMGWTFNZBs(NZBProvider, RSS): urls = { - 'search': 'http://rss.omgwtfnzbs.org/rss-search.php?%s', + 'search': 'https://rss.omgwtfnzbs.org/rss-search.php?%s', } http_time_between_calls = 1 #seconds From 82b879fbb4e33b75825c7cd413bbb750c3a2f259 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 27 Oct 2013 19:50:26 +0100 Subject: [PATCH 05/10] Add proper detail url for OMGWTF --- couchpotato/core/providers/nzb/omgwtfnzbs/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/providers/nzb/omgwtfnzbs/main.py b/couchpotato/core/providers/nzb/omgwtfnzbs/main.py index 8acc1a06..8cc4a3eb 100644 --- a/couchpotato/core/providers/nzb/omgwtfnzbs/main.py +++ b/couchpotato/core/providers/nzb/omgwtfnzbs/main.py @@ -15,6 +15,7 @@ class OMGWTFNZBs(NZBProvider, RSS): urls = { 'search': 'https://rss.omgwtfnzbs.org/rss-search.php?%s', + 'detail_url': 'https://omgwtfnzbs.org/details.php?id=%s', } http_time_between_calls = 1 #seconds @@ -49,13 +50,14 @@ class OMGWTFNZBs(NZBProvider, RSS): for nzb in nzbs: enclosure = self.getElement(nzb, 'enclosure').attrib + nzb_id = parse_qs(urlparse(self.getTextElement(nzb, 'link')).query).get('id')[0] results.append({ - 'id': parse_qs(urlparse(self.getTextElement(nzb, 'link')).query).get('id')[0], + 'id': nzb_id, 'name': toUnicode(self.getTextElement(nzb, 'title')), 'age': self.calculateAge(int(time.mktime(parse(self.getTextElement(nzb, 'pubDate')).timetuple()))), 'size': tryInt(enclosure['length']) / 1024 / 1024, 'url': enclosure['url'], - 'detail_url': self.getTextElement(nzb, 'link'), + 'detail_url': self.urls['detail_url'] % nzb_id, 'description': self.getTextElement(nzb, 'description') }) From d275dfd8ccfbe89aa8963fb01df93a33a2bceb3e Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 27 Oct 2013 20:16:03 +0100 Subject: [PATCH 06/10] Add br2dvd as DVD alternative. fix #1604 --- couchpotato/core/plugins/quality/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/quality/main.py b/couchpotato/core/plugins/quality/main.py index 4ce8b706..caed694f 100644 --- a/couchpotato/core/plugins/quality/main.py +++ b/couchpotato/core/plugins/quality/main.py @@ -20,7 +20,7 @@ class QualityPlugin(Plugin): {'identifier': '1080p', 'hd': True, 'size': (4000, 20000), 'label': '1080p', 'width': 1920, 'height': 1080, 'alternative': [], 'allow': [], 'ext':['mkv', 'm2ts'], 'tags': ['m2ts']}, {'identifier': '720p', 'hd': True, 'size': (3000, 10000), 'label': '720p', 'width': 1280, 'height': 720, 'alternative': [], 'allow': [], 'ext':['mkv', 'ts']}, {'identifier': 'brrip', 'hd': True, 'size': (700, 7000), 'label': 'BR-Rip', 'alternative': ['bdrip'], 'allow': ['720p', '1080p'], 'ext':['avi'], 'tags': ['hdtv', 'hdrip', 'webdl', ('web', 'dl')]}, - {'identifier': 'dvdr', 'size': (3000, 10000), 'label': 'DVD-R', 'alternative': [], 'allow': [], 'ext':['iso', 'img'], 'tags': ['pal', 'ntsc', 'video_ts', 'audio_ts'], 'tags': [('dvd', 'r')]}, + {'identifier': 'dvdr', 'size': (3000, 10000), 'label': 'DVD-R', 'alternative': ['br2dvd'], 'allow': [], 'ext':['iso', 'img'], 'tags': ['pal', 'ntsc', 'video_ts', 'audio_ts'], 'tags': [('dvd', 'r')]}, {'identifier': 'dvdrip', 'size': (600, 2400), 'label': 'DVD-Rip', 'width': 720, 'alternative': [], 'allow': [], 'ext':['avi', 'mpg', 'mpeg'], 'tags': [('dvd', 'rip'), ('dvd', 'xvid'), ('dvd', 'divx')]}, {'identifier': 'scr', 'size': (600, 1600), 'label': 'Screener', 'alternative': ['screener', 'dvdscr', 'ppvrip', 'dvdscreener', 'hdscr'], 'allow': ['dvdr', 'dvdrip'], 'ext':['avi', 'mpg', 'mpeg'], 'tags': ['webrip', ('web', 'rip')]}, {'identifier': 'r5', 'size': (600, 1000), 'label': 'R5', 'alternative': ['r6'], 'allow': ['dvdr'], 'ext':['avi', 'mpg', 'mpeg']}, From 7c51bdbdafaf4869d3044e858cc72a6cee72abbc Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 27 Oct 2013 20:21:02 +0100 Subject: [PATCH 07/10] Allow par3 files in binsearch validation --- couchpotato/core/providers/nzb/binsearch/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/providers/nzb/binsearch/main.py b/couchpotato/core/providers/nzb/binsearch/main.py index 770ed50a..db0fb5b8 100644 --- a/couchpotato/core/providers/nzb/binsearch/main.py +++ b/couchpotato/core/providers/nzb/binsearch/main.py @@ -65,7 +65,7 @@ class BinSearch(NZBProvider): total = tryInt(parts.group('total')) parts = tryInt(parts.group('parts')) - if (total / parts) < 0.95 or ((total / parts) >= 0.95 and not 'par2' in info.text.lower()): + if (total / parts) < 0.95 or ((total / parts) >= 0.95 and not ('par2' in info.text.lower() or 'pa3' in info.text.lower())): log.info2('Wrong: \'%s\', not complete: %s out of %s', (item['name'], parts, total)) return False From 94d1f993154e9a7afdffc15d8bd6dfaa0de174ae Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 29 Oct 2013 21:14:53 +0100 Subject: [PATCH 08/10] Add ignored group --- couchpotato/core/media/_base/searcher/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/searcher/__init__.py b/couchpotato/core/media/_base/searcher/__init__.py index 0fb6cc09..5e029a25 100644 --- a/couchpotato/core/media/_base/searcher/__init__.py +++ b/couchpotato/core/media/_base/searcher/__init__.py @@ -47,7 +47,7 @@ config = [{ { 'name': 'ignored_words', 'label': 'Ignored', - 'default': 'german, dutch, french, truefrench, danish, swedish, spanish, italian, korean, dubbed, swesub, korsub, dksubs', + 'default': 'german, dutch, french, truefrench, danish, swedish, spanish, italian, korean, dubbed, swesub, korsub, dksubs, vain', 'description': 'Ignores releases that match any of these sets. (Works like explained above)' }, ], From 6a4bc1eb08be131a60cb9e4b5e08c4a6f72d7bc0 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 29 Oct 2013 21:16:32 +0100 Subject: [PATCH 09/10] Don't add tags twice for dvd-r quality --- couchpotato/core/plugins/quality/main.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/plugins/quality/main.py b/couchpotato/core/plugins/quality/main.py index caed694f..9c458be4 100644 --- a/couchpotato/core/plugins/quality/main.py +++ b/couchpotato/core/plugins/quality/main.py @@ -20,7 +20,7 @@ class QualityPlugin(Plugin): {'identifier': '1080p', 'hd': True, 'size': (4000, 20000), 'label': '1080p', 'width': 1920, 'height': 1080, 'alternative': [], 'allow': [], 'ext':['mkv', 'm2ts'], 'tags': ['m2ts']}, {'identifier': '720p', 'hd': True, 'size': (3000, 10000), 'label': '720p', 'width': 1280, 'height': 720, 'alternative': [], 'allow': [], 'ext':['mkv', 'ts']}, {'identifier': 'brrip', 'hd': True, 'size': (700, 7000), 'label': 'BR-Rip', 'alternative': ['bdrip'], 'allow': ['720p', '1080p'], 'ext':['avi'], 'tags': ['hdtv', 'hdrip', 'webdl', ('web', 'dl')]}, - {'identifier': 'dvdr', 'size': (3000, 10000), 'label': 'DVD-R', 'alternative': ['br2dvd'], 'allow': [], 'ext':['iso', 'img'], 'tags': ['pal', 'ntsc', 'video_ts', 'audio_ts'], 'tags': [('dvd', 'r')]}, + {'identifier': 'dvdr', 'size': (3000, 10000), 'label': 'DVD-R', 'alternative': ['br2dvd'], 'allow': [], 'ext':['iso', 'img', 'vob'], 'tags': ['pal', 'ntsc', 'video_ts', 'audio_ts', ('dvd', 'r')]}, {'identifier': 'dvdrip', 'size': (600, 2400), 'label': 'DVD-Rip', 'width': 720, 'alternative': [], 'allow': [], 'ext':['avi', 'mpg', 'mpeg'], 'tags': [('dvd', 'rip'), ('dvd', 'xvid'), ('dvd', 'divx')]}, {'identifier': 'scr', 'size': (600, 1600), 'label': 'Screener', 'alternative': ['screener', 'dvdscr', 'ppvrip', 'dvdscreener', 'hdscr'], 'allow': ['dvdr', 'dvdrip'], 'ext':['avi', 'mpg', 'mpeg'], 'tags': ['webrip', ('web', 'rip')]}, {'identifier': 'r5', 'size': (600, 1000), 'label': 'R5', 'alternative': ['r6'], 'allow': ['dvdr'], 'ext':['avi', 'mpg', 'mpeg']}, @@ -214,7 +214,8 @@ class QualityPlugin(Plugin): 'identifier': 10, 'label': 10, 'alternative': 9, - 'tags': 9 + 'tags': 9, + 'ext': 3, } # Check alt and tags @@ -233,12 +234,18 @@ class QualityPlugin(Plugin): if (isinstance(alt, (str, unicode)) and ss(alt.lower()) in cur_file.lower()): log.debug('Found %s via %s %s in %s', (quality['identifier'], tag_type, quality.get(tag_type), cur_file)) - score += points.get(tag_type) + score += points.get(tag_type) / 2 if list(set(qualities) & set(words)): log.debug('Found %s via %s %s in %s', (quality['identifier'], tag_type, quality.get(tag_type), cur_file)) score += points.get(tag_type) + # Check extention + for ext in quality.get('ext', []): + if ext == words[-1]: + log.debug('Found %s extension in %s', (ext, cur_file)) + score += points['ext'] + return score def guessLooseScore(self, quality, files = None, extra = None): From a1fd581bca488e73058ff0313d7f3a7d360f6b71 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 29 Oct 2013 21:31:02 +0100 Subject: [PATCH 10/10] Add HD quality tags --- couchpotato/core/plugins/quality/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/plugins/quality/main.py b/couchpotato/core/plugins/quality/main.py index 9c458be4..ed575af5 100644 --- a/couchpotato/core/plugins/quality/main.py +++ b/couchpotato/core/plugins/quality/main.py @@ -17,8 +17,8 @@ class QualityPlugin(Plugin): qualities = [ {'identifier': 'bd50', 'hd': True, 'size': (15000, 60000), 'label': 'BR-Disk', 'alternative': ['bd25'], 'allow': ['1080p'], 'ext':[], 'tags': ['bdmv', 'certificate', ('complete', 'bluray')]}, - {'identifier': '1080p', 'hd': True, 'size': (4000, 20000), 'label': '1080p', 'width': 1920, 'height': 1080, 'alternative': [], 'allow': [], 'ext':['mkv', 'm2ts'], 'tags': ['m2ts']}, - {'identifier': '720p', 'hd': True, 'size': (3000, 10000), 'label': '720p', 'width': 1280, 'height': 720, 'alternative': [], 'allow': [], 'ext':['mkv', 'ts']}, + {'identifier': '1080p', 'hd': True, 'size': (4000, 20000), 'label': '1080p', 'width': 1920, 'height': 1080, 'alternative': [], 'allow': [], 'ext':['mkv', 'm2ts'], 'tags': ['m2ts', 'x264', 'h264']}, + {'identifier': '720p', 'hd': True, 'size': (3000, 10000), 'label': '720p', 'width': 1280, 'height': 720, 'alternative': [], 'allow': [], 'ext':['mkv', 'ts'], 'tags': ['x264', 'h264']}, {'identifier': 'brrip', 'hd': True, 'size': (700, 7000), 'label': 'BR-Rip', 'alternative': ['bdrip'], 'allow': ['720p', '1080p'], 'ext':['avi'], 'tags': ['hdtv', 'hdrip', 'webdl', ('web', 'dl')]}, {'identifier': 'dvdr', 'size': (3000, 10000), 'label': 'DVD-R', 'alternative': ['br2dvd'], 'allow': [], 'ext':['iso', 'img', 'vob'], 'tags': ['pal', 'ntsc', 'video_ts', 'audio_ts', ('dvd', 'r')]}, {'identifier': 'dvdrip', 'size': (600, 2400), 'label': 'DVD-Rip', 'width': 720, 'alternative': [], 'allow': [], 'ext':['avi', 'mpg', 'mpeg'], 'tags': [('dvd', 'rip'), ('dvd', 'xvid'), ('dvd', 'divx')]},