From 7277ef3bd8fad9a2563b4407b25479f1be0f22d7 Mon Sep 17 00:00:00 2001 From: Ruud Date: Mon, 14 Oct 2013 21:07:37 +0200 Subject: [PATCH 1/2] Remove SceneHD as we can't login with captcha. fix #2146 --- .../providers/torrent/scenehd/__init__.py | 55 ------------- .../core/providers/torrent/scenehd/main.py | 79 ------------------- 2 files changed, 134 deletions(-) delete mode 100644 couchpotato/core/providers/torrent/scenehd/__init__.py delete mode 100644 couchpotato/core/providers/torrent/scenehd/main.py diff --git a/couchpotato/core/providers/torrent/scenehd/__init__.py b/couchpotato/core/providers/torrent/scenehd/__init__.py deleted file mode 100644 index c0a82ae7..00000000 --- a/couchpotato/core/providers/torrent/scenehd/__init__.py +++ /dev/null @@ -1,55 +0,0 @@ -from .main import SceneHD - -def start(): - return SceneHD() - -config = [{ - 'name': 'scenehd', - 'groups': [ - { - 'tab': 'searcher', - 'list': 'torrent_providers', - 'name': 'SceneHD', - 'description': 'See SceneHD', - 'wizard': True, - 'options': [ - { - 'name': 'enabled', - 'type': 'enabler', - 'default': False, - }, - { - 'name': 'username', - 'default': '', - }, - { - 'name': 'password', - 'default': '', - 'type': 'password', - }, - { - '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': '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/providers/torrent/scenehd/main.py b/couchpotato/core/providers/torrent/scenehd/main.py deleted file mode 100644 index 2b76e43d..00000000 --- a/couchpotato/core/providers/torrent/scenehd/main.py +++ /dev/null @@ -1,79 +0,0 @@ -from bs4 import BeautifulSoup -from couchpotato.core.helpers.encoding import simplifyString, tryUrlencode -from couchpotato.core.helpers.variable import tryInt -from couchpotato.core.logger import CPLog -from couchpotato.core.providers.torrent.base import TorrentProvider -import traceback - -log = CPLog(__name__) - - -class SceneHD(TorrentProvider): - - urls = { - 'test': 'https://scenehd.org/', - 'login' : 'https://scenehd.org/takelogin.php', - 'login_check': 'https://scenehd.org/my.php', - 'detail': 'https://scenehd.org/details.php?id=%s', - 'search': 'https://scenehd.org/browse.php?ajax', - 'download': 'https://scenehd.org/download.php?id=%s', - } - - http_time_between_calls = 1 #seconds - - def _searchOnTitle(self, title, movie, quality, results): - - q = '"%s %s"' % (simplifyString(title), movie['library']['year']) - arguments = tryUrlencode({ - 'search': q, - }) - url = "%s&%s" % (self.urls['search'], arguments) - - data = self.getHTMLData(url, opener = self.login_opener) - - if data: - html = BeautifulSoup(data) - - try: - resultsTable = html.find_all('table')[6] - entries = resultsTable.find_all('tr') - for result in entries[1:]: - - all_cells = result.find_all('td') - - detail_link = all_cells[2].find('a') - details = detail_link['href'] - torrent_id = details.replace('details.php?id=', '') - - leechers = all_cells[11].find('a') - if leechers: - leechers = leechers.string - else: - leechers = all_cells[11].string - - results.append({ - 'id': torrent_id, - 'name': detail_link['title'], - 'size': self.parseSize(all_cells[7].string), - 'seeders': tryInt(all_cells[10].find('a').string), - 'leechers': tryInt(leechers), - 'url': self.urls['download'] % torrent_id, - 'description': all_cells[1].find('a')['href'], - }) - - except: - log.error('Failed getting results from %s: %s', (self.getName(), traceback.format_exc())) - - - def getLoginParams(self): - return tryUrlencode({ - 'username': self.conf('username'), - 'password': self.conf('password'), - 'ssl': 'yes', - }) - - def loginSuccess(self, output): - return 'logout.php' in output.lower() - - loginCheckSuccess = loginSuccess - From 0e18dcb8a1a7f7f2175dda15f39ebeb2fe11f5eb Mon Sep 17 00:00:00 2001 From: Ruud Date: Mon, 14 Oct 2013 21:13:31 +0200 Subject: [PATCH 2/2] Use success when adding movies --- couchpotato/core/media/movie/_base/static/search.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/movie/_base/static/search.js b/couchpotato/core/media/movie/_base/static/search.js index bb6f8ad2..e04167f0 100644 --- a/couchpotato/core/media/movie/_base/static/search.js +++ b/couchpotato/core/media/movie/_base/static/search.js @@ -107,7 +107,7 @@ Block.Search.MovieItem = new Class({ self.options_el.empty(); self.options_el.adopt( new Element('div.message', { - 'text': json.added ? 'Movie successfully added.' : 'Movie didn\'t add properly. Check logs' + 'text': json.success ? 'Movie successfully added.' : 'Movie didn\'t add properly. Check logs' }) ); self.mask.fade('out');