commit
0c7ce49659
4
Core.py
4
Core.py
|
@ -1607,8 +1607,8 @@ class Core:
|
||||||
'xbmc.RunScript(%s,)' % os.path.join(ROOT, 'controlcenter.py'))
|
'xbmc.RunScript(%s,)' % os.path.join(ROOT, 'controlcenter.py'))
|
||||||
|
|
||||||
def searchWindow(self, params={}):
|
def searchWindow(self, params={}):
|
||||||
xbmc.executebuiltin(
|
import searchwindow
|
||||||
'xbmc.RunScript(%s,)' % os.path.join(ROOT, 'searchwindow.py'))
|
searchwindow.main(params)
|
||||||
|
|
||||||
def showFilesList(self, filesList, params={}):
|
def showFilesList(self, filesList, params={}):
|
||||||
get = params.get
|
get = params.get
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -22,7 +22,7 @@ import sys, os, urllib, json
|
||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
import xbmc
|
import xbmc
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
from functions import get_filesList, HistoryDB, get_contentList, log, cutFolder, get_ids_video, showMessage, getParameters
|
from functions import get_filesList, HistoryDB, get_contentList, log, cutFolder, get_ids_video, showMessage, getParameters, unquote
|
||||||
import pyxbmct.addonwindow as pyxbmct
|
import pyxbmct.addonwindow as pyxbmct
|
||||||
import Localization
|
import Localization
|
||||||
import re
|
import re
|
||||||
|
@ -54,18 +54,21 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
|
||||||
last_top_button = None
|
last_top_button = None
|
||||||
last_right_button = None
|
last_right_button = None
|
||||||
|
|
||||||
def __init__(self, title=""):
|
def __init__(self, title="", s_param={}):
|
||||||
super(SearchWindow, self).__init__(title)
|
super(SearchWindow, self).__init__(title)
|
||||||
self.setGeometry(1280, 720, 9, 16)
|
self.setGeometry(1280, 720, 9, 16)
|
||||||
self.set_controls()
|
self.set_controls()
|
||||||
self.connect_controls()
|
self.connect_controls()
|
||||||
#self.set_navigation()
|
if s_param:
|
||||||
self.history()
|
self.search(s_param=s_param)
|
||||||
|
else:
|
||||||
|
self.history()
|
||||||
|
|
||||||
def icon(self, icon):
|
def icon(self, icon):
|
||||||
return '%s/icons/%s.png' %(__root__, icon)
|
return '%s/icons/%s.png' %(__root__, icon)
|
||||||
|
|
||||||
def set_controls(self):
|
def set_controls(self):
|
||||||
|
self.background.setImage('%s/icons/%s.png' %(__root__, 'ContentPanel'))
|
||||||
self.input_search = pyxbmct.Edit("", _alignment=pyxbmct.ALIGN_CENTER_X | pyxbmct.ALIGN_CENTER_Y)
|
self.input_search = pyxbmct.Edit("", _alignment=pyxbmct.ALIGN_CENTER_X | pyxbmct.ALIGN_CENTER_Y)
|
||||||
self.placeControl(self.input_search, 0, 0, 1, 5)
|
self.placeControl(self.input_search, 0, 0, 1, 5)
|
||||||
self.button_search = pyxbmct.Button("Search")
|
self.button_search = pyxbmct.Button("Search")
|
||||||
|
@ -114,11 +117,31 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
|
||||||
control.setAnimations([('WindowOpen', 'effect=fade start=0 end=100 time=500',),
|
control.setAnimations([('WindowOpen', 'effect=fade start=0 end=100 time=500',),
|
||||||
('WindowClose', 'effect=fade start=100 end=0 time=500',)])
|
('WindowClose', 'effect=fade start=100 end=0 time=500',)])
|
||||||
|
|
||||||
def search(self, addtime=None):
|
def search(self, addtime=None, s_param={}):
|
||||||
self.reconnect(pyxbmct.ACTION_NAV_BACK, self.history)
|
self.reconnect(pyxbmct.ACTION_NAV_BACK, self.history)
|
||||||
self.right_menu('search')
|
self.right_menu('search')
|
||||||
self.listing.reset()
|
self.listing.reset()
|
||||||
query = self.input_search.getText()
|
if s_param:
|
||||||
|
if s_param.get('url'):
|
||||||
|
search = urllib.unquote_plus(s_param.get('url'))
|
||||||
|
external = s_param.get("return_name")
|
||||||
|
if external:
|
||||||
|
searcher = 'landing from : %s ' % str(external)
|
||||||
|
else:
|
||||||
|
searcher = ''
|
||||||
|
self.setWindowTitle(title='%s %s' % ('Torrenter Search Window', searcher))
|
||||||
|
if s_param.get('showKey') == 'true':
|
||||||
|
self.input_search.setText(search)
|
||||||
|
query = self.input_search.getText()
|
||||||
|
else:
|
||||||
|
self.input_search.setText(search)
|
||||||
|
query = search
|
||||||
|
#self.setFocus(self.listing)
|
||||||
|
else:
|
||||||
|
query = self.input_search.getText()
|
||||||
|
self.history()
|
||||||
|
else:
|
||||||
|
query = self.input_search.getText()
|
||||||
log('Search query: '+str(query))
|
log('Search query: '+str(query))
|
||||||
|
|
||||||
#cache
|
#cache
|
||||||
|
@ -126,16 +149,19 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
|
||||||
self.filesList = get_filesList(query, addtime)
|
self.filesList = get_filesList(query, addtime)
|
||||||
self.last_query = query
|
self.last_query = query
|
||||||
elif len(query)==0:
|
elif len(query)==0:
|
||||||
self.filesList = [(1919, 1919, 52, u'102.66 MiB', u'South.Park.S20E06.HDTV.x264-FUM[ettv]',
|
self.filesList = []
|
||||||
u'ThePirateBay::magnet:?xt=urn:btih:0792ea51bc16a19893871197fa927ecec7ca25aa&dn=South.Park.S20E06.HDTV.x264-FUM%5Bettv%5D&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
|
#self.filesList = [(1919, 1919, 52, u'102.66 MiB', u'South.Park.S20E06.HDTV.x264-FUM[ettv]',
|
||||||
'C:\\Users\\Admin\\AppData\\Roaming\\Kodi\\addons\\torrenter.searcher.ThePirateBay\\icon.png'),
|
#u'ThePirateBay::magnet:?xt=urn:btih:0792ea51bc16a19893871197fa927ecec7ca25aa&dn=South.Park.S20E06.HDTV.x264-FUM%5Bettv%5D&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
|
||||||
(1919, 1919, 52, u'102.66 MiB', u'Haruhi',
|
#'C:\\Users\\Admin\\AppData\\Roaming\\Kodi\\addons\\torrenter.searcher.ThePirateBay\\icon.png'),
|
||||||
u'D:\\htest.torrent',
|
#(1919, 1919, 52, u'102.66 MiB', u'Haruhi',
|
||||||
'C:\\Users\\Admin\\AppData\\Roaming\\Kodi\\addons\\torrenter.searcher.ThePirateBay\\icon.png') ]
|
# u'D:\\htest.torrent',
|
||||||
|
# 'C:\\Users\\Admin\\AppData\\Roaming\\Kodi\\addons\\torrenter.searcher.ThePirateBay\\icon.png') ]
|
||||||
if 1==1:
|
if 1==1:
|
||||||
for (order, seeds, leechers, size, title, link, image) in self.filesList:
|
if self.filesList:
|
||||||
title = titleMake(seeds, leechers, size, title)
|
for (order, seeds, leechers, size, title, link, image) in self.filesList:
|
||||||
self.drawItem(title, {'mode':'search_item', 'filename': link}, image)
|
title = titleMake(seeds, leechers, size, title)
|
||||||
|
self.drawItem(title, {'mode':'search_item', 'filename': link}, image)
|
||||||
|
self.setFocus(self.listing)
|
||||||
|
|
||||||
def history(self):
|
def history(self):
|
||||||
self.right_menu('history')
|
self.right_menu('history')
|
||||||
|
@ -341,11 +367,8 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
|
||||||
url = self.form_link(action, link)
|
url = self.form_link(action, link)
|
||||||
xbmc.executebuiltin('xbmc.RunPlugin("%s")' % (url))
|
xbmc.executebuiltin('xbmc.RunPlugin("%s")' % (url))
|
||||||
elif mode == 'history_search_item':
|
elif mode == 'history_search_item':
|
||||||
addtime = params.get('addtime')
|
params['title'] = params.get('filename')
|
||||||
url = (os.path.join(__root__, 'controlcenter.py,') +
|
self.controlCenter(params)
|
||||||
'addtime=%s&title=%s' % (str(addtime), urllib.quote_plus(filename)))
|
|
||||||
log(url)
|
|
||||||
xbmc.executebuiltin('xbmc.RunScript(%s)' % (url))
|
|
||||||
|
|
||||||
def right_press4(self):
|
def right_press4(self):
|
||||||
item = self.listing.getSelectedItem()
|
item = self.listing.getSelectedItem()
|
||||||
|
@ -405,9 +428,9 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
|
||||||
|
|
||||||
return url
|
return url
|
||||||
|
|
||||||
def controlCenter(self):
|
def controlCenter(self, params={}):
|
||||||
xbmc.executebuiltin(
|
import controlcenter
|
||||||
'xbmc.RunScript(%s,)' % os.path.join(__root__, 'controlcenter.py'))
|
controlcenter.main(params)
|
||||||
|
|
||||||
def reconnect(self, event, callable):
|
def reconnect(self, event, callable):
|
||||||
self.disconnect(event)
|
self.disconnect(event)
|
||||||
|
@ -492,19 +515,14 @@ def titleMake(seeds, leechers, size, title):
|
||||||
return title
|
return title
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main(params={}):
|
||||||
dialog = SearchWindow("Torrenter Search Window")
|
dialog = SearchWindow("Torrenter Search Window", params)
|
||||||
dialog.doModal()
|
dialog.doModal()
|
||||||
del dialog #You need to delete your instance when it is no longer needed
|
del dialog #You need to delete your instance when it is no longer needed
|
||||||
#because underlying xbmcgui classes are not grabage-collected.
|
#because underlying xbmcgui classes are not grabage-collected.
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) > 1:
|
|
||||||
params = getParameters(sys.argv[1])
|
|
||||||
else:
|
|
||||||
params = {}
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
main()
|
main()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
|
Loading…
Reference in New Issue