Неверно отображался размер в kinozal и неверно выбирался индекс файла

master
Роман Бородин 2019-05-22 12:22:03 +03:00
parent 1e0556a525
commit c45f4bdd3d
3 changed files with 21 additions and 5 deletions

17
.project 100644
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>plugin.video.torrenter3</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>

View File

@ -105,7 +105,8 @@ def open_torrent(plugin, url='--back--', cookies={}, referer='', path=''):
if not tf: yield False
t_full_path = store_torrent_file(tf)
e = get_engine(t_full_path)
files = sorted(list(filter(lambda x: x.name.decode('utf-8').startswith(path) and x.name.decode('utf-8').lower().endswith(video_extensions), e.list_from_info(media_types=['video']))),
files = sorted(list(filter(
lambda x: x.name.decode('utf-8').startswith(path) and x.name.decode('utf-8').lower().endswith(video_extensions), e.list_from_info(media_types=['video']))),
key=lambda x: x.name)
dirs = list(set(list(map( lambda x: x.name.decode('utf-8')[len(path):].lstrip('/').split('/')[0], filter( lambda x: len(x.name.decode('utf-8')[len(path):].lstrip('/').split('/')) > 1, files ) ))))
for d in sorted(dirs):
@ -123,7 +124,7 @@ def open_torrent(plugin, url='--back--', cookies={}, referer='', path=''):
if len(p) == 1:
item = Listitem.from_dict(play_file,
'{} ({:.3f} GB)'.format(p[0], f.size / 1024.0 / 1024.0 /1024.0),
params={'t_full_path': t_full_path, 'f_index': i}
params={'t_full_path': t_full_path, 'f_index': f.index}
)
item.art.local_thumb('video.png')
yield item

View File

@ -27,11 +27,9 @@ class SearchEngine(Searcher):
title = link.text
seeders = int(r.find('.//td[@class="sl_s"]').text.strip())
leachers = int(r.find('.//td[@class="sl_p"]').text.strip())
size = list(
list(filter(lambda x: x.text.strip().endswith((u'ГБ', u'МБ')),
size = list(filter(lambda x: x.text.strip().endswith((u'ГБ', u'МБ')),
r.findall('.//td[@class="s"]'))
)[0].text.strip()
)[0].strip()
yield ResultItem(url, title, size, seeders, leachers, self.icon, self.cookies, self.base_url)
def login(self):
user = option['kinozal_login']