1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-10 23:07:59 +00:00

Fix duplicate results in piratebay results

This commit is contained in:
Christophe Dumez 2013-01-19 23:27:51 +02:00
parent 0ace60a39b
commit b71570bdf7
2 changed files with 18 additions and 2 deletions

View File

@ -1,4 +1,4 @@
#VERSION: 1.51
#VERSION: 1.52
#AUTHORS: Fabien Devaux (fab@gnux.info)
#CONTRIBUTORS: Christophe Dumez (chris@qbittorrent.org)
@ -30,6 +30,8 @@ from novaprinter import prettyPrinter
import sgmllib
from helpers import retrieve_url, download_file
PREVIOUS_IDS = set()
class piratebay(object):
url = 'https://thepiratebay.se'
name = 'The Pirate Bay'
@ -59,6 +61,7 @@ class piratebay(object):
self.td_counter = 0
self.current_item['desc_link'] = self.url + params['href'].strip()
self.in_name = True
self.current_item['id'] = params['href'].split('/')[2]
elif params['href'].startswith('magnet:'):
self.current_item['link']=params['href'].strip()
self.in_name = False
@ -90,12 +93,17 @@ class piratebay(object):
self.td_counter = None
# Display item
if self.current_item:
if self.current_item['id'] in PREVIOUS_IDS:
self.results = []
self.reset()
return
self.current_item['engine_url'] = self.url
if not self.current_item['seeds'].isdigit():
self.current_item['seeds'] = 0
if not self.current_item['leech'].isdigit():
self.current_item['leech'] = 0
prettyPrinter(self.current_item)
PREVIOUS_IDS.add(self.current_item['id'])
self.results.append('a')
def search(self, what, cat='all'):
ret = []

View File

@ -1,4 +1,4 @@
#VERSION: 1.51
#VERSION: 1.52
#AUTHORS: Fabien Devaux (fab@gnux.info)
#CONTRIBUTORS: Christophe Dumez (chris@qbittorrent.org)
@ -30,6 +30,8 @@ from novaprinter import prettyPrinter
import sgmllib3
from helpers import retrieve_url, download_file
PREVIOUS_IDS = set()
class piratebay(object):
url = 'https://thepiratebay.se'
name = 'The Pirate Bay'
@ -59,6 +61,7 @@ class piratebay(object):
self.td_counter = 0
self.current_item['desc_link'] = self.url + params['href'].strip()
self.in_name = True
self.current_item['id'] = params['href'].split('/')[2]
elif params['href'].startswith('magnet:'):
self.current_item['link']=params['href'].strip()
self.in_name = False
@ -90,12 +93,17 @@ class piratebay(object):
self.td_counter = None
# Display item
if self.current_item:
if self.current_item['id'] in PREVIOUS_IDS:
self.results = []
self.reset()
return
self.current_item['engine_url'] = self.url
if not self.current_item['seeds'].isdigit():
self.current_item['seeds'] = 0
if not self.current_item['leech'].isdigit():
self.current_item['leech'] = 0
prettyPrinter(self.current_item)
PREVIOUS_IDS.add(self.current_item['id'])
self.results.append('a')
def search(self, what, cat='all'):
ret = []