если исключения - возвращаем False
parent
4ec38a5c13
commit
f8ac0c159d
166
addon.py
166
addon.py
|
@ -34,16 +34,19 @@ def root(plugin, content_type='video'):
|
|||
))
|
||||
@Route.register
|
||||
def search_history(plugin):
|
||||
@Route.register_delayed
|
||||
def set_view():
|
||||
xbmc.executebuiltin('Container.SetViewMode("51")')
|
||||
h_list = PersistentList('search_history')
|
||||
for i in h_list:
|
||||
item = Listitem.from_dict(search, i, params={'search_query': i})
|
||||
item.art.local_thumb('search.png')
|
||||
yield item
|
||||
else:
|
||||
yield None
|
||||
try:
|
||||
@Route.register_delayed
|
||||
def set_view():
|
||||
xbmc.executebuiltin('Container.SetViewMode("51")')
|
||||
h_list = PersistentList('search_history')
|
||||
for i in h_list:
|
||||
item = Listitem.from_dict(search, i, params={'search_query': i})
|
||||
item.art.local_thumb('search.png')
|
||||
yield item
|
||||
else:
|
||||
yield None
|
||||
except:
|
||||
yield False
|
||||
@Route.register
|
||||
def new_search(plugin):
|
||||
q = utils.keyboard('Поиск')
|
||||
|
@ -52,78 +55,87 @@ def new_search(plugin):
|
|||
return search(plugin, q)
|
||||
@Route.register
|
||||
def search(plugin, search_query, thumb=None):
|
||||
@Route.register_delayed
|
||||
def set_view():
|
||||
xbmc.executebuiltin('Container.SetViewMode("51")')
|
||||
with PersistentList('search_history') as h_list:
|
||||
if search_query in h_list:
|
||||
del h_list[h_list.index(search_query)]
|
||||
h_list.insert(0, search_query)
|
||||
progress = xbmcgui.DialogProgress()
|
||||
found_items = []
|
||||
progress.create(localize(33054))
|
||||
for p, se in zip(range(0, 100, 100 / len(search_engines)), search_engines):
|
||||
progress.update(p, line1=se.name)
|
||||
found_items.extend(se().search(search_query))
|
||||
res_items = []
|
||||
for i in sorted(found_items, key=lambda x: x.seeders, reverse=True):
|
||||
if '2160p' in i.title: hd = '[2160p/{}] '.format(i.size)
|
||||
elif '1080p' in i.title: hd = '[1080p/{}] '.format(i.size)
|
||||
elif '720p' in i.title: hd = '[720p/{}] '.format(i.size)
|
||||
else: hd = ''
|
||||
item = Listitem.from_dict(
|
||||
open_torrent,
|
||||
'{}{} {} ({}/{})'.format(hd, i.title, i.size, i.seeders, i.leachers),
|
||||
params={'url': i.url, 'cookies': i.cookies, 'referer': i.referer}
|
||||
)
|
||||
if thumb:
|
||||
item.art['thumb'] = thumb
|
||||
else:
|
||||
item.art.local_thumb(i.icon)
|
||||
res_items.append(item)
|
||||
progress.close()
|
||||
return res_items
|
||||
@Route.register
|
||||
def open_torrent(plugin, url='--back--', cookies={}, referer='', path=''):
|
||||
if url == '--back--':
|
||||
xbmc.executebuiltin('ActivateWindow("home")')
|
||||
yield False
|
||||
else:
|
||||
try:
|
||||
@Route.register_delayed
|
||||
def set_view():
|
||||
xbmc.executebuiltin('Container.SetViewMode("51")')
|
||||
tf = torrent_file_fetch(url, referer, cookies)
|
||||
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']))),
|
||||
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):
|
||||
item = Listitem.from_dict(open_torrent,
|
||||
d,
|
||||
params={'url': url, 'cookies': cookies, 'referer': referer, 'path': '{}/{}'.format(
|
||||
path, d
|
||||
) if path != '' else d}
|
||||
)
|
||||
item.art.local_thumb('folder.png')
|
||||
yield item
|
||||
for i in range(len(files)):
|
||||
f = files[i]
|
||||
p = f.name.decode('utf-8')[len(path):].lstrip('/').split('/')
|
||||
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}
|
||||
)
|
||||
item.art.local_thumb('video.png')
|
||||
yield item
|
||||
with PersistentList('search_history') as h_list:
|
||||
if search_query in h_list:
|
||||
del h_list[h_list.index(search_query)]
|
||||
h_list.insert(0, search_query)
|
||||
progress = xbmcgui.DialogProgress()
|
||||
found_items = []
|
||||
progress.create(localize(33054))
|
||||
for p, se in zip(range(0, 100, 100 / len(search_engines)), search_engines):
|
||||
progress.update(p, line1=se.name)
|
||||
found_items.extend(se().search(search_query))
|
||||
res_items = []
|
||||
for i in sorted(found_items, key=lambda x: x.seeders, reverse=True):
|
||||
if '2160p' in i.title: hd = '[2160p/{}] '.format(i.size)
|
||||
elif '1080p' in i.title: hd = '[1080p/{}] '.format(i.size)
|
||||
elif '720p' in i.title: hd = '[720p/{}] '.format(i.size)
|
||||
else: hd = ''
|
||||
item = Listitem.from_dict(
|
||||
open_torrent,
|
||||
'{}{} {} ({}/{})'.format(hd, i.title, i.size, i.seeders, i.leachers),
|
||||
params={'url': i.url, 'cookies': i.cookies, 'referer': i.referer}
|
||||
)
|
||||
if thumb:
|
||||
item.art['thumb'] = thumb
|
||||
else:
|
||||
item.art.local_thumb(i.icon)
|
||||
res_items.append(item)
|
||||
progress.close()
|
||||
return res_items
|
||||
except:
|
||||
return False
|
||||
@Route.register
|
||||
def open_torrent(plugin, url='--back--', cookies={}, referer='', path=''):
|
||||
try:
|
||||
if url == '--back--':
|
||||
xbmc.executebuiltin('ActivateWindow("home")')
|
||||
yield False
|
||||
else:
|
||||
yield None
|
||||
@Route.register_delayed
|
||||
def set_view():
|
||||
xbmc.executebuiltin('Container.SetViewMode("51")')
|
||||
tf = torrent_file_fetch(url, referer, cookies)
|
||||
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']))),
|
||||
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):
|
||||
item = Listitem.from_dict(open_torrent,
|
||||
d,
|
||||
params={'url': url, 'cookies': cookies, 'referer': referer, 'path': '{}/{}'.format(
|
||||
path, d
|
||||
) if path != '' else d}
|
||||
)
|
||||
item.art.local_thumb('folder.png')
|
||||
yield item
|
||||
for i in range(len(files)):
|
||||
f = files[i]
|
||||
p = f.name.decode('utf-8')[len(path):].lstrip('/').split('/')
|
||||
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}
|
||||
)
|
||||
item.art.local_thumb('video.png')
|
||||
yield item
|
||||
else:
|
||||
yield None
|
||||
except:
|
||||
yield False
|
||||
@Route.register
|
||||
def play_file(plugin, t_full_path, f_index):
|
||||
vl = VideoLoop(t_full_path)
|
||||
vl.start(f_index)
|
||||
return False
|
||||
try:
|
||||
vl = VideoLoop(t_full_path)
|
||||
vl.start(f_index)
|
||||
return False
|
||||
except:
|
||||
return False
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<addon id="plugin.video.torrenter3" name="Torrenter3" provider-name="inpos" version="3.0.3">
|
||||
<addon id="plugin.video.torrenter3" name="Torrenter3" provider-name="inpos" version="3.0.4">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="2.25.0"/>
|
||||
<import addon="script.module.pyrrent2http"/>
|
||||
|
|
Loading…
Reference in New Issue