filename update

pull/15/head
DiMartinoXBMC 2016-11-29 23:55:05 +03:00
parent a342649f41
commit 4b7c72ad58
1 changed files with 25 additions and 23 deletions

View File

@ -92,7 +92,6 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.connect(ACTION_CONTEXT_MENU, self.context) self.connect(ACTION_CONTEXT_MENU, self.context)
self.connect(ACTION_SHOW_OSD, self.context) self.connect(ACTION_SHOW_OSD, self.context)
def set_navigation(self): def set_navigation(self):
#Top menu #Top menu
self.input_search.setNavigation(self.listing, self.listing, self.last_right_button, self.button_search) self.input_search.setNavigation(self.listing, self.listing, self.last_right_button, self.button_search)
@ -133,8 +132,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
if 1==1: if 1==1:
for (order, seeds, leechers, size, title, link, image) in self.filesList: for (order, seeds, leechers, size, title, link, image) in self.filesList:
title = titleMake(seeds, leechers, size, title) title = titleMake(seeds, leechers, size, title)
#log(title) self.drawItem(title, {'mode':'search_item', 'filename': link}, image)
self.drawItem(title, 'search_item', link, image)
def history(self): def history(self):
self.right_menu('history') self.right_menu('history')
@ -155,8 +153,8 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
else: else:
img = __root__ + '/icons/unfav.png' img = __root__ + '/icons/unfav.png'
link = {'mode': 'history_search_item', 'url': title, 'addtime': str(addtime), 'fav':str(fav)} link = {'mode': 'history_search_item', 'filename': title, 'addtime': str(addtime), 'fav':str(fav)}
self.drawItem(bbstring % title, link, title, img) self.drawItem(bbstring % title, link, img)
def history_action(self, action, addtime, fav): def history_action(self, action, addtime, fav):
db = HistoryDB() db = HistoryDB()
@ -184,13 +182,14 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
dirList, contentListNew = cutFolder(self.contentList, tdir) dirList, contentListNew = cutFolder(self.contentList, tdir)
if not tdir: if not tdir:
self.drawItem('..', 'torrent_moveup', link, isFolder=True) self.drawItem('..', {'mode': 'torrent_moveup', 'filename': link}, isFolder=True)
else: else:
params = {'mode': 'torrent_subfolder'} params = {'mode': 'torrent_subfolder', 'filename': link}
self.drawItem('..', params, link, isFolder=True) self.drawItem('..', params, isFolder=True)
dirList = sorted(dirList, key=lambda x: x[0], reverse=False)
for title in dirList: for title in dirList:
self.drawItem(title, {'mode':'torrent_subfolder', 'tdir': title}, link, isFolder=True) self.drawItem(title, {'mode':'torrent_subfolder', 'tdir': title, 'filename': link}, isFolder=True)
ids_video_result = get_ids_video(contentListNew) ids_video_result = get_ids_video(contentListNew)
ids_video='' ids_video=''
@ -199,9 +198,10 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
for identifier in ids_video_result: for identifier in ids_video_result:
ids_video = ids_video + str(identifier) + ',' ids_video = ids_video + str(identifier) + ','
contentListNew = sorted(contentListNew, key=lambda x: x[0], reverse=False)
for title, identifier, filesize in contentListNew: for title, identifier, filesize in contentListNew:
params = {'mode': 'torrent_play', 'url': identifier, 'url2': ids_video.rstrip(',')} params = {'mode': 'torrent_play', 'url': identifier, 'url2': ids_video.rstrip(','), 'filename': link}
self.drawItem(title, params, link) self.drawItem(title, params)
def get_menulist(self, mode): def get_menulist(self, mode):
@ -225,8 +225,9 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
def context(self): def context(self):
if self.getFocus() == self.listing: if self.getFocus() == self.listing:
item = self.listing.getSelectedItem() item = self.listing.getSelectedItem()
params = json.loads(item.getLabel2()) params = json.loads(item.getfilename())
mode = params.get('mode') mode = params.get('mode')
filename = params.get('filename')
label_list = self.get_menulist(mode) label_list = self.get_menulist(mode)
if not self.version_check(): if not self.version_check():
@ -279,10 +280,9 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
def right_press1(self): def right_press1(self):
item = self.listing.getSelectedItem() item = self.listing.getSelectedItem()
params = json.loads(item.getLabel2()) params = json.loads(item.getfilename())
mode = params.get('mode') mode = params.get('mode')
filename = item.getfilename() filename = params.get('filename')
label = item.getLabel()
tdir = params.get('tdir') tdir = params.get('tdir')
self.listing.reset() self.listing.reset()
if mode == 'search_item': if mode == 'search_item':
@ -304,9 +304,9 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
def right_press2(self): def right_press2(self):
item = self.listing.getSelectedItem() item = self.listing.getSelectedItem()
params = json.loads(item.getLabel2()) params = json.loads(item.getfilename())
mode = params.get('mode') mode = params.get('mode')
filename = item.getfilename() filename = params.get('filename')
if mode == 'torrent_play': if mode == 'torrent_play':
action = 'downloadFilesList' action = 'downloadFilesList'
link = {'ind': str(params.get('url'))} link = {'ind': str(params.get('url'))}
@ -323,9 +323,9 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
def right_press3(self): def right_press3(self):
item = self.listing.getSelectedItem() item = self.listing.getSelectedItem()
params = json.loads(item.getLabel2()) params = json.loads(item.getfilename())
filename = item.getfilename()
mode = params.get('mode') mode = params.get('mode')
filename = params.get('filename')
if mode == 'torrent_play': if mode == 'torrent_play':
action = 'downloadLibtorrent' action = 'downloadLibtorrent'
link = {'ind': str(params.get('url'))} link = {'ind': str(params.get('url'))}
@ -345,8 +345,9 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
def right_press4(self): def right_press4(self):
item = self.listing.getSelectedItem() item = self.listing.getSelectedItem()
params = json.loads(item.getLabel2()) params = json.loads(item.getfilename())
mode = params.get('mode') mode = params.get('mode')
filename = params.get('filename')
if mode == 'history_search_item': if mode == 'history_search_item':
addtime = params.get('addtime') addtime = params.get('addtime')
fav = params.get('fav') fav = params.get('fav')
@ -354,8 +355,9 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
def right_press5(self): def right_press5(self):
item = self.listing.getSelectedItem() item = self.listing.getSelectedItem()
params = json.loads(item.getLabel2()) params = json.loads(item.getfilename())
mode = params.get('mode') mode = params.get('mode')
filename = params.get('filename')
if mode == 'history_search_item': if mode == 'history_search_item':
addtime = params.get('addtime') addtime = params.get('addtime')
fav = params.get('fav') fav = params.get('fav')
@ -370,7 +372,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
except: except:
return string return string
def drawItem(self, title, params, link, image = None, isFolder = False): def drawItem(self, title, params, image = None, isFolder = False):
if isinstance(params, str): if isinstance(params, str):
params = {'mode': params} params = {'mode': params}
@ -378,7 +380,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
image = 'DefaultFolder.png' image = 'DefaultFolder.png'
elif not image: elif not image:
image = 'DefaultVideo.png' image = 'DefaultVideo.png'
listitem = xbmcgui.ListItem(title, json.dumps(params), image, image, link) listitem = xbmcgui.ListItem(title, '', image, image, json.dumps(params))
self.listing.addItem(listitem) self.listing.addItem(listitem)
def form_link(self, action, link): def form_link(self, action, link):