Исправлены проблемы определения размера и добавлена сортировка по сидам

master
Бородин Роман 2020-12-05 23:18:47 +03:00
parent 27ddd8a9ac
commit e5bd0ca668
3 changed files with 6 additions and 5 deletions

View File

@ -72,7 +72,7 @@ def search(plugin, search_query, thumb=None):
for p, se in zip(range(0, 100, 100 / len(search_in)), search_in): for p, se in zip(range(0, 100, 100 / len(search_in)), search_in):
progress.update(p, line1=se.name) progress.update(p, line1=se.name)
found_items.extend(se().search(search_query)) found_items.extend(se().search(search_query))
open('/tmp/t.t', 'w').write(repr(list(map(lambda x: x.url, found_items)))) #open('/tmp/t.t', 'w').write(repr(list(map(lambda x: x.url, found_items))))
res_items = [] res_items = []
for i in sorted(found_items, key=lambda x: x.seeders, reverse=True): for i in sorted(found_items, key=lambda x: x.seeders, reverse=True):
if '2160p' in i.title: hd = '[2160p/{}] '.format(i.size) if '2160p' in i.title: hd = '[2160p/{}] '.format(i.size)

View File

@ -6,7 +6,7 @@ from codequick.listing import local_image # @UnresolvedImport
class SearchEngine(Searcher): class SearchEngine(Searcher):
base_url = option['kinozal_url'] base_url = option['kinozal_url']
search_path = '/browse.php?s={}&g=0&c=0&v=0&d=0&w=0&t=1&f=0' search_path = '/browse.php?s={}&t=1'
name = 'Kinozal.tv' name = 'Kinozal.tv'
icon = 'searcher_kinozal.png' icon = 'searcher_kinozal.png'
enabled = option.get_boolean('kinozal_enable') # @UndefinedVariable enabled = option.get_boolean('kinozal_enable') # @UndefinedVariable
@ -27,9 +27,10 @@ class SearchEngine(Searcher):
title = link.text title = link.text
seeders = int(r.find('.//td[@class="sl_s"]').text.strip()) seeders = int(r.find('.//td[@class="sl_s"]').text.strip())
leachers = int(r.find('.//td[@class="sl_p"]').text.strip()) leachers = int(r.find('.//td[@class="sl_p"]').text.strip())
size = list(filter(lambda x: x.text.strip().endswith((u'ГБ', u'МБ')), size_l = list(filter(lambda x: x.text.strip().endswith((u'ГБ', u'МБ')),
r.findall('.//td[@class="s"]')) r.findall('.//td[@class="s"]'))
)[0].text.strip() )
size = size_l[0].text.strip() if len(size_l) else '0'
yield ResultItem(url, title, size, seeders, leachers, self.icon, self.cookies, self.base_url) yield ResultItem(url, title, size, seeders, leachers, self.icon, self.cookies, self.base_url)
def login(self): def login(self):
user = option['kinozal_login'] user = option['kinozal_login']

View File

@ -6,7 +6,7 @@ from codequick.listing import local_image # @UnresolvedImport
class SearchEngine(Searcher): class SearchEngine(Searcher):
base_url = option['rutracker_url'] base_url = option['rutracker_url']
search_path = '/forum/tracker.php?nm={}' search_path = '/forum/tracker.php?nm={}&o=10&s=2'
name = 'RuTracker.org' name = 'RuTracker.org'
icon = 'searcher_rutracker.png' icon = 'searcher_rutracker.png'
enabled = option.get_boolean('rutracker_enable') # @UndefinedVariable enabled = option.get_boolean('rutracker_enable') # @UndefinedVariable