From b8e0714722823ee026e8ce63245f7fdf511fb82f Mon Sep 17 00:00:00 2001 From: PeterVanco Date: Sun, 25 Dec 2016 13:06:29 +0100 Subject: [PATCH 01/31] New Kickass torrent proxies --- .../media/_base/providers/torrent/kickasstorrents.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py b/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py index 7ec1080..825dd64 100644 --- a/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py +++ b/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py @@ -30,9 +30,24 @@ class Base(TorrentMagnetProvider): cat_backup_id = None proxy_list = [ + 'https://kat.how', + 'https://kickass.cd', + 'https://kickass.unlockproject.online', + 'https://kickasstorrents.video', + 'https://kat.al', + 'https://katproxy.al', + 'https://kattor.xyz', + 'https://kickass.unblocked.video', + 'https://kickass.unblocked.rocks', + 'https://kickass.immunicity.live', + 'https://kickass.immunicity.red', + 'https://kickass.immunicity.video', + 'https://kickass.bypassed.live', + 'https://kickass.bypassed.video', + 'https://kickass.bypassed.red', 'https://kat.cr', 'https://kickass.unblocked.pw/', - 'https://katproxy.com', + 'https://katproxy.com' ] def _search(self, media, quality, results): From 840ef03ee4e61deee63e4698c960b8965955b67f Mon Sep 17 00:00:00 2001 From: reputo Date: Fri, 30 Dec 2016 12:34:07 +0000 Subject: [PATCH 02/31] Update nzbclub.py Fix currently broken searches via NZBClub --- couchpotato/core/media/movie/providers/nzb/nzbclub.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/movie/providers/nzb/nzbclub.py b/couchpotato/core/media/movie/providers/nzb/nzbclub.py index 2a43ba2..8713106 100644 --- a/couchpotato/core/media/movie/providers/nzb/nzbclub.py +++ b/couchpotato/core/media/movie/providers/nzb/nzbclub.py @@ -14,7 +14,7 @@ class NZBClub(MovieProvider, Base): def buildUrl(self, media): q = tryUrlencode({ - 'q': '"%s"' % fireEvent('library.query', media, single = True), + 'q': '%s' % fireEvent('library.query', media, single = True), }) query = tryUrlencode({ From e5fc150d32041727def7bdacf8d0b7746bffef1a Mon Sep 17 00:00:00 2001 From: kmr2319 Date: Tue, 3 Jan 2017 14:32:25 -0500 Subject: [PATCH 03/31] IPTorrents query fixes - From PR #7023 Pulled just the IPT related fixed from PR #7023 and submitted this against the develop branch. * Improve IPTorrents quality to category mapping * Remove obsolete query parameter for categories * Remove quotes around movie title * Search in title, not title and tags --- .../core/media/_base/providers/torrent/iptorrents.py | 16 +++++++++------- .../core/media/movie/providers/torrent/iptorrents.py | 8 ++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/couchpotato/core/media/_base/providers/torrent/iptorrents.py b/couchpotato/core/media/_base/providers/torrent/iptorrents.py index 1197838..e3331ef 100644 --- a/couchpotato/core/media/_base/providers/torrent/iptorrents.py +++ b/couchpotato/core/media/_base/providers/torrent/iptorrents.py @@ -14,11 +14,11 @@ log = CPLog(__name__) class Base(TorrentProvider): urls = { - 'test': 'https://iptorrents.eu/', - 'base_url': 'https://iptorrents.eu', - 'login': 'https://iptorrents.eu/take_login.php', - 'login_check': 'https://iptorrents.eu/oldinbox.php', - 'search': 'https://iptorrents.eu/t?%s%%s&q=%s&qf=ti#torrents&p=%%d', + 'test': 'https://iptorrents.com/', + 'base_url': 'https://iptorrents.com', + 'login': 'https://iptorrents.com/take_login.php', + 'login_check': 'https://iptorrents.com/oldinbox.php', + 'search': 'https://iptorrents.com/t?%s%%s&q=%s&qf=ti#torrents&p=%%d', } http_time_between_calls = 1 # Seconds @@ -36,6 +36,8 @@ class Base(TorrentProvider): log.warning('Unable to find category ids for identifier "%s"', quality.get('identifier')) return None + query = query.replace('"', '') + return self.urls['search'] % ("&".join(("%d=" % x) for x in cat_ids), tryUrlencode(query).replace('%', '%%')) def _searchOnTitle(self, title, media, quality, results): @@ -61,7 +63,7 @@ class Base(TorrentProvider): final_page_link = next_link.previous_sibling.previous_sibling pages = int(final_page_link.string) - result_table = html.find('table', attrs = {'id': 'torrents'}) + result_table = html.find('table', attrs={'id': 'torrents'}) if not result_table or 'nothing found!' in data.lower(): return @@ -121,7 +123,7 @@ config = [{ 'tab': 'searcher', 'list': 'torrent_providers', 'name': 'IPTorrents', - 'description': 'IPTorrents', + 'description': 'IPTorrents', 'wizard': True, 'icon': 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABRklEQVR42qWQO0vDUBiG8zeKY3EqQUtNO7g0J6ZJ1+ifKIIFQXAqDYKCyaaYxM3udrZLHdRFhXrZ6liCW6mubfk874EESgqaeOCF7/Y8hEh41aq6yZi2nyZgBGya9XKtZs4No05pAkZV2YbEmyMMsoSxLQeC46wCTdPPY4HruPQyGIhF97qLWsS78Miydn4XdK46NJ9OsQAYBzMIMf8MQ9wtCnTdWCaIDx/u7uljOIQEe0hiIWPamSTLay3+RxOCSPI9+RJAo7Er9r2bnqjBFAqyK+VyK4f5/Cr5ni8OFKVCz49PFI5GdNvvU7ttE1M1zMU+8AMqFksEhrMnQsBDzqmDAwzx2ehRLwT7yyCI+vSC99c3mozH1NxrJgWWtR1BOECfEJSVCm6WCzJGCA7+IWhBsM4zywDPwEp4vCjx2DzBH2ODAfsDb33Ps6dQwJgAAAAASUVORK5CYII=', 'options': [ diff --git a/couchpotato/core/media/movie/providers/torrent/iptorrents.py b/couchpotato/core/media/movie/providers/torrent/iptorrents.py index 68365b8..fd83a0a 100644 --- a/couchpotato/core/media/movie/providers/torrent/iptorrents.py +++ b/couchpotato/core/media/movie/providers/torrent/iptorrents.py @@ -11,12 +11,12 @@ class IPTorrents(MovieProvider, Base): cat_ids = [ ([87], ['3d']), - ([48], ['720p', '1080p']), ([89], ['bd50']), - ([96], ['cam', 'ts', 'tc', 'r5', 'scr']), - ([48, 20, 90], ['brrip']), + ([48], ['720p', '1080p']), + ([48, 20], ['brrip']), ([7, 77], ['dvdrip']), - ([6], ['dvdr']) + ([6], ['dvdr']), + ([96], ['cam', 'ts', 'tc', 'r5', 'scr']), ] def buildUrl(self, title, media, quality): From 78363cb673514de72dd643b15f4b275feb724f7d Mon Sep 17 00:00:00 2001 From: Josh Fee Date: Tue, 3 Jan 2017 19:47:52 -0500 Subject: [PATCH 04/31] Add 2160p support to PTP provider --- couchpotato/core/media/movie/providers/torrent/passthepopcorn.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/couchpotato/core/media/movie/providers/torrent/passthepopcorn.py b/couchpotato/core/media/movie/providers/torrent/passthepopcorn.py index 2b577ad..5e92eef 100644 --- a/couchpotato/core/media/movie/providers/torrent/passthepopcorn.py +++ b/couchpotato/core/media/movie/providers/torrent/passthepopcorn.py @@ -10,6 +10,7 @@ autoload = 'PassThePopcorn' class PassThePopcorn(MovieProvider, Base): quality_search_params = { + '2160p': {'resolution': '4K'}, 'bd50': {'media': 'Blu-ray', 'format': 'BD50'}, '1080p': {'resolution': '1080p'}, '720p': {'resolution': '720p'}, @@ -24,6 +25,7 @@ class PassThePopcorn(MovieProvider, Base): } post_search_filters = { + '2160p': {'Resolution': ['4K']}, 'bd50': {'Codec': ['BD50']}, '1080p': {'Resolution': ['1080p']}, '720p': {'Resolution': ['720p']}, From 38205158f80b3239c88ad4c64a662841101c1fe6 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sun, 8 Jan 2017 21:34:17 +0100 Subject: [PATCH 05/31] Set autofocus to the username input field --- couchpotato/templates/login.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/templates/login.html b/couchpotato/templates/login.html index ef9a8ec..63c7b59 100644 --- a/couchpotato/templates/login.html +++ b/couchpotato/templates/login.html @@ -25,7 +25,7 @@

CouchPotato

-
+
From c1705716fa068443f6bfebe77b0a6e4f2f4bfbbb Mon Sep 17 00:00:00 2001 From: Le Wang Date: Mon, 9 Jan 2017 22:03:57 -0500 Subject: [PATCH 06/31] Ignore UTF-8 decode errors This fixes a backtrace I kept getting that stopped couchpotato from working at all. --- couchpotato/core/media/movie/providers/automation/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/movie/providers/automation/base.py b/couchpotato/core/media/movie/providers/automation/base.py index e606e7f..8282dd7 100644 --- a/couchpotato/core/media/movie/providers/automation/base.py +++ b/couchpotato/core/media/movie/providers/automation/base.py @@ -45,7 +45,7 @@ class Automation(AutomationBase): def search(self, name, year = None, imdb_only = False): - cache_name = name.decode('utf-8').encode('ascii', 'ignore') + cache_name = name.decode('utf-8', 'ignore').encode('ascii', 'ignore') prop_name = 'automation.cached.%s.%s' % (cache_name, year) cached_imdb = Env.prop(prop_name, default = False) if cached_imdb and imdb_only: From 934af86fce1c6de9353bd492a42c3a0b4ef76b3c Mon Sep 17 00:00:00 2001 From: Jean-Michel Lehker Date: Sun, 15 Jan 2017 12:59:48 -0800 Subject: [PATCH 07/31] fixes UnicodeEncodeError for automation scripts --- couchpotato/core/media/movie/providers/automation/base.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/media/movie/providers/automation/base.py b/couchpotato/core/media/movie/providers/automation/base.py index e606e7f..ee19649 100644 --- a/couchpotato/core/media/movie/providers/automation/base.py +++ b/couchpotato/core/media/movie/providers/automation/base.py @@ -1,4 +1,5 @@ import time +import unicodedata from couchpotato.core.event import addEvent, fireEvent from couchpotato.core.logger import CPLog @@ -45,7 +46,11 @@ class Automation(AutomationBase): def search(self, name, year = None, imdb_only = False): - cache_name = name.decode('utf-8').encode('ascii', 'ignore') + try: + cache_name = name.decode('utf-8').encode('ascii', 'ignore') + except UnicodeEncodeError: + cache_name = unicodedata.normalize('NFKD', name).encode('ascii','ignore') + prop_name = 'automation.cached.%s.%s' % (cache_name, year) cached_imdb = Env.prop(prop_name, default = False) if cached_imdb and imdb_only: From e3b0672af5e5694bf1441b44647c002d29182041 Mon Sep 17 00:00:00 2001 From: Ruud Burger Date: Tue, 17 Jan 2017 11:10:27 +0100 Subject: [PATCH 08/31] KAT Proxies --- couchpotato/core/media/_base/providers/torrent/kickasstorrents.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py b/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py index 825dd64..a4df2cc 100644 --- a/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py +++ b/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py @@ -30,6 +30,11 @@ class Base(TorrentMagnetProvider): cat_backup_id = None proxy_list = [ + 'http://flowtorrent.com', + 'http://katcr.to/span', + 'http://dx-torrente.com', + 'https://kickass.unblocked.vip', + 'https://katcr.co', 'https://kat.how', 'https://kickass.cd', 'https://kickass.unlockproject.online', From a1e6418d666f325ac0b78bf973fed1b79b27e903 Mon Sep 17 00:00:00 2001 From: jwvanderbeck Date: Sun, 22 Jan 2017 11:38:50 -0800 Subject: [PATCH 09/31] Add 3d_type_short and TAB option for Kodi compatability Kodi requires the use of TAB instead of OU and only supports compact naming (HSBS instead of Half SBS), so allow for Renamer plugin to use these formats. --- couchpotato/core/plugins/renamer.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/couchpotato/core/plugins/renamer.py b/couchpotato/core/plugins/renamer.py index 6780c0e..a5f8314 100755 --- a/couchpotato/core/plugins/renamer.py +++ b/couchpotato/core/plugins/renamer.py @@ -347,11 +347,17 @@ class Renamer(Plugin): 'category': category_label, '3d': '3D' if group['meta_data']['quality'].get('is_3d', 0) else '', '3d_type': group['meta_data'].get('3d_type'), + '3d_type_short': group['meta_data'].get('3d_type'), } if replacements['mpaa_only'] not in ('G', 'PG', 'PG-13', 'R', 'NC-17'): replacements['mpaa_only'] = 'Not Rated' + replacements['3d_type_short'] = replacements['3d_type_short'].replace('Half ', 'H').replace('Full ', '') + if self.conf('use_tab_threed') and 'OU' in replacements['3d_type']: + replacements['3d_type'] = replacements['3d_type'].replace('OU','TAB') + + for file_type in group['files']: # Move nfo depending on settings @@ -1298,6 +1304,7 @@ rename_options = { 'quality_type': '(HD) or (SD)', '3d': '3D', '3d_type': '3D Type (Full SBS)', + '3d_type_short' : 'Short 3D Type (FSBS)', 'video': 'Video (x264)', 'audio': 'Audio (DTS)', 'group': 'Releasegroup name', @@ -1360,6 +1367,14 @@ config = [{ }, { 'advanced': True, + 'name': 'use_tab_threed', + 'type': 'bool', + 'label': 'Use TAB 3D', + 'description': ('Use TAB (Top And Bottom) instead of OU (Over Under).','This will allow Kodi to recognize vertical formatted 3D movies properly.'), + 'default': True + }, + { + 'advanced': True, 'name': 'replace_doubles', 'type': 'bool', 'label': 'Clean Name', From 18a4f0a261d9b4a35e82b18ee84d3e1b43df806a Mon Sep 17 00:00:00 2001 From: jwvanderbeck Date: Sun, 22 Jan 2017 14:00:17 -0800 Subject: [PATCH 10/31] Add TAB detection to the original OU keywords. Also fixes bug that had Full OU searching for ('h','ou') instead of ('f','ou') --- couchpotato/core/plugins/scanner.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/plugins/scanner.py b/couchpotato/core/plugins/scanner.py index 9bcb73f..540edf2 100644 --- a/couchpotato/core/plugins/scanner.py +++ b/couchpotato/core/plugins/scanner.py @@ -42,9 +42,9 @@ class Scanner(Plugin): 'Half SBS': [('half', 'sbs'), ('h', 'sbs'), 'hsbs'], 'Full SBS': [('full', 'sbs'), ('f', 'sbs'), 'fsbs'], 'SBS': ['sbs'], - 'Half OU': [('half', 'ou'), ('h', 'ou'), 'hou'], - 'Full OU': [('full', 'ou'), ('h', 'ou'), 'fou'], - 'OU': ['ou'], + 'Half OU': [('half', 'ou'), ('h', 'ou'), ('half', 'tab'), ('h', 'tab'), 'htab', 'hou'], + 'Full OU': [('full', 'ou'), ('f', 'ou'), ('full', 'tab'), ('f', 'tab'), 'ftab', 'fou'], + 'OU': ['ou', 'tab'], 'Frame Packed': ['mvc', ('complete', 'bluray')], '3D': ['3d'] } From fae67aee04277b0b0a928f14569c314b18a94589 Mon Sep 17 00:00:00 2001 From: jwvanderbeck Date: Tue, 24 Jan 2017 18:35:09 -0800 Subject: [PATCH 11/31] FIX: Only apply 3D operations if metadata exists --- couchpotato/core/plugins/renamer.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/plugins/renamer.py b/couchpotato/core/plugins/renamer.py index a5f8314..8e8f25b 100755 --- a/couchpotato/core/plugins/renamer.py +++ b/couchpotato/core/plugins/renamer.py @@ -353,9 +353,14 @@ class Renamer(Plugin): if replacements['mpaa_only'] not in ('G', 'PG', 'PG-13', 'R', 'NC-17'): replacements['mpaa_only'] = 'Not Rated' - replacements['3d_type_short'] = replacements['3d_type_short'].replace('Half ', 'H').replace('Full ', '') - if self.conf('use_tab_threed') and 'OU' in replacements['3d_type']: - replacements['3d_type'] = replacements['3d_type'].replace('OU','TAB') + if replacements['3d_type_short']: + replacements['3d_type_short'] = replacements['3d_type_short'].replace('Half ', 'H').replace('Full ', '') + if self.conf('use_tab_threed') and replacements['3d_type']: + if 'OU' in replacements['3d_type']: + replacements['3d_type'] = replacements['3d_type'].replace('OU','TAB') + if self.conf('use_tab_threed') and replacements['3d_type_short']: + if 'OU' in replacements['3d_type_short']: + replacements['3d_type_short'] = replacements['3d_type_short'].replace('OU','TAB') for file_type in group['files']: From a2ebe5bdd765d9206f280b78af41ba2b1c0a19eb Mon Sep 17 00:00:00 2001 From: yigit007 Date: Mon, 30 Jan 2017 02:44:31 +0200 Subject: [PATCH 12/31] Update deluge.py Changed the stop_ratio check to become "smaller than", instead of "smaller than or equal to" 0. --- couchpotato/core/downloaders/deluge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/downloaders/deluge.py b/couchpotato/core/downloaders/deluge.py index 631925f..aaca40e 100644 --- a/couchpotato/core/downloaders/deluge.py +++ b/couchpotato/core/downloaders/deluge.py @@ -159,7 +159,7 @@ class Deluge(DownloaderBase): # If an user opts to seed a torrent forever (usually associated to private trackers usage), stop_ratio will be 0 or -1 (depending on Deluge version). # In this scenario the status of the torrent would never change from BUSY to SEEDING. # The last check takes care of this case. - if torrent['is_seed'] and ((tryFloat(torrent['ratio']) < tryFloat(torrent['stop_ratio'])) or (tryFloat(torrent['stop_ratio']) <= 0)): + if torrent['is_seed'] and ((tryFloat(torrent['ratio']) < tryFloat(torrent['stop_ratio'])) or (tryFloat(torrent['stop_ratio']) < 0)): # We have torrent['seeding_time'] to work out what the seeding time is, but we do not # have access to the downloader seed_time, as with deluge we have no way to pass it # when the torrent is added. So Deluge will only look at the ratio. From 75e6e9da54d221a6d408365caf22311a4e4aadec Mon Sep 17 00:00:00 2001 From: Fmstrat Date: Thu, 2 Feb 2017 17:59:10 -0500 Subject: [PATCH 13/31] Added notification option to execute script. --- couchpotato/core/notifications/script.py | 58 ++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 couchpotato/core/notifications/script.py diff --git a/couchpotato/core/notifications/script.py b/couchpotato/core/notifications/script.py new file mode 100644 index 0000000..9d8f753 --- /dev/null +++ b/couchpotato/core/notifications/script.py @@ -0,0 +1,58 @@ +import traceback +import subprocess + +from couchpotato.core.helpers.encoding import toUnicode +from couchpotato.core.helpers.variable import getIdentifier +from couchpotato.core.logger import CPLog +from couchpotato.core.notifications.base import Notification + + +log = CPLog(__name__) + +autoload = 'Script' + +class Script(Notification): + + def notify(self, message = '', data = None, listener = None): + if not data: data = {} + + script_data = { + 'message': toUnicode(message) + } + + if getIdentifier(data): + script_data.update({ + 'imdb_id': getIdentifier(data) + }) + + try: + subprocess.call([self.conf('path'), message]) + return True + except: + log.error('Script notification failed: %s', traceback.format_exc()) + + return False + + +config = [{ + 'name': 'script', + 'groups': [ + { + 'tab': 'notifications', + 'list': 'notification_providers', + 'name': 'script', + 'label': 'Script', + 'options': [ + { + 'name': 'enabled', + 'default': 0, + 'type': 'enabler', + }, + { + 'name': 'path', + 'description': 'The path to the script to execute.' + } + ] + } + ] +}] From 750f2bc4420260571bddfa64768c4e638df5d9e9 Mon Sep 17 00:00:00 2001 From: Mhynlo Date: Sun, 5 Feb 2017 01:17:45 -0800 Subject: [PATCH 14/31] Discord Notification Support --- couchpotato/core/notifications/discord.py | 86 +++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 couchpotato/core/notifications/discord.py diff --git a/couchpotato/core/notifications/discord.py b/couchpotato/core/notifications/discord.py new file mode 100644 index 0000000..ae3497d --- /dev/null +++ b/couchpotato/core/notifications/discord.py @@ -0,0 +1,86 @@ +from couchpotato.core.logger import CPLog +from couchpotato.core.notifications.base import Notification +import json +import requests + +log = CPLog(__name__) +autoload = 'Discord' + + +class Discord(Notification): + required_confs = ('webhook_url',) + + def notify(self, message='', data=None, listener=None): + for key in self.required_confs: + if not self.conf(key): + log.warning('Discord notifications are enabled, but ' + '"{0}" is not specified.'.format(key)) + return False + + data = data or {} + message = message.strip() + + if self.conf('include_imdb') and 'identifier' in data: + template = ' http://www.imdb.com/title/{0[identifier]}/' + message += template.format(data) + + headers = {b"Content-Type": b"application/json"} + try: + r = requests.post(self.conf('webhook_url'), data=json.dumps(dict(content=message, username=self.conf('bot_name'), avatar_url=self.conf('avatar_url'))), headers=headers) + r.status_code + except Exception as e: + log.warning('Error Sending Discord response error code: {0}'.format(r.status_code)) + return False + return True + + +config = [{ + 'name': 'discord', + 'groups': [ + { + 'tab': 'notifications', + 'list': 'notification_providers', + 'name': 'discord', + 'options': [ + { + 'name': 'enabled', + 'default': 0, + 'type': 'enabler', + }, + { + 'name': 'webhook_url', + 'description': ( + 'Your Discord authentication webhook URL.', + 'Created under channel settings.' + ) + }, + { + 'name': 'include_imdb', + 'default': True, + 'type': 'bool', + 'descrpition': 'Include a link to the movie page on IMDB.' + }, + { + 'name': 'bot_name', + 'description': 'Name of bot.', + 'default': 'CouchPotato', + 'advanced': True, + }, + { + 'name': 'avatar_url', + 'description': 'URL to an image to use as the avatar for ' + 'notifications.', + 'default': 'https://couchpota.to/media/images/couch.png', + 'advanced': True, + }, + { + 'name': 'on_snatch', + 'default': 0, + 'type': 'bool', + 'advanced': True, + 'description': 'Also send message when movie is snatched.', + }, + ], + } + ], +}] From cde53c234f8c6b1e04f4fdfe0f5d7a2c6328d48c Mon Sep 17 00:00:00 2001 From: Karl Tiedt Date: Wed, 8 Feb 2017 18:55:19 -0800 Subject: [PATCH 15/31] Fixes instances were getQuality returns null instead of empty object --- couchpotato/core/plugins/quality/static/quality.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/plugins/quality/static/quality.js b/couchpotato/core/plugins/quality/static/quality.js index 60a2449..d9aaf58 100644 --- a/couchpotato/core/plugins/quality/static/quality.js +++ b/couchpotato/core/plugins/quality/static/quality.js @@ -31,9 +31,9 @@ var QualityBase = new Class({ getQuality: function(identifier){ try { - return this.qualities.filter(function(q){ + return (this.qualities.filter(function(q){ return q.identifier == identifier; - }).pick(); + }).pick() || {}); } catch(e){} From abe3ed57e05546850647e587ef73f8e91be5c3f5 Mon Sep 17 00:00:00 2001 From: Mathieu Alorent Date: Sat, 11 Feb 2017 15:52:28 +0100 Subject: [PATCH 16/31] Extend ignore patterns Some want to synchronize files between a download server and storage server hosting the couch potato instance. The renaming plugin does copy files when file beeing available regardless the synchronization status, resulting in corrupted files in destination folder. Files are not copied if a file with extension .ignored is present. This extend at the moment the ignored extensions to support common lftp temporary file. This way files get only copied once suchronization is ended. In the future this could be extended to have this extension list a configurable option in the settings. --- couchpotato/core/plugins/scanner.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/plugins/scanner.py b/couchpotato/core/plugins/scanner.py index 9bcb73f..0aabbdd 100644 --- a/couchpotato/core/plugins/scanner.py +++ b/couchpotato/core/plugins/scanner.py @@ -28,6 +28,7 @@ class Scanner(Plugin): '_failed_rename_', '.appledouble', '.appledb', '.appledesktop', os.path.sep + '._', '.ds_store', 'cp.cpnfo', 'thumbs.db', 'ehthumbs.db', 'desktop.ini'] # unpacking, smb-crap, hidden files ignore_names = ['extract', 'extracting', 'extracted', 'movie', 'movies', 'film', 'films', 'download', 'downloads', 'video_ts', 'audio_ts', 'bdmv', 'certificate'] + ignored_extensions = ['ignore', 'lftp-pget-status'] extensions = { 'movie': ['mkv', 'wmv', 'avi', 'mpg', 'mpeg', 'mp4', 'm2ts', 'iso', 'img', 'mdf', 'ts', 'm4v', 'flv'], 'movie_extra': ['mds'], @@ -225,12 +226,12 @@ class Scanner(Plugin): group['unsorted_files'].extend(found_files) leftovers = leftovers - found_files - has_ignored += 1 if ext == 'ignore' else 0 + has_ignored += 1 if ext in self.ignored_extensions else 0 if has_ignored == 0: for file_path in list(group['unsorted_files']): ext = getExt(file_path) - has_ignored += 1 if ext == 'ignore' else 0 + has_ignored += 1 if ext in self.ignored_extensions else 0 if has_ignored > 0: ignored_identifiers.append(identifier) From c2b44a3e496ff496cb3df0cab8980a20ffdff3a3 Mon Sep 17 00:00:00 2001 From: Chris Rose Date: Mon, 13 Feb 2017 07:30:25 -0800 Subject: [PATCH 17/31] Ignore a set of configured patterns during rename. --- couchpotato/core/plugins/renamer.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/couchpotato/core/plugins/renamer.py b/couchpotato/core/plugins/renamer.py index 6780c0e..b0ed3bb 100755 --- a/couchpotato/core/plugins/renamer.py +++ b/couchpotato/core/plugins/renamer.py @@ -216,6 +216,9 @@ class Renamer(Plugin): except: log.error('Failed getting files from %s: %s', (media_folder, traceback.format_exc())) + # post_filter files from configuration; this is a ":"-separated list of globs + files = self.filesAfterIgnoring(files) + db = get_db() # Extend the download info with info stored in the downloaded release @@ -1165,6 +1168,30 @@ Remove it if you want it to be renamed (again, or at least let it try again) def movieInFromFolder(self, media_folder): return media_folder and isSubFolder(media_folder, sp(self.conf('from'))) or not media_folder + @property + def ignored_in_path(self): + return self.conf('ignored_in_path').split(":") if self.conf('ignored_in_path') else [] + + def filesAfterIgnoring(self, original_file_list): + kept_files = [] + for path in original_file_list: + if self.keepFile(path): + kept_files.append(path) + else: + log.debug('Ignored "%s" during renaming', path) + return kept_files + + def keepFile(self, filename): + + # ignoredpaths + for i in self.ignored_in_path: + if i in filename.lower(): + log.debug('Ignored "%s" contains "%s".', (filename, i)) + return False + + # All is OK + return True + def extractFiles(self, folder = None, media_folder = None, files = None, cleanup = False): if not files: files = [] @@ -1367,6 +1394,12 @@ config = [{ 'default': True }, { + 'name': 'ignored_in_path', + 'label': 'Ignored file patterns', + 'description': ('A list of globs to path match when scanning, separated by ":"', 'anything on this list will be skipped during rename operations'), + 'default': '*/.sync/*', + }, + { 'name': 'unrar', 'type': 'bool', 'description': 'Extract rar files if found.', From 8b27e3c1212875e724ae8479a665c7bee31a9087 Mon Sep 17 00:00:00 2001 From: Mhynlo Date: Fri, 17 Feb 2017 00:09:24 -0800 Subject: [PATCH 18/31] discord notification tts support with spelling fix --- couchpotato/core/notifications/discord.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/notifications/discord.py b/couchpotato/core/notifications/discord.py index ae3497d..829ff26 100644 --- a/couchpotato/core/notifications/discord.py +++ b/couchpotato/core/notifications/discord.py @@ -26,7 +26,7 @@ class Discord(Notification): headers = {b"Content-Type": b"application/json"} try: - r = requests.post(self.conf('webhook_url'), data=json.dumps(dict(content=message, username=self.conf('bot_name'), avatar_url=self.conf('avatar_url'))), headers=headers) + r = requests.post(self.conf('webhook_url'), data=json.dumps(dict(content=message, username=self.conf('bot_name'), avatar_url=self.conf('avatar_url'), tts=self.conf('discord_tts'))), headers=headers) r.status_code except Exception as e: log.warning('Error Sending Discord response error code: {0}'.format(r.status_code)) @@ -74,6 +74,13 @@ config = [{ 'advanced': True, }, { + 'name': 'discord_tts', + 'default': 0, + 'type': 'bool', + 'advanced': True, + 'description': 'Send notification using text-to-speech.', + }, + { 'name': 'on_snatch', 'default': 0, 'type': 'bool', From b352abe9ba1375cf946a13e5592088a1e2493b81 Mon Sep 17 00:00:00 2001 From: Chris Rose Date: Sat, 25 Feb 2017 08:59:17 -0800 Subject: [PATCH 19/31] Fix a bug in quality.single that led to exceptions When the DB was unable to find a quality for the identifier, a RecordNotFound exception was raised, leading to an exception in the event caller because the quality_dict was not returned. This now sets the quality to None and hands off to the event caller. --- couchpotato/core/plugins/quality/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/quality/main.py b/couchpotato/core/plugins/quality/main.py index f2cd100..a55eb06 100644 --- a/couchpotato/core/plugins/quality/main.py +++ b/couchpotato/core/plugins/quality/main.py @@ -114,7 +114,12 @@ class QualityPlugin(Plugin): db = get_db() quality_dict = {} - quality = db.get('quality', identifier, with_doc = True)['doc'] + try: + quality = db.get('quality', identifier, with_doc = True)['doc'] + except RecordNotFound: + log.error("Unable to find '%s' in the quality DB", indentifier) + quality = None + if quality: quality_dict = mergeDicts(self.getQuality(quality['identifier']), quality) From 4f76cf5b4ea2e66582977f31c53f442d786a0400 Mon Sep 17 00:00:00 2001 From: SWG Date: Tue, 28 Feb 2017 00:11:58 +0100 Subject: [PATCH 20/31] Added YTS Provider --- .../core/media/_base/providers/torrent/yts.py | 129 +++++++++++++++++++++ .../core/media/movie/providers/torrent/yts.py | 10 ++ 2 files changed, 139 insertions(+) create mode 100644 couchpotato/core/media/_base/providers/torrent/yts.py create mode 100644 couchpotato/core/media/movie/providers/torrent/yts.py diff --git a/couchpotato/core/media/_base/providers/torrent/yts.py b/couchpotato/core/media/_base/providers/torrent/yts.py new file mode 100644 index 0000000..2df6bc7 --- /dev/null +++ b/couchpotato/core/media/_base/providers/torrent/yts.py @@ -0,0 +1,129 @@ +from datetime import datetime +from couchpotato.core.helpers.variable import tryInt +from couchpotato.core.logger import CPLog +from couchpotato.core.helpers.variable import getTitle +from couchpotato.core.media._base.providers.torrent.base import TorrentMagnetProvider +import random + +log = CPLog(__name__) + + +class Base(TorrentMagnetProvider): + # Only qualities allowed: 720p/1080p/3D - the rest will fail. + # All YTS.ag torrents are verified + urls = { + 'detail': 'https://yts.ag/api#list_movies', + 'search': 'https://yts.ag/api/v2/list_movies.json?query_term=%s&limit=%s&page=%s' + } + + def _search(self, movie, quality, results): + limit = 1 + page = 1 + data = self.getJsonData(self.urls['search'] % (getTitle(movie), limit, page)) + + if data: + movie_count = tryInt(data['data']['movie_count']) + + if movie_count == 0: + log.error('%s returned an error (search or tryInt() failed): %s', (self.getName(), data['error'])) + else: + result = data['data']['movies'][0] + name = result['title'] + year = result['year'] + detail_url = result['url'] + + + for torrent in result['torrents']: + t_quality = torrent['quality'] + + if t_quality in quality['label']: + hash = torrent['hash'] + size = tryInt(torrent['size_bytes'] / 1048576) + seeders = tryInt(torrent['seeds']) + leechers = tryInt(torrent['peers']) + pubdate = torrent['date_uploaded'] # format: 2017-02-17 18:40:03 + pubdate = datetime.strptime(pubdate, '%Y-%m-%d %H:%M:%S') + age = (datetime.now() - pubdate).days + + results.append({ + 'id': random.randint(100, 9999), + 'name': '%s (%s) %s %s %s' % (name, year, 'YTS', t_quality, 'BR-Rip'), + 'url': self.make_magnet(hash, name), + 'size': size, + 'seeders': seeders, + 'leechers': leechers, + 'age': age, + 'detail_url': detail_url, + 'score': 1 + }) + + return + + def make_magnet(self, hash, name): + url_encoded_trackers = 'udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce&tr=%0Audp%3A%2F%2Ftracker.openbittorr' \ + 'ent.com%3A80&tr=%0Audp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=%0Audp%3A%2F%2Fglot' \ + 'orrents.pw%3A6969%2Fannounce&tr=%0Audp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannou' \ + 'nce&tr=%0Audp%3A%2F%2Ftorrent.gresille.org%3A80%2Fannounce&tr=%0Audp%3A%2F%2Fp4p.are' \ + 'nabg.com%3A1337&tr=%0Audp%3A%2F%2Ftracker.leechers-paradise.org%3A6969]' + + return 'magnet:?xt=urn:btih:%s&dn=%s&tr=%s' % (hash, name.replace(' ', '+'), url_encoded_trackers) + + +config = [{ + 'name': 'yts', + 'groups': [ + { + 'tab': 'searcher', + 'list': 'torrent_providers', + 'name': 'YTS', + 'description': 'YTS', + 'wizard': True, + 'icon': 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAACL0lEQVR4AS1SPW/UQBAd23fxne/Ld2dvzvHuzPocEBAKokCBqG' + 'iQ6IgACYmvUKRBFEQgKKGg4BAlUoggggYUEQpSHOI7CIEoQs/fYcbLaU/efTvvvZlnA1qydoxU5kcxX0CkgmQZtPy0hCUjvK+W' + 'gEByOZ5dns1O5bzna8fRVkgsxH8B0YouIvBhdD5T11NiVOoKrsttyUcpRW0InUrFnwe9HzuP2uaQZYhF2LQ76TTXw2RVMTK8mY' + 'Ybjfh+zNquMVCrqn93aArLSixPxnafdGDLaz1tjY5rmNa8z5BczEQOxQfCl1GyoqoWxYRN1bkh7ELw3q/vhP6HIL4TG9Kumpjg' + 'vwuyM7OsjSj98E/vszMfZ7xvPtMaWxGO5crwIumKCR5HxDtJ0AWKGG204RfUd/3smJYqwem/Q7BTS1ZGfM4LNpVwuKAz6cMeRO' + 'st0S2EwNE7GjTehO2H3dxqIpdkydat15G3F8SXBi4GlpBNlSz012L/k2+W0CLLk/jbcf13rf41yJeMQ8QWUZiHCfCA9ad+81nE' + 'KPtoS9mJOf9v0NmMJHgUT6xayheK9EIK7JJeU/AF4scDF7Y5SPlJrRcxJ+um4ibNEdObxLiIwJim+eT2AL5D9CIcnZ5zvSJi9e' + 'IlNHVVtZ831dk5svPgvjPWTq+ktWkd/kD0qtm71x+sDQe3kt6DXnM7Ct+GajmTxKlkAokWljyAKSm5oWa2w+BH4P2UuVub7eTy' + 'iGOQYapY/wEztHduSDYz5gAAAABJRU5ErkJggg==', + + 'options': [ + { + 'name': 'enabled', + 'type': 'enabler', + 'default': False + }, + { + 'name': 'seed_ratio', + 'label': 'Seed ratio', + 'type': 'float', + 'default': 1, + 'description': 'Will not be (re)moved until this seed ratio is met.', + }, + { + 'name': 'seed_time', + 'label': 'Seed time', + 'type': 'int', + 'default': 40, + 'description': 'Will not be (re)moved until this seed time (in hours) is met.', + }, + { + 'name': 'info', + 'label': 'Info', + 'type':'bool', + 'default':'False', + 'description': 'YTS will only work if you set the minimum size for 720p to 500 and 1080p to 800', + }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 0, + 'description': 'Starting score for each release found via this provider.', + } + ], + } + ] +}] diff --git a/couchpotato/core/media/movie/providers/torrent/yts.py b/couchpotato/core/media/movie/providers/torrent/yts.py new file mode 100644 index 0000000..c20117a --- /dev/null +++ b/couchpotato/core/media/movie/providers/torrent/yts.py @@ -0,0 +1,10 @@ +from couchpotato.core.logger import CPLog +from couchpotato.core.media._base.providers.torrent.yts import Base +from couchpotato.core.media.movie.providers.base import MovieProvider + +log = CPLog(__name__) + +autoload = 'Yts' + +class Yts(MovieProvider, Base): + pass From 1a8c78bad788cb3f1a41e110a11a0e1187927fa7 Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 1 Mar 2017 10:15:35 +0100 Subject: [PATCH 21/31] Add Plex device name --- couchpotato/core/notifications/plex/server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/notifications/plex/server.py b/couchpotato/core/notifications/plex/server.py index 956c66c..9c8df76 100644 --- a/couchpotato/core/notifications/plex/server.py +++ b/couchpotato/core/notifications/plex/server.py @@ -51,7 +51,8 @@ class PlexServer(object): req = urllib2.Request("https://plex.tv/users/sign_in.xml", data="") authheader = "Basic %s" % base64.encodestring('%s:%s' % (username, password))[:-1] req.add_header("Authorization", authheader) - req.add_header("X-Plex-Product", "Couchpotato Notifier") + req.add_header("X-Plex-Device-Name", "CouchPotato") + req.add_header("X-Plex-Product", "CouchPotato Notifier") req.add_header("X-Plex-Client-Identifier", "b3a6b24dcab2224bdb101fc6aa08ea5e2f3147d6") req.add_header("X-Plex-Version", "1.0") From 456369ebbc56cccc2ee2286c0477d53bf8117f62 Mon Sep 17 00:00:00 2001 From: "Sebastian W. Gram" Date: Wed, 1 Mar 2017 12:07:19 +0100 Subject: [PATCH 22/31] Update README - fixed link The forum thread link for Windows were no longer valid. forum thread id argument changed from ?tid= to ?t= --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 618dea1..00921ae 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Once a movie is found, it will send it to SABnzbd or download the torrent to a s CouchPotatoServer can be run from source. This will use *git* as updater, so make sure that is installed. -Windows, see [the CP forum](http://couchpota.to/forum/showthread.php?tid=14) for more details: +Windows, see [the CP forum](http://couchpota.to/forum/viewtopic.php?t=14) for more details: * Install [Python 2.7](http://www.python.org/download/releases/2.7.3/) * Then install [PyWin32 2.7](http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/) and [GIT](http://git-scm.com/) From 6ca0efe4d2eaf30e7384bde189a4c79989f9d890 Mon Sep 17 00:00:00 2001 From: SWG Date: Sat, 4 Mar 2017 22:31:10 +0100 Subject: [PATCH 23/31] fixed bug where yts would add Avatar (2009) when searching for Avatar 4 - should work for others. --- .../core/media/_base/providers/torrent/yts.py | 56 +++++++++++----------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/couchpotato/core/media/_base/providers/torrent/yts.py b/couchpotato/core/media/_base/providers/torrent/yts.py index 2df6bc7..4881f28 100644 --- a/couchpotato/core/media/_base/providers/torrent/yts.py +++ b/couchpotato/core/media/_base/providers/torrent/yts.py @@ -29,33 +29,35 @@ class Base(TorrentMagnetProvider): else: result = data['data']['movies'][0] name = result['title'] - year = result['year'] - detail_url = result['url'] - - - for torrent in result['torrents']: - t_quality = torrent['quality'] - - if t_quality in quality['label']: - hash = torrent['hash'] - size = tryInt(torrent['size_bytes'] / 1048576) - seeders = tryInt(torrent['seeds']) - leechers = tryInt(torrent['peers']) - pubdate = torrent['date_uploaded'] # format: 2017-02-17 18:40:03 - pubdate = datetime.strptime(pubdate, '%Y-%m-%d %H:%M:%S') - age = (datetime.now() - pubdate).days - - results.append({ - 'id': random.randint(100, 9999), - 'name': '%s (%s) %s %s %s' % (name, year, 'YTS', t_quality, 'BR-Rip'), - 'url': self.make_magnet(hash, name), - 'size': size, - 'seeders': seeders, - 'leechers': leechers, - 'age': age, - 'detail_url': detail_url, - 'score': 1 - }) + + if getTitle(movie) == name: + + year = result['year'] + detail_url = result['url'] + + for torrent in result['torrents']: + t_quality = torrent['quality'] + + if t_quality in quality['label']: + hash = torrent['hash'] + size = tryInt(torrent['size_bytes'] / 1048576) + seeders = tryInt(torrent['seeds']) + leechers = tryInt(torrent['peers']) + pubdate = torrent['date_uploaded'] # format: 2017-02-17 18:40:03 + pubdate = datetime.strptime(pubdate, '%Y-%m-%d %H:%M:%S') + age = (datetime.now() - pubdate).days + + results.append({ + 'id': random.randint(100, 9999), + 'name': '%s (%s) %s %s %s' % (name, year, 'YTS', t_quality, 'BR-Rip'), + 'url': self.make_magnet(hash, name), + 'size': size, + 'seeders': seeders, + 'leechers': leechers, + 'age': age, + 'detail_url': detail_url, + 'score': 1 + }) return From 0a2d8f8a5807caf1c9e2fa5e0709564ece223f87 Mon Sep 17 00:00:00 2001 From: SWG Date: Sat, 4 Mar 2017 22:44:10 +0100 Subject: [PATCH 24/31] increased limit in the API call to be sure that the result is found. --- .../core/media/_base/providers/torrent/yts.py | 67 +++++++++++----------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/couchpotato/core/media/_base/providers/torrent/yts.py b/couchpotato/core/media/_base/providers/torrent/yts.py index 4881f28..06d3bea 100644 --- a/couchpotato/core/media/_base/providers/torrent/yts.py +++ b/couchpotato/core/media/_base/providers/torrent/yts.py @@ -17,7 +17,7 @@ class Base(TorrentMagnetProvider): } def _search(self, movie, quality, results): - limit = 1 + limit = 5 page = 1 data = self.getJsonData(self.urls['search'] % (getTitle(movie), limit, page)) @@ -27,37 +27,40 @@ class Base(TorrentMagnetProvider): if movie_count == 0: log.error('%s returned an error (search or tryInt() failed): %s', (self.getName(), data['error'])) else: - result = data['data']['movies'][0] - name = result['title'] - - if getTitle(movie) == name: - - year = result['year'] - detail_url = result['url'] - - for torrent in result['torrents']: - t_quality = torrent['quality'] - - if t_quality in quality['label']: - hash = torrent['hash'] - size = tryInt(torrent['size_bytes'] / 1048576) - seeders = tryInt(torrent['seeds']) - leechers = tryInt(torrent['peers']) - pubdate = torrent['date_uploaded'] # format: 2017-02-17 18:40:03 - pubdate = datetime.strptime(pubdate, '%Y-%m-%d %H:%M:%S') - age = (datetime.now() - pubdate).days - - results.append({ - 'id': random.randint(100, 9999), - 'name': '%s (%s) %s %s %s' % (name, year, 'YTS', t_quality, 'BR-Rip'), - 'url': self.make_magnet(hash, name), - 'size': size, - 'seeders': seeders, - 'leechers': leechers, - 'age': age, - 'detail_url': detail_url, - 'score': 1 - }) + + movie_results = data['data']['movies'] + for i in range(0,len(movie_results)): + result = data['data']['movies'][i] + name = result['title'] + + if getTitle(movie) == name: + + year = result['year'] + detail_url = result['url'] + + for torrent in result['torrents']: + t_quality = torrent['quality'] + + if t_quality in quality['label']: + hash = torrent['hash'] + size = tryInt(torrent['size_bytes'] / 1048576) + seeders = tryInt(torrent['seeds']) + leechers = tryInt(torrent['peers']) + pubdate = torrent['date_uploaded'] # format: 2017-02-17 18:40:03 + pubdate = datetime.strptime(pubdate, '%Y-%m-%d %H:%M:%S') + age = (datetime.now() - pubdate).days + + results.append({ + 'id': random.randint(100, 9999), + 'name': '%s (%s) %s %s %s' % (name, year, 'YTS', t_quality, 'BR-Rip'), + 'url': self.make_magnet(hash, name), + 'size': size, + 'seeders': seeders, + 'leechers': leechers, + 'age': age, + 'detail_url': detail_url, + 'score': 1 + }) return From 9e6fa8a969e414eebbc5bae5012b1d9553309a15 Mon Sep 17 00:00:00 2001 From: SWG Date: Sat, 4 Mar 2017 23:04:15 +0100 Subject: [PATCH 25/31] fixed name check - it was too narrow. --- couchpotato/core/media/_base/providers/torrent/yts.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/providers/torrent/yts.py b/couchpotato/core/media/_base/providers/torrent/yts.py index 06d3bea..8c620a2 100644 --- a/couchpotato/core/media/_base/providers/torrent/yts.py +++ b/couchpotato/core/media/_base/providers/torrent/yts.py @@ -33,7 +33,9 @@ class Base(TorrentMagnetProvider): result = data['data']['movies'][i] name = result['title'] - if getTitle(movie) == name: + t = getTitle(movie).split(' ') + + if all(word in name for word in t): year = result['year'] detail_url = result['url'] From 23ef6611eb99617013d04531400b05f2908b9373 Mon Sep 17 00:00:00 2001 From: SWG Date: Sat, 4 Mar 2017 23:14:34 +0100 Subject: [PATCH 26/31] movie name was too simple - used original title. --- couchpotato/core/media/_base/providers/torrent/yts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/providers/torrent/yts.py b/couchpotato/core/media/_base/providers/torrent/yts.py index 8c620a2..c7512e9 100644 --- a/couchpotato/core/media/_base/providers/torrent/yts.py +++ b/couchpotato/core/media/_base/providers/torrent/yts.py @@ -33,7 +33,7 @@ class Base(TorrentMagnetProvider): result = data['data']['movies'][i] name = result['title'] - t = getTitle(movie).split(' ') + t = movie['info']['original_title'] if all(word in name for word in t): From a626789fbb8feae2a883e99eac8b3535bc4097c6 Mon Sep 17 00:00:00 2001 From: SWG Date: Sat, 4 Mar 2017 23:18:00 +0100 Subject: [PATCH 27/31] increased limit - sometimes long film series like Star Wars puts the result at the bottom. --- couchpotato/core/media/_base/providers/torrent/yts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/providers/torrent/yts.py b/couchpotato/core/media/_base/providers/torrent/yts.py index c7512e9..de46942 100644 --- a/couchpotato/core/media/_base/providers/torrent/yts.py +++ b/couchpotato/core/media/_base/providers/torrent/yts.py @@ -17,7 +17,7 @@ class Base(TorrentMagnetProvider): } def _search(self, movie, quality, results): - limit = 5 + limit = 10 page = 1 data = self.getJsonData(self.urls['search'] % (getTitle(movie), limit, page)) From 53913723c0e4d7b8c2e44a63cfe6463e1fd0b35a Mon Sep 17 00:00:00 2001 From: SWG Date: Sat, 4 Mar 2017 23:20:51 +0100 Subject: [PATCH 28/31] forgot to split name - working/fixed now. --- couchpotato/core/media/_base/providers/torrent/yts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/providers/torrent/yts.py b/couchpotato/core/media/_base/providers/torrent/yts.py index de46942..34cb93c 100644 --- a/couchpotato/core/media/_base/providers/torrent/yts.py +++ b/couchpotato/core/media/_base/providers/torrent/yts.py @@ -33,7 +33,7 @@ class Base(TorrentMagnetProvider): result = data['data']['movies'][i] name = result['title'] - t = movie['info']['original_title'] + t = movie['info']['original_title'].split(' ') if all(word in name for word in t): From 9f492ad22b082b5673b921cdabaabff4b1bfc0b2 Mon Sep 17 00:00:00 2001 From: swkgram Date: Thu, 9 Mar 2017 22:06:54 +0100 Subject: [PATCH 29/31] fixed wonder woman 2009/2017 release confusion. --- couchpotato/core/media/_base/providers/torrent/yts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/providers/torrent/yts.py b/couchpotato/core/media/_base/providers/torrent/yts.py index 34cb93c..55029b2 100644 --- a/couchpotato/core/media/_base/providers/torrent/yts.py +++ b/couchpotato/core/media/_base/providers/torrent/yts.py @@ -35,7 +35,7 @@ class Base(TorrentMagnetProvider): t = movie['info']['original_title'].split(' ') - if all(word in name for word in t): + if all(word in name for word in t) and movie['info']['year'] == result['year']: year = result['year'] detail_url = result['url'] From b87c3f4e144777ab9f6d0159b575643cc563eecb Mon Sep 17 00:00:00 2001 From: "Sebastian W. Gram" Date: Thu, 9 Mar 2017 22:39:52 +0100 Subject: [PATCH 30/31] fixed key error exception throws a key error exception when finding 0 movie results from the api call - tried to return error from the repsonse but there will never exists an error, because of the way yts.ag's API works. --- couchpotato/core/media/_base/providers/torrent/yts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/providers/torrent/yts.py b/couchpotato/core/media/_base/providers/torrent/yts.py index 55029b2..5a6b330 100644 --- a/couchpotato/core/media/_base/providers/torrent/yts.py +++ b/couchpotato/core/media/_base/providers/torrent/yts.py @@ -25,7 +25,7 @@ class Base(TorrentMagnetProvider): movie_count = tryInt(data['data']['movie_count']) if movie_count == 0: - log.error('%s returned an error (search or tryInt() failed): %s', (self.getName(), data['error'])) + log.error('%s returned an error (search or tryInt() failed): found no results', (self.getName())) else: movie_results = data['data']['movies'] From 50d3a5b4062962f9fbc77724581f9cfa4b2e0f88 Mon Sep 17 00:00:00 2001 From: "Sebastian W. Gram" Date: Thu, 9 Mar 2017 23:18:58 +0100 Subject: [PATCH 31/31] changed log type when not getting any results --- couchpotato/core/media/_base/providers/torrent/yts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/providers/torrent/yts.py b/couchpotato/core/media/_base/providers/torrent/yts.py index 5a6b330..f4567a9 100644 --- a/couchpotato/core/media/_base/providers/torrent/yts.py +++ b/couchpotato/core/media/_base/providers/torrent/yts.py @@ -25,7 +25,7 @@ class Base(TorrentMagnetProvider): movie_count = tryInt(data['data']['movie_count']) if movie_count == 0: - log.error('%s returned an error (search or tryInt() failed): found no results', (self.getName())) + log.debug('%s - found no results', (self.getName())) else: movie_results = data['data']['movies']