From dacc3d8f470e7cc4c294bab86bd7d9b6afe4d947 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 19 Oct 2014 22:47:29 +0200 Subject: [PATCH 1/2] Remove torrentleech --- .../media/_base/providers/torrent/torrentleech.py | 126 --------------------- .../media/movie/providers/torrent/torrentleech.py | 27 ----- 2 files changed, 153 deletions(-) delete mode 100644 couchpotato/core/media/_base/providers/torrent/torrentleech.py delete mode 100644 couchpotato/core/media/movie/providers/torrent/torrentleech.py diff --git a/couchpotato/core/media/_base/providers/torrent/torrentleech.py b/couchpotato/core/media/_base/providers/torrent/torrentleech.py deleted file mode 100644 index 83eb5f1..0000000 --- a/couchpotato/core/media/_base/providers/torrent/torrentleech.py +++ /dev/null @@ -1,126 +0,0 @@ -import traceback - -from bs4 import BeautifulSoup -from couchpotato.core.helpers.variable import tryInt -from couchpotato.core.logger import CPLog -from couchpotato.core.media._base.providers.torrent.base import TorrentProvider -import six - - -log = CPLog(__name__) - - -class Base(TorrentProvider): - - urls = { - 'test': 'https://www.torrentleech.org/', - 'login': 'https://www.torrentleech.org/user/account/login/', - 'login_check': 'https://torrentleech.org/user/messages', - 'detail': 'https://www.torrentleech.org/torrent/%s', - 'search': 'https://www.torrentleech.org/torrents/browse/index/query/%s/categories/%d', - 'download': 'https://www.torrentleech.org%s', - } - - http_time_between_calls = 1 # Seconds - cat_backup_id = None - - def _searchOnTitle(self, title, media, quality, results): - - url = self.urls['search'] % self.buildUrl(title, media, quality) - - data = self.getHTMLData(url) - - if data: - html = BeautifulSoup(data) - - try: - result_table = html.find('table', attrs = {'id': 'torrenttable'}) - if not result_table: - return - - entries = result_table.find_all('tr') - - for result in entries[1:]: - - link = result.find('td', attrs = {'class': 'name'}).find('a') - url = result.find('td', attrs = {'class': 'quickdownload'}).find('a') - details = result.find('td', attrs = {'class': 'name'}).find('a') - - results.append({ - 'id': link['href'].replace('/torrent/', ''), - 'name': six.text_type(link.string), - 'url': self.urls['download'] % url['href'], - 'detail_url': self.urls['download'] % details['href'], - 'size': self.parseSize(result.find_all('td')[4].string), - 'seeders': tryInt(result.find('td', attrs = {'class': 'seeders'}).string), - 'leechers': tryInt(result.find('td', attrs = {'class': 'leechers'}).string), - }) - - except: - log.error('Failed to parsing %s: %s', (self.getName(), traceback.format_exc())) - - def getLoginParams(self): - return { - 'username': self.conf('username'), - 'password': self.conf('password'), - 'remember_me': 'on', - 'login': 'submit', - } - - def loginSuccess(self, output): - return '/user/account/logout' in output.lower() or 'welcome back' in output.lower() - - loginCheckSuccess = loginSuccess - - -config = [{ - 'name': 'torrentleech', - 'groups': [ - { - 'tab': 'searcher', - 'list': 'torrent_providers', - 'name': 'TorrentLeech', - 'description': 'TorrentLeech', - 'wizard': True, - 'icon': 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAACHUlEQVR4AZVSO48SYRSdGTCBEMKzILLAWiybkKAGMZRUUJEoDZX7B9zsbuQPYEEjNLTQkYgJDwsoSaxspEBsCITXjjNAIKi8AkzceXgmbHQ1NJ5iMufmO9/9zrmXlCSJ+B8o75J8Pp/NZj0eTzweBy0Wi4PBYD6f12o1r9ebTCZx+22HcrnMsuxms7m6urTZ7LPZDMVYLBZ8ZV3yo8aq9Pq0wzCMTqe77dDv9y8uLyAWBH6xWOyL0K/56fcb+rrPgPZ6PZfLRe1fsl6vCUmGKIqoqNXqdDr9Dbjps9znUV0uTqdTjuPkDoVCIfcuJ4gizjMMm8u9vW+1nr04czqdK56c37CbKY9j2+1WEARZ0Gq1RFHAz2q1qlQqXxoN69HRcDjUarW8ZD6QUigUOnY8uKYH8N1sNkul9yiGw+F6vS4Rxn8EsodEIqHRaOSnq9T7ajQazWQycEIR1AEBYDabSZJyHDucJyegwWBQr9ebTCaKvHd4cCQANUU9evwQ1Ofz4YvUKUI43GE8HouSiFiNRhOowWBIpVLyHITJkuW3PwgAEf3pgIwxF5r+OplMEsk3CPT5szCMnY7EwUdhwUh/CXiej0Qi3idPz89fdrpdbsfBzH7S3Q9K5pP4c0sAKpVKoVAQGO1ut+t0OoFAQHkH2Da/3/+but3uarWK0ZMQoNdyucRutdttmqZxMTzY7XaYxsrgtUjEZrNhkSwWyy/0NCatZumrNQAAAABJRU5ErkJggg==', - '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': 20, - 'description': 'Starting score for each release found via this provider.', - } - ], - }, - ], -}] diff --git a/couchpotato/core/media/movie/providers/torrent/torrentleech.py b/couchpotato/core/media/movie/providers/torrent/torrentleech.py deleted file mode 100644 index d72f425..0000000 --- a/couchpotato/core/media/movie/providers/torrent/torrentleech.py +++ /dev/null @@ -1,27 +0,0 @@ -from couchpotato.core.helpers.encoding import tryUrlencode -from couchpotato.core.logger import CPLog -from couchpotato.core.media._base.providers.torrent.torrentleech import Base -from couchpotato.core.media.movie.providers.base import MovieProvider - -log = CPLog(__name__) - -autoload = 'TorrentLeech' - - -class TorrentLeech(MovieProvider, Base): - - cat_ids = [ - ([13], ['720p', '1080p', 'bd50']), - ([8], ['cam']), - ([9], ['ts', 'tc']), - ([10], ['r5', 'scr']), - ([11], ['dvdrip']), - ([14], ['brrip']), - ([12], ['dvdr']), - ] - - def buildUrl(self, title, media, quality): - return ( - tryUrlencode(title.replace(':', '')), - self.getCatId(quality)[0] - ) From 02b665923535a1cc59d05c5840f6a6231d9e5213 Mon Sep 17 00:00:00 2001 From: Ruud Date: Mon, 20 Oct 2014 20:46:07 +0200 Subject: [PATCH 2/2] Don't show ignored in ETA message --- couchpotato/core/media/movie/searcher.py | 19 +++++++++---------- couchpotato/core/plugins/release/main.py | 4 +++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/couchpotato/core/media/movie/searcher.py b/couchpotato/core/media/movie/searcher.py index 3c26386..11aa975 100755 --- a/couchpotato/core/media/movie/searcher.py +++ b/couchpotato/core/media/movie/searcher.py @@ -203,13 +203,6 @@ class MovieSearcher(SearcherBase, MovieTypeBase): quality['custom'] = quality_custom results = fireEvent('searcher.search', search_protocols, movie, quality, single = True) or [] - results_count = len(results) - total_result_count += results_count - if results_count == 0: - log.debug('Nothing found for %s in %s', (default_title, quality['label'])) - - # Keep track of releases found outside ETA window - outside_eta_results += results_count if could_not_be_released else 0 # Check if movie isn't deleted while searching if not fireEvent('media.get', movie.get('_id'), single = True): @@ -217,11 +210,17 @@ class MovieSearcher(SearcherBase, MovieTypeBase): # Add them to this movie releases list found_releases += fireEvent('release.create_from_search', results, movie, quality, single = True) + results_count = len(found_releases) + total_result_count += results_count + if results_count == 0: + log.debug('Nothing found for %s in %s', (default_title, quality['label'])) + + # Keep track of releases found outside ETA window + outside_eta_results += results_count if could_not_be_released else 0 # Don't trigger download, but notify user of available releases - if could_not_be_released: - if results_count > 0: - log.debug('Found %s releases for "%s", but ETA isn\'t correct yet.', (results_count, default_title)) + if could_not_be_released and results_count > 0: + log.debug('Found %s releases for "%s", but ETA isn\'t correct yet.', (results_count, default_title)) # Try find a valid result and download it if (force_download or not could_not_be_released or always_search) and fireEvent('release.try_download_result', results, movie, quality_custom, single = True): diff --git a/couchpotato/core/plugins/release/main.py b/couchpotato/core/plugins/release/main.py index 375547c..a241c34 100644 --- a/couchpotato/core/plugins/release/main.py +++ b/couchpotato/core/plugins/release/main.py @@ -441,7 +441,6 @@ class Release(Plugin): for rel in search_results: rel_identifier = md5(rel['url']) - found_releases.append(rel_identifier) release = { '_t': 'release', @@ -482,6 +481,9 @@ class Release(Plugin): # Update release in search_results rel['status'] = rls.get('status') + if rel['status'] == 'available': + found_releases.append(rel_identifier) + return found_releases except: log.error('Failed: %s', traceback.format_exc())