From d84897ff335db2c26739abb90d7d304cc584867f Mon Sep 17 00:00:00 2001 From: Dustin Brewer Date: Sun, 21 Dec 2014 13:25:06 -0800 Subject: [PATCH 01/30] Initial support for Plex Media Server w/Plex Home --- couchpotato/core/notifications/plex/__init__.py | 20 +++++++++++ couchpotato/core/notifications/plex/server.py | 45 ++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 5 deletions(-) diff --git a/couchpotato/core/notifications/plex/__init__.py b/couchpotato/core/notifications/plex/__init__.py index 4a64ec5..957369b 100755 --- a/couchpotato/core/notifications/plex/__init__.py +++ b/couchpotato/core/notifications/plex/__init__.py @@ -24,6 +24,26 @@ config = [{ 'description': 'Hostname/IP, default localhost' }, { + 'name': 'username', + 'label': 'Username', + 'default': '', + 'description': 'Required for myPlex' + }, + { + 'name': 'password', + 'label': 'Password', + 'default': '', + 'type': 'password', + 'description': 'Required for myPlex' + }, + { + 'name': 'auth_token', + 'label': 'Auth Token', + 'default': '', + 'advanced': True, + 'description': 'Required for myPlex' + }, + { 'name': 'clients', 'default': '', 'description': 'Comma separated list of client names\'s (computer names). Top right when you start Plex' diff --git a/couchpotato/core/notifications/plex/server.py b/couchpotato/core/notifications/plex/server.py index cd11f49..4b8ea05 100644 --- a/couchpotato/core/notifications/plex/server.py +++ b/couchpotato/core/notifications/plex/server.py @@ -35,11 +35,46 @@ class PlexServer(object): if path.startswith('/'): path = path[1:] - data = self.plex.urlopen('%s/%s' % ( - self.createHost(self.plex.conf('media_server'), port = 32400), - path - )) - + #Maintain support for older Plex installations without myPlex + if not self.plex.conf('auth_token') and not self.plex.conf('username') and not self.plex.conf('password'): + data = self.plex.urlopen('%s/%s' % ( + self.createHost(self.plex.conf('media_server'), port = 32400), + path + )) + else: + #Fetch X-Plex-Token if it doesn't exist but a username/password do + if not self.plex.conf('auth_token') and (self.plex.conf('username') and self.plex.conf('password')): + import urllib2, base64 + log.info("Fetching a new X-Plex-Token from plex.tv") + username = self.plex.conf('username') + password = self.plex.conf('password') + 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-Client-Identifier", "b3a6b24dcab2224bdb101fc6aa08ea5e2f3147d6") + req.add_header("X-Plex-Version", "1.0") + + try: + response = urllib2.urlopen(req) + except urllib2.URLError, e: + log.info("Error fetching token from plex.tv") + + try: + auth_tree = etree.parse(response) + token = auth_tree.findall(".//authentication-token")[0].text + self.plex.conf('auth_token', token) + + except (ValueError, IndexError) as e: + log.info("Error parsing plex.tv response: " + ex(e)) + + #Add X-Plex-Token header for myPlex support workaround + data = self.plex.urlopen('%s/%s?X-Plex-Token=%s' % ( + self.createHost(self.plex.conf('media_server'), port = 32400), + path, + self.plex.conf('auth_token') + )) + if data_type == 'xml': return etree.fromstring(data) else: From 9318e1934791f608fbf5c917b44838700695e8e9 Mon Sep 17 00:00:00 2001 From: jonnyboy Date: Wed, 31 Dec 2014 08:21:58 -0500 Subject: [PATCH 02/30] New torrent search provider hdaccess.net --- .../core/media/_base/providers/torrent/hdaccess.py | 150 +++++++++++++++++++++ .../core/media/movie/providers/torrent/hdaccess.py | 11 ++ 2 files changed, 161 insertions(+) create mode 100644 couchpotato/core/media/_base/providers/torrent/hdaccess.py create mode 100644 couchpotato/core/media/movie/providers/torrent/hdaccess.py diff --git a/couchpotato/core/media/_base/providers/torrent/hdaccess.py b/couchpotato/core/media/_base/providers/torrent/hdaccess.py new file mode 100644 index 0000000..811c599 --- /dev/null +++ b/couchpotato/core/media/_base/providers/torrent/hdaccess.py @@ -0,0 +1,150 @@ +import re +import json +import traceback + +from couchpotato.core.helpers.variable import tryInt, getIdentifier +from couchpotato.core.logger import CPLog +from couchpotato.core.media._base.providers.torrent.base import TorrentProvider + + +log = CPLog(__name__) + + +class Base(TorrentProvider): + + urls = { + 'test': 'https://hdaccess.net/', + 'detail': 'https://hdaccess.net/details.php?id=%s', + 'search': 'https://hdaccess.net/searchapi.php?apikey=%s&username=%s&imdbid=%s&internal=%s', + 'download': 'https://hdaccess.net/grab.php?torrent=%s&apikey=%s', + } + + http_time_between_calls = 1 # Seconds + + def _search(self, movie, quality, results): + data = self.getJsonData(self.urls['search'] % (self.conf('apikey'), self.conf('username'), getIdentifier(movie), self.conf('internal_only'))) + + if data: + try: + #for result in data[]: + for key, result in data.iteritems(): + if tryInt(result['total_results']) == 0: + return + torrentscore = self.conf('extra_score') + releasegroup = result['releasegroup'] + resolution = result['resolution'] + encoding = result['encoding'] + freeleech = tryInt(result['freeleech']) + seeders = tryInt(result['seeders']) + torrent_desc = '/ %s / %s / %s / %s seeders' % (releasegroup, resolution, encoding, seeders) + + if freeleech > 0 and self.conf('prefer_internal'): + torrent_desc += '/ Internal' + torrentscore += 200 + + if resolution == '1080p': + torrentscore += 100 + if encoding == 'x264' and self.conf('favor') in ['encode', 'all']: + torrentscore += 100 + elif encoding == 'Encode' and self.conf('favor') in ['encode', 'all']: + torrentscore += 100 + elif encoding == 'Remux' and self.conf('favor') in ['remux', 'all']: + torrentscore += 200 + elif encoding == 'Bluray' and self.conf('favor') in ['bluray', 'all']: + torrentscore += 300 + + if seeders == 0: + torrentscore = 0 + + name = result['release_name'] + year = tryInt(result['year']) + + results.append({ + 'id': tryInt(result['torrentid']), + 'name': re.sub('[^A-Za-z0-9\-_ \(\).]+', '', '%s (%s) %s' % (name, year, torrent_desc)), + 'url': self.urls['download'] % (result['torrentid'], self.conf('apikey')), + 'detail_url': self.urls['detail'] % result['torrentid'], + 'size': tryInt(result['size']), + 'seeders': tryInt(result['seeders']), + 'leechers': tryInt(result['leechers']), + 'age': tryInt(result['age']), + 'score': torrentscore + }) + except: + log.error('Failed getting results from %s: %s', (self.getName(), traceback.format_exc())) +config = [{ + 'name': 'hdaccess', + 'groups': [ + { + 'tab': 'searcher', + 'list': 'torrent_providers', + 'name': 'HDAccess', + 'wizard': True, + 'description': 'HDAccess', + 'icon': 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAADuUlEQVQ4yz3T209bdQAH8O/vnNNzWno5FIpAKZdSLi23gWMDtumWuSXOyzJj9M1kyIOPS1xiYuKe9GUPezZZnGIiMTqTxS1bdIuYkG2MWKBAKYVszOgKFkrbA+259HfO+fli/PwPHzI+Pg5CCEAI2VcUlEsl1tHdU7P5bGOkWChEaaUCwvHpmkD93POn6bwgCMQGAMYYYwyCruuQnE7SPzjIstvb8l+bm5fXkokJSmlQEkUQAIpSRH5vd0tyum7I/sA1Z5VH2ctmiGWZjHw4McE1NAZtQ9fD25kXt1VN7es7dNjuGRjiJFeVpWo6slsZPhF/Ys/PPeIs2056ff7zIOS5rpU5/viJEwwEnu3Mi18dojjw0aWP6amz57h9RSE/35zinq2nuGjvIQwOj7K2SKeZWkk0auXSSZ+/ZopSy+CbW1pQKpWu6Jr2/qVPPqWRjm6HWi6Tm999g3RyGbndLCqGgVBrO3F7fHykK0YX47NNtGLYlBq/c+H2iD+3k704dHQUDcFmQVXLyP6zhfTqCl45fQYjx17FemoJunoAk1bQFGoVhkdPwNC0ix2dMT+3llodM02rKdo7gN3dHAEhuH/vNgDg3Pl3cPaNt2GZJpYX5lBbFwClBukfGobL5WrayW6NccVCISY4HIQxYts2Q3J5CXOPHuLlo6NoCoXQ2hbG0JFRpJYWcVDIQ5ZlyL5qW5b9hNlWjKsYBgzDgKppMCoGHty7A0orOHbyNNweL+obGnDm9TdhWSYS8Vn4a2shOZ0QJRGSKIHjeGGtWNhjqqpyG+k04k8eozPai9ZwByavf4kfpyZxZGwMfYOHsbwQx34hB5dL4syKweRq/xpXHwzNapqWSSYWMDszzYqFPEaOn4KiKJiZfoCZ6d8Am+GtC++iXCpjaf4P9vefT8HzfKarp3eWRKMxCILwuWXSz977YIK2RTodDoGH1+OG1+tDlbsKkuiAJEngeWBjNUUnv7rucIiOLyzTvMKJTgnVtbVXLctK3L31g+NAUajL5bEptaDpOnTdgGkzVHl9drms0ju3fnJIkphoaQtfbQiFwAcCAY5wnCE5Xff3i8XX4o9nGksH+8zl9hAGZlWMCivkc9z0L3fZ999+LTCGZKi55YJTFHfye3sc6e/vB88LpK6+iWlqSS4WcpcNXZtwOp3B6mo/REmCSSkEgd+qq3vpRkt75Fp9Y1BZWZwnhq4zEovF/u/MATAti4U7umvyu9kR27aikihC9vvTnV2xufVUMu/2uIksy/9tZvgX49fLmAMx3bsAAAAASUVORK5CYII=', + 'options': [ + { + 'name': 'enabled', + 'type': 'enabler', + 'default': False, + }, + { + 'name': 'username', + 'default': '', + 'description': 'Enter your site username.', + }, + { + 'name': 'apikey', + 'default': '', + 'label': 'API Key', + 'description': 'Enter your site api key. This can be find in \'Edit My Profile\'->Security', + }, + { + 'name': 'seed_ratio', + 'label': 'Seed ratio', + 'type': 'float', + 'default': 0, + 'description': 'Will not be (re)moved until this seed ratio is met. HDAccess minimum is 1:1.', + }, + { + 'name': 'seed_time', + 'label': 'Seed time', + 'type': 'int', + 'default': 0, + 'description': 'Will not be (re)moved until this seed time (in hours) is met. HDAccess minimum is 48 hours.', + }, + { + 'name': 'prefer_internal', + 'advanced': True, + 'type': 'bool', + 'default': 1, + 'description': 'Favors internal releases over non-internal releases.', + }, + { + 'name': 'favor', + 'advanced': True, + 'default': 'all', + 'type': 'dropdown', + 'values': [('Blurays & Encodes & Remuxes', 'all'), ('Blurays', 'bluray'), ('Encodes', 'encode'), ('Remuxes', 'remux'), ('None', 'none')], + 'description': 'Give extra scoring to blurays(+300), remuxes(+200) or encodes(+100).', + }, + { + 'name': 'internal_only', + 'advanced': True, + 'label': 'Internal Only', + 'type': 'bool', + 'default': False, + 'description': 'Only download releases marked as HDAccess internal', + }, + { + '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/hdaccess.py b/couchpotato/core/media/movie/providers/torrent/hdaccess.py new file mode 100644 index 0000000..fae2cf5 --- /dev/null +++ b/couchpotato/core/media/movie/providers/torrent/hdaccess.py @@ -0,0 +1,11 @@ +from couchpotato.core.logger import CPLog +from couchpotato.core.media._base.providers.torrent.hdaccess import Base +from couchpotato.core.media.movie.providers.base import MovieProvider + +log = CPLog(__name__) + +autoload = 'HDAccess' + + +class HDAccess(MovieProvider, Base): + pass From ac6f295c936e45cd61ba304bccfc3783c24f44d0 Mon Sep 17 00:00:00 2001 From: grasshide Date: Mon, 5 Jan 2015 15:00:40 +0100 Subject: [PATCH 03/30] New algogithm to use some kind of crowd logic on newznab powered providers. --- .../media/movie/providers/automation/crowdai.py | 94 ++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 couchpotato/core/media/movie/providers/automation/crowdai.py diff --git a/couchpotato/core/media/movie/providers/automation/crowdai.py b/couchpotato/core/media/movie/providers/automation/crowdai.py new file mode 100644 index 0000000..0d33f11 --- /dev/null +++ b/couchpotato/core/media/movie/providers/automation/crowdai.py @@ -0,0 +1,94 @@ +from xml.etree.ElementTree import QName +import datetime +import re + +from couchpotato.core.helpers.rss import RSS +from couchpotato.core.helpers.variable import tryInt, splitString +from couchpotato.core.logger import CPLog +from couchpotato.core.media.movie.providers.automation.base import Automation + + +log = CPLog(__name__) + +autoload = 'CrowdAI' + + +class CrowdAI(Automation, RSS): + + interval = 1800 + + def getIMDBids(self): + + movies = [] + + newznab_namespace = 'http://www.newznab.com/DTD/2010/feeds/attributes/' + urls = dict(zip(splitString(self.conf('automation_urls')), [tryInt(x) for x in splitString(self.conf('automation_urls_use'))])) + + for url in urls: + + if not urls[url]: + continue + + rss_movies = self.getRSSData(url) + + for movie in rss_movies: + + title = "" + description = self.getTextElement(movie, "description") + grabs = 0 + + for item in movie: + if item.attrib.get('name') == 'grabs': + grabs = item.attrib.get('value') + break + + + if int(grabs) > tryInt(self.conf('number_grabs')): + title = re.match( r'.*Title: .a href.*/">(.*) \(\d{4}\).*', description).group(1) + log.info2('%s grabs for movie: %s, enqueue...', (grabs, title)) + year = re.match( r'.*Year: (\d{4}).*', description).group(1) + imdb = self.search(title, year) + + if imdb and self.isMinimalMovie(imdb): + movies.append(imdb['imdb']) + + return movies + + +config = [{ + 'name': 'crowdai', + 'groups': [ + { + 'tab': 'automation', + 'list': 'automation_providers', + 'name': 'crowdai_automation', + 'label': 'CrowdAI', + 'description': 'Imports from any newznab powered NZB providers RSS feed depending on the number of grabs per movie. Go to your newznab site and find the RSS section. Then copy the copy paste the link under "Movies > x264 feed" here.', + 'options': [ + { + 'name': 'automation_enabled', + 'default': False, + 'type': 'enabler', + }, + { + 'name': 'automation_urls_use', + 'label': 'Use', + 'default': '1', + }, + { + 'name': 'automation_urls', + 'label': 'url', + 'type': 'combined', + 'combine': ['automation_urls_use', 'automation_urls'], + 'default': 'http://YOUR_PROVIDER/rss?t=THE_MOVIE_CATEGORY&i=YOUR_USER_ID&r=YOUR_API_KEY&res=2&rls=2&num=100', + }, + { + 'name': 'number_grabs', + 'default': '500', + 'label': 'Grab threshold', + 'description': 'Number of grabs required', + }, + ], + }, + ], +}] From a3af784c18024667fc93ac205b0d8713a6c8df60 Mon Sep 17 00:00:00 2001 From: Steven Lu Date: Tue, 6 Jan 2015 18:33:06 -0500 Subject: [PATCH 04/30] Adding the ability to receive notifications through Webhooks --- couchpotato/core/notifications/webhook.py | 66 +++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 couchpotato/core/notifications/webhook.py diff --git a/couchpotato/core/notifications/webhook.py b/couchpotato/core/notifications/webhook.py new file mode 100644 index 0000000..d970bb5 --- /dev/null +++ b/couchpotato/core/notifications/webhook.py @@ -0,0 +1,66 @@ +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 = 'Webhook' + +class Webhook(Notification): + + + def notify(self, message = '', data = None, listener = None): + if not data: data = {} + + post_data = { + 'message': toUnicode(message) + } + + if getIdentifier(data): + post_data.update({ + 'imdb_id': getIdentifier(data) + }) + + headers = { + 'Content-type': 'application/x-www-form-urlencoded' + } + + try: + self.urlopen(self.conf('url'), headers = headers, data = post_data, show_error = False) + return True + except: + log.error('Webhook notification failed: %s', traceback.format_exc()) + + return False + + +config = [{ + 'name': 'webhook', + 'groups': [ + { + 'tab': 'notifications', + 'list': 'notification_providers', + 'name': 'webhook', + 'label': 'Webhook', + 'options': [ + { + 'name': 'enabled', + 'default': 0, + 'type': 'enabler', + }, + { + 'name': 'url', + 'description': 'The URL to send notification data to when ' + }, + { + 'name': 'on_snatch', + 'default': 0, + 'type': 'bool', + 'advanced': True, + 'description': 'Also send message when movie is snatched.', + } + ] + } + ] +}] From ee8406e026aa9b6751277373752f388af764aa2b Mon Sep 17 00:00:00 2001 From: Andrew Dumaresq Date: Sun, 11 Jan 2015 11:45:29 -0500 Subject: [PATCH 05/30] Minor text change --- couchpotato/core/downloaders/putio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/downloaders/putio/__init__.py b/couchpotato/core/downloaders/putio/__init__.py index 60ccad5..48794d9 100644 --- a/couchpotato/core/downloaders/putio/__init__.py +++ b/couchpotato/core/downloaders/putio/__init__.py @@ -30,7 +30,7 @@ config = [{ }, { 'name': 'folder', - 'description': ('The folder on putio where you want the upload to go','Must be a folder in the root directory'), + 'description': ('The folder on putio where you want the upload to go','Will find the first first folder that matches this name'), 'default': 0, }, { From 20e12836270af7cb523883b17b0271006fdd8573 Mon Sep 17 00:00:00 2001 From: Andrew Dumaresq Date: Sun, 11 Jan 2015 11:57:14 -0500 Subject: [PATCH 06/30] better way to find the folder --- couchpotato/core/downloaders/putio/main.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/couchpotato/core/downloaders/putio/main.py b/couchpotato/core/downloaders/putio/main.py index ce58ff7..478d15c 100644 --- a/couchpotato/core/downloaders/putio/main.py +++ b/couchpotato/core/downloaders/putio/main.py @@ -28,6 +28,19 @@ class PutIO(DownloaderBase): return super(PutIO, self).__init__() + # This is a recusive function to check for the folders + def recursionFolder(self, client, folder, tfolder): + files = client.File.list(folder) + for f in files: + if f.name == tfolder and f.content_type == "application/x-directory": + return f.id + elif f.content_type == "application/x-directory": + result = self.recursionFolder(client, f.id, tfolder) + if result != 0: + return result + return 0 + + # This will check the root for the folder, and kick of recusively checking sub folder def convertFolder(self, client, folder): if folder == 0: return 0 @@ -36,6 +49,10 @@ class PutIO(DownloaderBase): for f in files: if f.name == folder and f.content_type == "application/x-directory": return f.id + elif f.content_type == "application/x-directory": + result = self.recursionFolder(client, f.id, folder) + if result != 0: + return result #If we get through the whole list and don't get a match we will use the root return 0 From 89836be1d1c21e3bd71790fb5afe78e1a9d164c4 Mon Sep 17 00:00:00 2001 From: David Stark Date: Mon, 12 Jan 2015 17:37:26 +0100 Subject: [PATCH 07/30] added touch and chown to the $PID_FILE --- init/ubuntu | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init/ubuntu b/init/ubuntu index a21e2d3..cbe20e0 100755 --- a/init/ubuntu +++ b/init/ubuntu @@ -95,6 +95,8 @@ fi case "$1" in start) + touch $PID_FILE + chown $RUN_AS $PID_FILE echo "Starting $DESC" start-stop-daemon -d $APP_PATH -c $RUN_AS $EXTRA_SSD_OPTS --start --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS ;; From e52f50b204902551043bf3aedc6f6c3f29326835 Mon Sep 17 00:00:00 2001 From: coolius Date: Mon, 19 Jan 2015 17:17:31 +0000 Subject: [PATCH 08/30] Update torrentday.py Updated torrentday url to blockade-free torrentday.eu --- .../core/media/_base/providers/torrent/torrentday.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/couchpotato/core/media/_base/providers/torrent/torrentday.py b/couchpotato/core/media/_base/providers/torrent/torrentday.py index a3e9b78..496debe 100644 --- a/couchpotato/core/media/_base/providers/torrent/torrentday.py +++ b/couchpotato/core/media/_base/providers/torrent/torrentday.py @@ -8,12 +8,12 @@ log = CPLog(__name__) class Base(TorrentProvider): urls = { - 'test': 'http://www.td.af/', - 'login': 'http://www.td.af/torrents/', - 'login_check': 'http://www.torrentday.com/userdetails.php', - 'detail': 'http://www.td.af/details.php?id=%s', - 'search': 'http://www.td.af/V3/API/API.php', - 'download': 'http://www.td.af/download.php/%s/%s', + 'test': 'https://torrentday.eu/', + 'login': 'https://torrentday.eu/torrents/', + 'login_check': 'https://torrentday.eu/userdetails.php', + 'detail': 'https://torrentday.eu/details.php?id=%s', + 'search': 'https://torrentday.eu/V3/API/API.php', + 'download': 'https://torrentday.eu/download.php/%s/%s', } http_time_between_calls = 1 # Seconds @@ -68,7 +68,7 @@ config = [{ 'tab': 'searcher', 'list': 'torrent_providers', 'name': 'TorrentDay', - 'description': 'TorrentDay', + 'description': 'TorrentDay', 'wizard': True, 'icon': 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAC5ElEQVQ4y12TXUgUURTH//fO7Di7foeQJH6gEEEIZZllVohfSG/6UA+RSFAQQj74VA8+Bj30lmAlRVSEvZRfhNhaka5ZUG1paKaW39tq5O6Ou+PM3M4o6m6X+XPPzD3zm/+dcy574r515WfIW8CZBM4YAA5Gc/aQC3yd7oXYEONcsISE5dTDh91HS0t7FEWhBUAeN9ynV/d9qJAgE4AECURAcVsGlCCnly26LMA0IQwTa52dje3d3e3hcPi8qqrrMjcVYI3EHCQZlkFOHBwR2QHh2ASAAIJxWGAQEDxjePhs3527XjJwnb37OHBq0T+Tyyjh+9KnEzNJ7nouc1Q/3A3HGsOvnJy+PSUlj81w2Lny9WuJ6+3AmTjD4HOcrdR2dWXLRQePvyaSLfQOPMPC8mC9iHCsOxSyzJCelzdSXlNzD5ujpb25Wbfc/XXJemTXF4+nnCNq+AMLe50uFfEJTiw4GXSFtiHL0SnIq66+p0kSArqO+eH3RdsAv9+f5vW7L7GICq6rmM8XBCAXlBw90rOyxibn5yzfkg/L09M52/jxqdESaIrBXHYZZbB1GX8cEpySxKIB8S5XcOnvqpli1zuwmrTtoLjw5LOK/eeuWsE4JH5IRPaPZKiKigmPp+5pa+u1aEjIMhEgrRkmi9mgxGUhM7LNJSzOzsE3+cOeExovXOjdytE0LV4zqNZUtV0uZzAGoGkhDH/2YHZiErmv4uyWQnZZWc+hoqL3WzlTExN5hhA8IEwkZWZOxwB++30YG/9GkYCPvqAaHAW5uWPROW86OmqCprUR7z1yZDAGQNuCvkoB/baIKUBWMTYymv+gra3eJNvjXu+B562tFyXqTJ6YuHK8rKwvBmC3vR7cOCPQLWFz8LnfXWUrJo9U19BwMyUlJRjTSMJ2ENxUiGxq9KXQfwqYlnWstvbR5aamG9g0uzM8Q4OFt++3NNixQ2NgYmeN03FOTUv7XVpV9aKisvLl1vN/WVhNc/Fi1NEAAAAASUVORK5CYII=', 'options': [ From cdb9cfe75652cca2bdc28d7d69218f800b4942fd Mon Sep 17 00:00:00 2001 From: coolius Date: Mon, 19 Jan 2015 17:18:56 +0000 Subject: [PATCH 09/30] Update iptorrents.py Updated iptorrents url to blockade-free iptorrents.eu --- couchpotato/core/media/_base/providers/torrent/iptorrents.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/couchpotato/core/media/_base/providers/torrent/iptorrents.py b/couchpotato/core/media/_base/providers/torrent/iptorrents.py index 0915ca3..6d289c3 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://www.iptorrents.com/', - 'base_url': 'https://www.iptorrents.com', - 'login': 'https://www.iptorrents.com/torrents/', - 'login_check': 'https://www.iptorrents.com/inbox.php', - 'search': 'https://www.iptorrents.com/torrents/?%s%%s&q=%s&qf=ti&p=%%d', + 'test': 'https://www.iptorrents.eu/', + 'base_url': 'https://www.iptorrents.eu', + 'login': 'https://www.iptorrents.eu/torrents/', + 'login_check': 'https://www.iptorrents.eu/inbox.php', + 'search': 'https://www.iptorrents.eu/torrents/?%s%%s&q=%s&qf=ti&p=%%d', } http_time_between_calls = 1 # Seconds @@ -120,7 +120,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': [ From c9b4c8167f6f76bd121091a2cac9d671cc7481f8 Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 28 Jan 2015 11:35:26 +0100 Subject: [PATCH 10/30] Actual include host in log --- couchpotato/core/plugins/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/base.py b/couchpotato/core/plugins/base.py index c02e8f7..e4b27c9 100644 --- a/couchpotato/core/plugins/base.py +++ b/couchpotato/core/plugins/base.py @@ -206,7 +206,7 @@ class Plugin(object): if self.http_failed_disabled[host] > (time.time() - 900): log.info2('Disabled calls to %s for 15 minutes because so many failed requests.', host) if not show_error: - raise Exception('Disabled calls to %s for 15 minutes because so many failed requests') + raise Exception('Disabled calls to %s for 15 minutes because so many failed requests' % host) else: return '' else: From b00e69e222edd2b33e7daea8c203a7bcfb34dd45 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 31 Jan 2015 10:32:15 +0100 Subject: [PATCH 11/30] TorrentBytes cut of longer titles fix #4590 --- couchpotato/core/media/_base/providers/torrent/torrentbytes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/providers/torrent/torrentbytes.py b/couchpotato/core/media/_base/providers/torrent/torrentbytes.py index fadd2ea..32221d8 100644 --- a/couchpotato/core/media/_base/providers/torrent/torrentbytes.py +++ b/couchpotato/core/media/_base/providers/torrent/torrentbytes.py @@ -56,7 +56,7 @@ class Base(TorrentProvider): full_id = link['href'].replace('details.php?id=', '') torrent_id = full_id[:6] - name = toUnicode(link.contents[0].encode('ISO-8859-1')).strip() + name = toUnicode(link.get('title', link.contents[0]).encode('ISO-8859-1')).strip() results.append({ 'id': torrent_id, From e8a3645bc68d6c2d22c8112ea62668157ff0eb10 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 1 Feb 2015 12:18:31 +0100 Subject: [PATCH 12/30] Log failed folder getting --- couchpotato/core/plugins/browser.py | 1 + 1 file changed, 1 insertion(+) diff --git a/couchpotato/core/plugins/browser.py b/couchpotato/core/plugins/browser.py index 632375d..660070a 100644 --- a/couchpotato/core/plugins/browser.py +++ b/couchpotato/core/plugins/browser.py @@ -87,6 +87,7 @@ class FileBrowser(Plugin): try: dirs = self.getDirectories(path = path, show_hidden = show_hidden) except: + log.error('Failed getting directory "%s" : %s', (path, traceback.format_exc())) dirs = [] parent = os.path.dirname(path.rstrip(os.path.sep)) From fb8a66d2078d5ead721b3f857e8aeb47c4d1181d Mon Sep 17 00:00:00 2001 From: maikhorma Date: Sun, 1 Feb 2015 14:43:16 -0500 Subject: [PATCH 13/30] Shortcut to address #2782 Until there is a more elegant solution to avoid unwanted white space trimming, this will let users disable that feature if it is not something they need. --- couchpotato/core/plugins/renamer.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/renamer.py b/couchpotato/core/plugins/renamer.py index d0720d0..df25fca 100755 --- a/couchpotato/core/plugins/renamer.py +++ b/couchpotato/core/plugins/renamer.py @@ -885,7 +885,9 @@ Remove it if you want it to be renamed (again, or at least let it try again) #If information is not available, we don't want the tag in the filename replaced = replaced.replace('<' + x + '>', '') - replaced = self.replaceDoubles(replaced.lstrip('. ')) + if self.conf('replace_doubles'): + replaced = self.replaceDoubles(replaced.lstrip('. ')) + for x, r in replacements.items(): if x in ['thename', 'namethe']: replaced = replaced.replace(six.u('<%s>') % toUnicode(x), toUnicode(r)) @@ -1343,6 +1345,14 @@ config = [{ 'options': rename_options }, { + 'advanced': True, + 'name': 'replace_doubles', + 'type': 'bool', + 'label': 'Consider Missing Data', + 'description': 'Attempt to clean up double separaters due to missing data for fields', + 'default': True + }, + { 'name': 'unrar', 'type': 'bool', 'description': 'Extract rar files if found.', From cf83f99be07a69ca275ee318d6879c409e18c5ac Mon Sep 17 00:00:00 2001 From: maikhorma Date: Sun, 1 Feb 2015 15:28:05 -0500 Subject: [PATCH 14/30] Updated UI Tried to make it a bit cleaner. --- couchpotato/core/plugins/renamer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/plugins/renamer.py b/couchpotato/core/plugins/renamer.py index df25fca..60b4f8b 100755 --- a/couchpotato/core/plugins/renamer.py +++ b/couchpotato/core/plugins/renamer.py @@ -1348,8 +1348,8 @@ config = [{ 'advanced': True, 'name': 'replace_doubles', 'type': 'bool', - 'label': 'Consider Missing Data', - 'description': 'Attempt to clean up double separaters due to missing data for fields', + 'label': 'Clean Name', + 'description': ('Attempt to clean up double separaters due to missing data for fields.','Sometimes this eliminates wanted white space (see #2782).'), 'default': True }, { From 7b9043c16bb55a93898dae5f4b0d6754a78d3c1e Mon Sep 17 00:00:00 2001 From: sammy2142 Date: Tue, 10 Feb 2015 11:11:30 +0000 Subject: [PATCH 15/30] Update kickass url from kickass.so to kickass.to Kickass has reverted back to the .to domain as the .so domain was seized: http://torrentfreak.com/kickasstorrents-taken-domain-name-seizure-150209/ --- couchpotato/core/media/_base/providers/torrent/kickasstorrents.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py b/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py index fb58814..d6e3ee7 100644 --- a/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py +++ b/couchpotato/core/media/_base/providers/torrent/kickasstorrents.py @@ -30,7 +30,7 @@ class Base(TorrentMagnetProvider): cat_backup_id = None proxy_list = [ - 'https://kickass.so', + 'https://kickass.to', 'http://kickass.pw', 'http://kickassto.come.in', 'http://katproxy.ws', From 7a616a81f7bcb5f7f9a04c603493d80dd10ebb50 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 12:52:05 +0100 Subject: [PATCH 16/30] Remove www from iptorrents --- couchpotato/core/media/_base/providers/torrent/iptorrents.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/couchpotato/core/media/_base/providers/torrent/iptorrents.py b/couchpotato/core/media/_base/providers/torrent/iptorrents.py index 6d289c3..61ced9c 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://www.iptorrents.eu/', - 'base_url': 'https://www.iptorrents.eu', - 'login': 'https://www.iptorrents.eu/torrents/', - 'login_check': 'https://www.iptorrents.eu/inbox.php', - 'search': 'https://www.iptorrents.eu/torrents/?%s%%s&q=%s&qf=ti&p=%%d', + 'test': 'https://iptorrents.eu/', + 'base_url': 'https://iptorrents.eu', + 'login': 'https://iptorrents.eu/torrents/', + 'login_check': 'https://iptorrents.eu/inbox.php', + 'search': 'https://iptorrents.eu/torrents/?%s%%s&q=%s&qf=ti&p=%%d', } http_time_between_calls = 1 # Seconds @@ -120,7 +120,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': [ From d5622b7cba18928acf01430ecd0033c258a95adb Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 13:01:19 +0100 Subject: [PATCH 17/30] Remove www from torrentday domain --- couchpotato/core/media/_base/providers/torrent/torrentday.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/providers/torrent/torrentday.py b/couchpotato/core/media/_base/providers/torrent/torrentday.py index 496debe..57224ff 100644 --- a/couchpotato/core/media/_base/providers/torrent/torrentday.py +++ b/couchpotato/core/media/_base/providers/torrent/torrentday.py @@ -68,7 +68,7 @@ config = [{ 'tab': 'searcher', 'list': 'torrent_providers', 'name': 'TorrentDay', - 'description': 'TorrentDay', + 'description': 'TorrentDay', 'wizard': True, 'icon': 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAC5ElEQVQ4y12TXUgUURTH//fO7Di7foeQJH6gEEEIZZllVohfSG/6UA+RSFAQQj74VA8+Bj30lmAlRVSEvZRfhNhaka5ZUG1paKaW39tq5O6Ou+PM3M4o6m6X+XPPzD3zm/+dcy574r515WfIW8CZBM4YAA5Gc/aQC3yd7oXYEONcsISE5dTDh91HS0t7FEWhBUAeN9ynV/d9qJAgE4AECURAcVsGlCCnly26LMA0IQwTa52dje3d3e3hcPi8qqrrMjcVYI3EHCQZlkFOHBwR2QHh2ASAAIJxWGAQEDxjePhs3527XjJwnb37OHBq0T+Tyyjh+9KnEzNJ7nouc1Q/3A3HGsOvnJy+PSUlj81w2Lny9WuJ6+3AmTjD4HOcrdR2dWXLRQePvyaSLfQOPMPC8mC9iHCsOxSyzJCelzdSXlNzD5ujpb25Wbfc/XXJemTXF4+nnCNq+AMLe50uFfEJTiw4GXSFtiHL0SnIq66+p0kSArqO+eH3RdsAv9+f5vW7L7GICq6rmM8XBCAXlBw90rOyxibn5yzfkg/L09M52/jxqdESaIrBXHYZZbB1GX8cEpySxKIB8S5XcOnvqpli1zuwmrTtoLjw5LOK/eeuWsE4JH5IRPaPZKiKigmPp+5pa+u1aEjIMhEgrRkmi9mgxGUhM7LNJSzOzsE3+cOeExovXOjdytE0LV4zqNZUtV0uZzAGoGkhDH/2YHZiErmv4uyWQnZZWc+hoqL3WzlTExN5hhA8IEwkZWZOxwB++30YG/9GkYCPvqAaHAW5uWPROW86OmqCprUR7z1yZDAGQNuCvkoB/baIKUBWMTYymv+gra3eJNvjXu+B562tFyXqTJ6YuHK8rKwvBmC3vR7cOCPQLWFz8LnfXWUrJo9U19BwMyUlJRjTSMJ2ENxUiGxq9KXQfwqYlnWstvbR5aamG9g0uzM8Q4OFt++3NNixQ2NgYmeN03FOTUv7XVpV9aKisvLl1vN/WVhNc/Fi1NEAAAAASUVORK5CYII=', 'options': [ From c1266a36e4c526017958b76c41973707f54c1b65 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 13:15:08 +0100 Subject: [PATCH 18/30] Re-use resursion code --- couchpotato/core/downloaders/putio/main.py | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/couchpotato/core/downloaders/putio/main.py b/couchpotato/core/downloaders/putio/main.py index 478d15c..c568582 100644 --- a/couchpotato/core/downloaders/putio/main.py +++ b/couchpotato/core/downloaders/putio/main.py @@ -29,15 +29,16 @@ class PutIO(DownloaderBase): return super(PutIO, self).__init__() # This is a recusive function to check for the folders - def recursionFolder(self, client, folder, tfolder): + def recursionFolder(self, client, folder = 0, tfolder = ''): files = client.File.list(folder) for f in files: - if f.name == tfolder and f.content_type == "application/x-directory": - return f.id - elif f.content_type == "application/x-directory": - result = self.recursionFolder(client, f.id, tfolder) - if result != 0: - return result + if f.content_type == 'application/x-directory': + if f.name == tfolder: + return f.id + else: + result = self.recursionFolder(client, f.id, tfolder) + if result != 0: + return result return 0 # This will check the root for the folder, and kick of recusively checking sub folder @@ -45,16 +46,7 @@ class PutIO(DownloaderBase): if folder == 0: return 0 else: - files = client.File.list() - for f in files: - if f.name == folder and f.content_type == "application/x-directory": - return f.id - elif f.content_type == "application/x-directory": - result = self.recursionFolder(client, f.id, folder) - if result != 0: - return result - #If we get through the whole list and don't get a match we will use the root - return 0 + return self.recursionFolder(client, 0, folder) def download(self, data = None, media = None, filedata = None): if not media: media = {} From 2277322e572b95aa61557e3b10e99de97a993e4f Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 13:47:22 +0100 Subject: [PATCH 19/30] Traceback import missing --- couchpotato/core/notifications/webhook.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/notifications/webhook.py b/couchpotato/core/notifications/webhook.py index d970bb5..8dc6329 100644 --- a/couchpotato/core/notifications/webhook.py +++ b/couchpotato/core/notifications/webhook.py @@ -1,15 +1,17 @@ +import traceback + 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 = 'Webhook' class Webhook(Notification): - def notify(self, message = '', data = None, listener = None): if not data: data = {} From 0fd01aa6974f241aab32b2b7d2bafa674a6f7640 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 14:01:51 +0100 Subject: [PATCH 20/30] Cleanup --- .../core/media/movie/providers/automation/crowdai.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/couchpotato/core/media/movie/providers/automation/crowdai.py b/couchpotato/core/media/movie/providers/automation/crowdai.py index 0d33f11..56f1fb2 100644 --- a/couchpotato/core/media/movie/providers/automation/crowdai.py +++ b/couchpotato/core/media/movie/providers/automation/crowdai.py @@ -1,5 +1,3 @@ -from xml.etree.ElementTree import QName -import datetime import re from couchpotato.core.helpers.rss import RSS @@ -21,7 +19,6 @@ class CrowdAI(Automation, RSS): movies = [] - newznab_namespace = 'http://www.newznab.com/DTD/2010/feeds/attributes/' urls = dict(zip(splitString(self.conf('automation_urls')), [tryInt(x) for x in splitString(self.conf('automation_urls_use'))])) for url in urls: @@ -33,20 +30,18 @@ class CrowdAI(Automation, RSS): for movie in rss_movies: - title = "" - description = self.getTextElement(movie, "description") + description = self.getTextElement(movie, 'description') grabs = 0 - + for item in movie: if item.attrib.get('name') == 'grabs': grabs = item.attrib.get('value') break - - + if int(grabs) > tryInt(self.conf('number_grabs')): - title = re.match( r'.*Title: .a href.*/">(.*) \(\d{4}\).*', description).group(1) + title = re.match(r'.*Title: .a href.*/">(.*) \(\d{4}\).*', description).group(1) log.info2('%s grabs for movie: %s, enqueue...', (grabs, title)) - year = re.match( r'.*Year: (\d{4}).*', description).group(1) + year = re.match(r'.*Year: (\d{4}).*', description).group(1) imdb = self.search(title, year) if imdb and self.isMinimalMovie(imdb): @@ -80,7 +75,7 @@ config = [{ 'label': 'url', 'type': 'combined', 'combine': ['automation_urls_use', 'automation_urls'], - 'default': 'http://YOUR_PROVIDER/rss?t=THE_MOVIE_CATEGORY&i=YOUR_USER_ID&r=YOUR_API_KEY&res=2&rls=2&num=100', + 'default': 'http://YOUR_PROVIDER/rss?t=THE_MOVIE_CATEGORY&i=YOUR_USER_ID&r=YOUR_API_KEY&res=2&rls=2&num=100', }, { 'name': 'number_grabs', From 9b91d1d6c0c0274fe3d94c25a3fb908ce65814ab Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 14:10:55 +0100 Subject: [PATCH 21/30] Remove favor, link to api key page --- .../core/media/_base/providers/torrent/hdaccess.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/couchpotato/core/media/_base/providers/torrent/hdaccess.py b/couchpotato/core/media/_base/providers/torrent/hdaccess.py index 811c599..1a6b0ed 100644 --- a/couchpotato/core/media/_base/providers/torrent/hdaccess.py +++ b/couchpotato/core/media/_base/providers/torrent/hdaccess.py @@ -1,5 +1,4 @@ import re -import json import traceback from couchpotato.core.helpers.variable import tryInt, getIdentifier @@ -42,17 +41,6 @@ class Base(TorrentProvider): torrent_desc += '/ Internal' torrentscore += 200 - if resolution == '1080p': - torrentscore += 100 - if encoding == 'x264' and self.conf('favor') in ['encode', 'all']: - torrentscore += 100 - elif encoding == 'Encode' and self.conf('favor') in ['encode', 'all']: - torrentscore += 100 - elif encoding == 'Remux' and self.conf('favor') in ['remux', 'all']: - torrentscore += 200 - elif encoding == 'Bluray' and self.conf('favor') in ['bluray', 'all']: - torrentscore += 300 - if seeders == 0: torrentscore = 0 @@ -97,7 +85,7 @@ config = [{ 'name': 'apikey', 'default': '', 'label': 'API Key', - 'description': 'Enter your site api key. This can be find in \'Edit My Profile\'->Security', + 'description': 'Enter your site api key. This can be find on Profile Security', }, { 'name': 'seed_ratio', @@ -121,14 +109,6 @@ config = [{ 'description': 'Favors internal releases over non-internal releases.', }, { - 'name': 'favor', - 'advanced': True, - 'default': 'all', - 'type': 'dropdown', - 'values': [('Blurays & Encodes & Remuxes', 'all'), ('Blurays', 'bluray'), ('Encodes', 'encode'), ('Remuxes', 'remux'), ('None', 'none')], - 'description': 'Give extra scoring to blurays(+300), remuxes(+200) or encodes(+100).', - }, - { 'name': 'internal_only', 'advanced': True, 'label': 'Internal Only', From ce768f45c51267f48ba40202ec60cf36db4195cc Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 14:36:54 +0100 Subject: [PATCH 22/30] Make RottenTomato logging more clear close #4618 --- couchpotato/core/media/movie/providers/automation/rottentomatoes.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/media/movie/providers/automation/rottentomatoes.py b/couchpotato/core/media/movie/providers/automation/rottentomatoes.py index a01f76d..65d54f1 100644 --- a/couchpotato/core/media/movie/providers/automation/rottentomatoes.py +++ b/couchpotato/core/media/movie/providers/automation/rottentomatoes.py @@ -39,15 +39,14 @@ class Rottentomatoes(Automation, RSS): if result: - log.info2('Something smells...') rating = tryInt(self.getTextElement(movie, rating_tag)) name = result.group(0) + print rating, tryInt(self.conf('tomatometer_percent')) if rating < tryInt(self.conf('tomatometer_percent')): log.info2('%s seems to be rotten...', name) else: - - log.info2('Found %s fresh enough movies, enqueuing: %s', (rating, name)) + log.info2('Found %s with fresh rating %s', (name, rating)) year = datetime.datetime.now().strftime("%Y") imdb = self.search(name, year) From 6dcb3f3bf20fa05cfdeec53b7c44913423a90ce5 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 14:55:22 +0100 Subject: [PATCH 23/30] Change bitsoup category id fixes #4629 --- couchpotato/core/media/movie/providers/torrent/bitsoup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/movie/providers/torrent/bitsoup.py b/couchpotato/core/media/movie/providers/torrent/bitsoup.py index e9d69fe..b0c8ede 100644 --- a/couchpotato/core/media/movie/providers/torrent/bitsoup.py +++ b/couchpotato/core/media/movie/providers/torrent/bitsoup.py @@ -11,7 +11,7 @@ autoload = 'Bitsoup' class Bitsoup(MovieProvider, Base): cat_ids = [ ([17], ['3d']), - ([41], ['720p', '1080p']), + ([80], ['720p', '1080p']), ([20], ['dvdr']), ([19], ['brrip', 'dvdrip']), ] From 11b9bc39abac6e47f6565814954d060e0291bf2b Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 15:40:55 +0100 Subject: [PATCH 24/30] Show tried to often error for TD --- couchpotato/core/media/_base/providers/torrent/torrentday.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/couchpotato/core/media/_base/providers/torrent/torrentday.py b/couchpotato/core/media/_base/providers/torrent/torrentday.py index 57224ff..7301433 100644 --- a/couchpotato/core/media/_base/providers/torrent/torrentday.py +++ b/couchpotato/core/media/_base/providers/torrent/torrentday.py @@ -1,3 +1,4 @@ +import re from couchpotato.core.helpers.variable import tryInt from couchpotato.core.logger import CPLog from couchpotato.core.media._base.providers.torrent.base import TorrentProvider @@ -55,6 +56,10 @@ class Base(TorrentProvider): } def loginSuccess(self, output): + often = re.search('You tried too often, please wait .*', output) + if often: + raise Exception(often.group(0)[:-6].strip()) + return 'Password not correct' not in output def loginCheckSuccess(self, output): From b1fc8ad86252ec525ac85df53c3b2f73358d5ece Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 16:21:32 +0100 Subject: [PATCH 25/30] Letterboxed new html markup fix #4640 --- couchpotato/core/media/movie/providers/automation/letterboxd.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/couchpotato/core/media/movie/providers/automation/letterboxd.py b/couchpotato/core/media/movie/providers/automation/letterboxd.py index e9fc874..d43821c 100644 --- a/couchpotato/core/media/movie/providers/automation/letterboxd.py +++ b/couchpotato/core/media/movie/providers/automation/letterboxd.py @@ -48,11 +48,12 @@ class Letterboxd(Automation): soup = BeautifulSoup(self.getHTMLData(self.url % username)) - for movie in soup.find_all('a', attrs = {'class': 'frame'}): - match = removeEmpty(self.pattern.split(movie['title'])) + for movie in soup.find_all('li', attrs = {'class': 'poster-container'}): + img = movie.find('img', movie) + title = img.get('alt') + movies.append({ - 'title': match[0], - 'year': match[1] + 'title': title }) return movies From 920d3cb44e528e8c8463531897790ae5bf51cd92 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 16:27:13 +0100 Subject: [PATCH 26/30] Don't verify SYNO downloader thingymajig fix #4641 --- couchpotato/core/downloaders/synology.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/downloaders/synology.py b/couchpotato/core/downloaders/synology.py index b5327cc..8368eb1 100644 --- a/couchpotato/core/downloaders/synology.py +++ b/couchpotato/core/downloaders/synology.py @@ -137,7 +137,7 @@ class SynologyRPC(object): def _req(self, url, args, files = None): response = {'success': False} try: - req = requests.post(url, data = args, files = files) + req = requests.post(url, data = args, files = files, verify = False) req.raise_for_status() response = json.loads(req.text) if response['success']: From afc9039625c3f85c0a12699e45acd19dd03fc67e Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 16:50:53 +0100 Subject: [PATCH 27/30] Also search lower qualities on OMGWTF fix #4527 --- couchpotato/core/media/_base/providers/nzb/omgwtfnzbs.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/couchpotato/core/media/_base/providers/nzb/omgwtfnzbs.py b/couchpotato/core/media/_base/providers/nzb/omgwtfnzbs.py index ea5f90f..3d002fb 100644 --- a/couchpotato/core/media/_base/providers/nzb/omgwtfnzbs.py +++ b/couchpotato/core/media/_base/providers/nzb/omgwtfnzbs.py @@ -18,20 +18,13 @@ class Base(NZBProvider, RSS): http_time_between_calls = 1 # Seconds cat_ids = [ - ([15], ['dvdrip']), + ([15], ['dvdrip', 'scr', 'r5', 'tc', 'ts', 'cam']), ([15, 16], ['brrip']), ([16], ['720p', '1080p', 'bd50']), ([17], ['dvdr']), ] cat_backup_id = 'movie' - def search(self, movie, quality): - - if quality['identifier'] in fireEvent('quality.pre_releases', single = True): - return [] - - return super(Base, self).search(movie, quality) - def _searchOnTitle(self, title, movie, quality, results): q = '%s %s' % (title, movie['info']['year']) From 9f77597c11ba5da93a35a49386c11e1deb3710a8 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 17:15:53 +0100 Subject: [PATCH 28/30] Torrentz search on title fix #4510 --- couchpotato/core/media/_base/providers/torrent/torrentz.py | 4 ++-- couchpotato/core/media/movie/providers/torrent/torrentz.py | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/couchpotato/core/media/_base/providers/torrent/torrentz.py b/couchpotato/core/media/_base/providers/torrent/torrentz.py index 8a5455c..a5c1ed0 100644 --- a/couchpotato/core/media/_base/providers/torrent/torrentz.py +++ b/couchpotato/core/media/_base/providers/torrent/torrentz.py @@ -22,12 +22,12 @@ class Base(TorrentMagnetProvider, RSS): http_time_between_calls = 0 - def _search(self, media, quality, results): + def _searchOnTitle(self, title, media, quality, results): search_url = self.urls['verified_search'] if self.conf('verified_only') else self.urls['search'] # Create search parameters - search_params = self.buildUrl(media) + search_params = self.buildUrl(title, media, quality) smin = quality.get('size_min') smax = quality.get('size_max') diff --git a/couchpotato/core/media/movie/providers/torrent/torrentz.py b/couchpotato/core/media/movie/providers/torrent/torrentz.py index 742554c..011ec43 100644 --- a/couchpotato/core/media/movie/providers/torrent/torrentz.py +++ b/couchpotato/core/media/movie/providers/torrent/torrentz.py @@ -1,6 +1,5 @@ from couchpotato.core.helpers.encoding import tryUrlencode from couchpotato.core.logger import CPLog -from couchpotato.core.event import fireEvent from couchpotato.core.media._base.providers.torrent.torrentz import Base from couchpotato.core.media.movie.providers.base import MovieProvider @@ -11,5 +10,5 @@ autoload = 'Torrentz' class Torrentz(MovieProvider, Base): - def buildUrl(self, media): - return tryUrlencode('"%s"' % fireEvent('library.query', media, single = True)) + def buildUrl(self, title, media, quality): + return tryUrlencode('"%s %s"' % (title, media['info']['year'])) \ No newline at end of file From debd1855ddeabe6dd75997b0cf9f345d7ad11735 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 20:47:19 +0100 Subject: [PATCH 29/30] Move Yify to v2 --- .../core/media/_base/providers/torrent/yify.py | 49 +++++++++++----------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/couchpotato/core/media/_base/providers/torrent/yify.py b/couchpotato/core/media/_base/providers/torrent/yify.py index 725aabb..b6b91e2 100644 --- a/couchpotato/core/media/_base/providers/torrent/yify.py +++ b/couchpotato/core/media/_base/providers/torrent/yify.py @@ -2,27 +2,25 @@ import traceback from couchpotato.core.helpers.variable import tryInt, getIdentifier from couchpotato.core.logger import CPLog -from couchpotato.core.media._base.providers.torrent.base import TorrentMagnetProvider +from couchpotato.core.media._base.providers.torrent.base import TorrentProvider log = CPLog(__name__) -class Base(TorrentMagnetProvider): +class Base(TorrentProvider): urls = { - 'test': '%s/api', - 'search': '%s/api/list.json?keywords=%s', - 'detail': '%s/api/movie.json?id=%s' + 'test': '%s/api/v2', + 'search': '%s/api/v2/list_movies.json?limit=50&query_term=%s' } http_time_between_calls = 1 # seconds proxy_list = [ 'https://yts.re', - 'http://ytsproxy.come.in', + 'https://yts.wf', 'http://yts.im', - 'http://yify-torrents.im', ] def search(self, movie, quality): @@ -41,25 +39,28 @@ class Base(TorrentMagnetProvider): search_url = self.urls['search'] % (domain, getIdentifier(movie)) data = self.getJsonData(search_url) + data = data.get('data') - if data and data.get('MovieList'): + if data and data.get('movies'): try: - for result in data.get('MovieList'): - - if result['Quality'] and result['Quality'] not in result['MovieTitle']: - title = result['MovieTitle'] + ' BrRip ' + result['Quality'] - else: - title = result['MovieTitle'] + ' BrRip' - - results.append({ - 'id': result['MovieID'], - 'name': title, - 'url': result['TorrentMagnetUrl'], - 'detail_url': self.urls['detail'] % (domain, result['MovieID']), - 'size': self.parseSize(result['Size']), - 'seeders': tryInt(result['TorrentSeeds']), - 'leechers': tryInt(result['TorrentPeers']), - }) + for result in data.get('movies'): + + for release in result.get('torrents', []): + + if release['quality'] and release['quality'] not in result['title_long']: + title = result['title_long'] + ' BRRip ' + release['quality'] + else: + title = result['title_long'] + ' BRRip' + + results.append({ + 'id': release['hash'], + 'name': title, + 'url': release['url'], + 'detail_url': result['url'], + 'size': self.parseSize(release['size']), + 'seeders': tryInt(release['seeds']), + 'leechers': tryInt(release['peers']), + }) except: log.error('Failed getting results from %s: %s', (self.getName(), traceback.format_exc())) From 94c3969f100c7470af467d3176b630af186345fb Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 10 Feb 2015 20:52:15 +0100 Subject: [PATCH 30/30] Use https for yify proxy --- couchpotato/core/media/_base/providers/torrent/yify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/providers/torrent/yify.py b/couchpotato/core/media/_base/providers/torrent/yify.py index b6b91e2..492eeb6 100644 --- a/couchpotato/core/media/_base/providers/torrent/yify.py +++ b/couchpotato/core/media/_base/providers/torrent/yify.py @@ -20,7 +20,7 @@ class Base(TorrentProvider): proxy_list = [ 'https://yts.re', 'https://yts.wf', - 'http://yts.im', + 'https://yts.im', ] def search(self, movie, quality):