API update
parent
3e935395dd
commit
e335f8e984
File diff suppressed because it is too large
Load Diff
121
Core.py
121
Core.py
|
@ -1640,7 +1640,11 @@ class Core:
|
||||||
filesList = sorted(filesList, key=lambda x: x[0], reverse=True)
|
filesList = sorted(filesList, key=lambda x: x[0], reverse=True)
|
||||||
elif int(self.__settings__.getSetting('sort_search'))==2:
|
elif int(self.__settings__.getSetting('sort_search'))==2:
|
||||||
filesList = sorted(filesList, key=lambda x: x[4], reverse=False)
|
filesList = sorted(filesList, key=lambda x: x[4], reverse=False)
|
||||||
|
|
||||||
|
if not external or get('from_searcher'):
|
||||||
self.showFilesList(filesList, params)
|
self.showFilesList(filesList, params)
|
||||||
|
else:
|
||||||
|
self.showFilesListExternal(filesList, params)
|
||||||
|
|
||||||
def controlCenter(self, params={}):
|
def controlCenter(self, params={}):
|
||||||
xbmc.executebuiltin(
|
xbmc.executebuiltin(
|
||||||
|
@ -1648,67 +1652,8 @@ class Core:
|
||||||
|
|
||||||
def showFilesList(self, filesList, params={}):
|
def showFilesList(self, filesList, params={}):
|
||||||
get = params.get
|
get = params.get
|
||||||
external = unquote(get("external"), None)
|
|
||||||
silent = get("silent")
|
|
||||||
thumbnail = unquote(get("thumbnail"),'')
|
thumbnail = unquote(get("thumbnail"),'')
|
||||||
save_folder = unquote(get("save_folder"),'')
|
save_folder = unquote(get("save_folder"),'')
|
||||||
back_url = unquote(get("back_url"),'')
|
|
||||||
return_url = unquote(get("return_url"),'')
|
|
||||||
return_name = unquote(get("return_name"),'')
|
|
||||||
sdata = unquote(get("sdata"),'{}')
|
|
||||||
log(str(filesList))
|
|
||||||
if external and not get('from_searcher'):
|
|
||||||
try:
|
|
||||||
#if 1==1:
|
|
||||||
sdata = json.loads(sdata)
|
|
||||||
if len(filesList) < 1:
|
|
||||||
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
|
|
||||||
if not silent:
|
|
||||||
xbmc.executebuiltin(
|
|
||||||
'XBMC.ActivateWindow(%s)' % 'Videos,%s' % return_url)
|
|
||||||
else:
|
|
||||||
showMessage(self.localize('Information'), self.localize('Torrent list is empty.'))
|
|
||||||
return
|
|
||||||
if silent:
|
|
||||||
order, seeds, leechers, size, title, link, image = filesList[0]
|
|
||||||
sdata['filename'] = link
|
|
||||||
xbmc.executebuiltin('XBMC.RunPlugin(%s)' % (
|
|
||||||
back_url+'silent&stringdata=' + urllib.quote_plus(
|
|
||||||
json.dumps(sdata))))
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
for (order, seeds, leechers, size, title, link, image) in filesList:
|
|
||||||
link_dict = {'url': link, 'thumbnail': thumbnail, 'save_folder':save_folder}
|
|
||||||
link_url=''
|
|
||||||
for key in link_dict.keys():
|
|
||||||
if link_dict.get(key):
|
|
||||||
link_url = '%s&%s=%s' % (link_url, key, urllib.quote_plus(link_dict.get(key)))
|
|
||||||
sdata['filename'] = link
|
|
||||||
contextMenu = [
|
|
||||||
#(self.localize('Add to MyShows.ru'),
|
|
||||||
# 'XBMC.RunPlugin(%s)' % (
|
|
||||||
# 'plugin://plugin.video.myshows/?mode=3010&sort=activate&stringdata=' + urllib.quote_plus(
|
|
||||||
# '{"filename":"%s", "stype":%s, "showId":%s, "seasonId":%s, "id":%s, "episodeId":%s}' % (
|
|
||||||
# link, jstr(sdata['stype']), jstr(sdata['showId']), jstr(sdata['seasonId']), jstr(sdata['id']),
|
|
||||||
# jstr(sdata['episodeId']))))),
|
|
||||||
(self.localize('Add to %s') % return_name,
|
|
||||||
'XBMC.RunPlugin(%s)' % (
|
|
||||||
back_url+'&stringdata=' + urllib.quote_plus(
|
|
||||||
json.dumps(sdata)))),
|
|
||||||
(self.localize('Open (no return)'),
|
|
||||||
'XBMC.ActivateWindow(Videos,%s)' % ('%s?action=%s%s') % (
|
|
||||||
sys.argv[0], 'openTorrent', link_url)),
|
|
||||||
(self.localize('Return to %s') % return_name,
|
|
||||||
'XBMC.ActivateWindow(%s)' % ('Videos,%s' % return_url)),
|
|
||||||
]
|
|
||||||
title = self.titleMake(seeds, leechers, size, title)
|
|
||||||
self.drawItem(title, 'context', link, image, contextMenu=contextMenu)
|
|
||||||
except:
|
|
||||||
#else:
|
|
||||||
showMessage(self.localize('Information'), self.localize('Torrent list is empty.'))
|
|
||||||
if get("sdata"): xbmc.executebuiltin('XBMC.RunPlugin(%s)' % 'plugin://plugin.video.myshows/?mode=3013')
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
for (order, seeds, leechers, size, title, link, image) in filesList:
|
for (order, seeds, leechers, size, title, link, image) in filesList:
|
||||||
link_dict = {'url': link, 'thumbnail': thumbnail, 'save_folder':save_folder}
|
link_dict = {'url': link, 'thumbnail': thumbnail, 'save_folder':save_folder}
|
||||||
link_url=''
|
link_url=''
|
||||||
|
@ -1728,8 +1673,6 @@ class Core:
|
||||||
]
|
]
|
||||||
title = self.titleMake(seeds, leechers, size, title)
|
title = self.titleMake(seeds, leechers, size, title)
|
||||||
|
|
||||||
#print image
|
|
||||||
|
|
||||||
if self.open_option==0:
|
if self.open_option==0:
|
||||||
self.drawItem(title, 'openTorrent', link_dict, image, contextMenu=contextMenu, replaceMenu=False)
|
self.drawItem(title, 'openTorrent', link_dict, image, contextMenu=contextMenu, replaceMenu=False)
|
||||||
elif self.open_option==1:
|
elif self.open_option==1:
|
||||||
|
@ -1742,6 +1685,62 @@ class Core:
|
||||||
view_style('showFilesList')
|
view_style('showFilesList')
|
||||||
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
|
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
|
||||||
|
|
||||||
|
def showFilesListExternal(self, filesList, params={}):
|
||||||
|
get = params.get
|
||||||
|
silent = get("silent")
|
||||||
|
thumbnail = unquote(get("thumbnail"),'')
|
||||||
|
save_folder = unquote(get("save_folder"),'')
|
||||||
|
back_url = unquote(get("back_url"),'')
|
||||||
|
return_url = unquote(get("return_url"),'')
|
||||||
|
return_name = unquote(get("return_name"),'')
|
||||||
|
sdata = unquote(get("sdata"),'{}')
|
||||||
|
|
||||||
|
try:
|
||||||
|
#if 1==1:
|
||||||
|
sdata = json.loads(sdata)
|
||||||
|
if len(filesList) < 1:
|
||||||
|
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
|
||||||
|
if not silent:
|
||||||
|
xbmc.executebuiltin(
|
||||||
|
'XBMC.ActivateWindow(%s)' % 'Videos,%s' % return_url)
|
||||||
|
else:
|
||||||
|
showMessage(self.localize('Information'), self.localize('Torrent list is empty.'))
|
||||||
|
return
|
||||||
|
if silent:
|
||||||
|
order, seeds, leechers, size, title, link, image = filesList[0]
|
||||||
|
sdata['filename'] = link
|
||||||
|
xbmc.executebuiltin('XBMC.RunPlugin(%s)' % (
|
||||||
|
back_url+'silent&stringdata=' + urllib.quote_plus(
|
||||||
|
json.dumps(sdata))))
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
for order, seeds, leechers, size, title, link, image in filesList:
|
||||||
|
link_dict = {'url': link, 'thumbnail': thumbnail, 'save_folder':save_folder}
|
||||||
|
link_url=''
|
||||||
|
for key in link_dict.keys():
|
||||||
|
if link_dict.get(key):
|
||||||
|
link_url = '%s&%s=%s' % (link_url, key, urllib.quote_plus(link_dict.get(key)))
|
||||||
|
sdata['filename'] = link
|
||||||
|
contextMenu = [
|
||||||
|
(self.localize('Add to %s') % return_name,
|
||||||
|
'XBMC.RunPlugin(%s)' % (back_url+'&stringdata=' + urllib.quote_plus(
|
||||||
|
json.dumps(sdata)))),
|
||||||
|
(self.localize('Open (no return)'),
|
||||||
|
'XBMC.ActivateWindow(Videos,%s)' % ('%s?action=%s%s') % (
|
||||||
|
sys.argv[0], 'openTorrent', link_url)),
|
||||||
|
(self.localize('Return to %s') % return_name,
|
||||||
|
'XBMC.ActivateWindow(%s)' % ('Videos,%s' % return_url)),
|
||||||
|
]
|
||||||
|
title = self.titleMake(seeds, leechers, size, title)
|
||||||
|
self.drawItem(title, 'context', link, image, contextMenu=contextMenu)
|
||||||
|
except:
|
||||||
|
showMessage(self.localize('Information'), self.localize('Torrent list is empty.'))
|
||||||
|
if not silent: xbmc.executebuiltin('XBMC.RunPlugin(%s)' % return_url)
|
||||||
|
return
|
||||||
|
|
||||||
|
view_style('showFilesList')
|
||||||
|
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
|
||||||
|
|
||||||
def context(self, params={}):
|
def context(self, params={}):
|
||||||
xbmc.executebuiltin("Action(ContextMenu)")
|
xbmc.executebuiltin("Action(ContextMenu)")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue