From 318daaf0831bc3d4410626cf2b5945b6871b641f Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 9 Jul 2013 23:31:43 +0200 Subject: [PATCH] Cleanup BitSoup --- .../core/providers/torrent/bitsoup/__init__.py | 14 ++++++++++++++ .../core/providers/torrent/bitsoup/main.py | 16 ++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/couchpotato/core/providers/torrent/bitsoup/__init__.py b/couchpotato/core/providers/torrent/bitsoup/__init__.py index 097f3782..ac24e131 100644 --- a/couchpotato/core/providers/torrent/bitsoup/__init__.py +++ b/couchpotato/core/providers/torrent/bitsoup/__init__.py @@ -28,6 +28,20 @@ config = [{ '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, diff --git a/couchpotato/core/providers/torrent/bitsoup/main.py b/couchpotato/core/providers/torrent/bitsoup/main.py index 3239656b..539ba43d 100644 --- a/couchpotato/core/providers/torrent/bitsoup/main.py +++ b/couchpotato/core/providers/torrent/bitsoup/main.py @@ -22,7 +22,7 @@ class Bitsoup(TorrentProvider): def _searchOnTitle(self, title, movie, quality, results): - q = '"%s %s"' % (simplifyString(title), movie['library']['year']) + q = '"%s" %s' % (simplifyString(title), movie['library']['year']) arguments = tryUrlencode({ 'search': q, }) @@ -34,19 +34,19 @@ class Bitsoup(TorrentProvider): html = BeautifulSoup(data) try: - resultsTable = html.find_all('table')[8] - entries = resultsTable.find_all('tr') + result_table = html.find('table', attrs = {'class': 'koptekst'}) + entries = result_table.find_all('tr') for result in entries[1:]: - + all_cells = result.find_all('td') torrent = all_cells[1].find('a') download = all_cells[3].find('a') - + torrent_id = torrent['href'] torrent_id = torrent_id.replace('details.php?id=', '') torrent_id = torrent_id.replace('&hit=1', '') - + torrent_name = torrent.getText() torrent_size = self.parseSize(all_cells[7].getText()) @@ -54,7 +54,7 @@ class Bitsoup(TorrentProvider): torrent_leechers = tryInt(all_cells[10].getText()) torrent_url = self.urls['baseurl'] % download['href'] torrent_detail_url = self.urls['baseurl'] % torrent['href'] - + results.append({ 'id': torrent_id, 'name': torrent_name, @@ -79,6 +79,6 @@ class Bitsoup(TorrentProvider): def loginSuccess(self, output): return 'logout.php' in output.lower() - + loginCheckSuccess = loginSuccess