torrent browser

pull/15/head
DiMartinoXBMC 2016-12-09 21:11:23 +03:00
parent f5dbf2bb7a
commit 25a7d9a3fb
15 changed files with 247 additions and 189 deletions

15
Core.py
View File

@ -90,7 +90,7 @@ class Core:
self.drawItem('< %s >' % self.localize('Download Status'), 'DownloadStatus', image=self.ROOT + '/icons/download.png',
contextMenu=DLScontextMenu, replaceMenu=False)
self.drawItem('< %s >' % self.localize('Torrent-client Browser'), 'uTorrentBrowser',
image=self.ROOT + '/icons/' + self.getTorrentClientIcon())
image=self.ROOT + '/icons/' + getTorrentClientIcon())
if self.history_bool:
WatchedHistorycontextMenu=[]
WatchedHistorycontextMenu.extend(contextMenu)
@ -1940,19 +1940,6 @@ class Core:
i=delete_russian(ok=True, action='return')
showMessage(self.localize('Return Russian stuff'),self.localize('%d files have been returned')%i)
def getTorrentClientIcon(self):
client = self.__settings__.getSetting("torrent")
if client == '1':
return 'transmission.png'
elif client == '2':
return 'vuze.png'
elif client == '3':
return 'deluge.png'
elif client == '4':
return 'qbittorrent.png'
else:
return 'torrent-client.png'
def callback(self, params={}):
get = params.get

View File

@ -809,6 +809,9 @@ def localize(text):
'Play (from start)':'Lejátszás (az elejétől)',
},
'ru': {
'Info':'Инфо',
'Delete torrent with files?':'Вы уверены, что хотите удалить торрент с файлами?',
'Fav. / Unfav.':'Доб./удал. Избранное',
'Search Window': 'Окно поиска',
'Context menu': 'Контекстное меню',
'Seeds searching.': 'Идёт поиск сидов.',
@ -1011,6 +1014,7 @@ def localize(text):
'Stop All':'Остановить Все',
'Keyboard':'Клавиатура',
'Copy Files in Root':'Скопировать файлы в Корень',
'Copy in Root': 'Скопировать в Корень',
'Copied %d files!':'Скопировано %d файлов!',
'Return to %s':'Вернуться в %s',
'Search results:':'Результаты поиска:',

View File

@ -2190,3 +2190,16 @@ def get_platform():
ret["arch"] = "arm"
return ret
def getTorrentClientIcon():
client = __settings__.getSetting("torrent")
if client == '1':
return 'transmission.png'
elif client == '2':
return 'vuze.png'
elif client == '3':
return 'deluge.png'
elif client == '4':
return 'qbittorrent.png'
else:
return 'torrent-client.png'

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -17,13 +17,12 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import xbmcaddon
import xbmcvfs
import xbmcgui
from functions import *
import pyxbmct.addonwindow as pyxbmct
import Localization
import re
import xbmcaddon
import xbmcgui
import xbmcvfs
from functions import *
__settings__ = xbmcaddon.Addon(id='plugin.video.torrenter')
__language__ = __settings__.getLocalizedString
@ -40,6 +39,7 @@ ACTION_MOUSE_RIGHT_CLICK = 101
ACTION_CONTEXT_MENU = 117
ACTION_SHOW_OSD = 24
class SearchWindow(pyxbmct.AddonDialogWindow):
__settings__ = sys.modules["__main__"].__settings__
fileList = []
@ -57,6 +57,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
count = 0
icon = __root__ + '/icons/searchwindow/%s.png'
icon_tc = __root__ + '/icons/searchwindow/%s' + getTorrentClientIcon()
def __init__(self, title="", s_param={}):
super(SearchWindow, self).__init__(title)
@ -69,22 +70,32 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.history()
def set_controls(self):
if not __settings__.getSetting('debug') == 'true':
self.background.setImage('%s/icons/%s.png' % (__root__, 'ContentPanel'))
# Top menu
self.button_downloadstatus = pyxbmct.Button("OFF", textColor = '0xFF0000FF', focusTexture = self.icon % 'fdownloadstatus', noFocusTexture = self.icon % 'nfdownloadstatus')
self.button_downloadstatus = pyxbmct.Button("OFF", textColor='0xFF0000FF',
focusTexture=self.icon % 'fdownloadstatus',
noFocusTexture=self.icon % 'nfdownloadstatus')
self.placeControl(self.button_downloadstatus, 0, 2, 1, 1)
self.button_torrentclient = pyxbmct.Button("OFF", textColor = '0xFF0000FF', focusTexture = self.icon % 'ftorrentclient', noFocusTexture = self.icon % 'nftorrentclient')
self.button_torrentclient = pyxbmct.Button("",
focusTexture=self.icon_tc % 'f',
noFocusTexture=self.icon_tc % 'nf')
self.placeControl(self.button_torrentclient, 0, 3, 1, 1)
self.button_keyboard = pyxbmct.Button("", focusTexture = self.icon % 'fkeyboard', noFocusTexture = self.icon % 'nfkeyboard')
self.button_keyboard = pyxbmct.Button("", focusTexture=self.icon % 'fkeyboard',
noFocusTexture=self.icon % 'nfkeyboard')
self.placeControl(self.button_keyboard, 0, 4, 1, 1)
self.input_search = pyxbmct.Edit("", _alignment=pyxbmct.ALIGN_CENTER_X | pyxbmct.ALIGN_CENTER_Y)
self.placeControl(self.input_search, 0, 5, 1, 5)
self.button_search = pyxbmct.Button("", focusTexture = self.icon % 'fsearch', noFocusTexture = self.icon % 'nfsearch')
self.button_search = pyxbmct.Button("", focusTexture=self.icon % 'fsearch',
noFocusTexture=self.icon % 'nfsearch')
self.placeControl(self.button_search, 0, 10, 1, 1)
self.button_history = pyxbmct.Button("", focusTexture = self.icon % 'fhistory', noFocusTexture = self.icon % 'nfhistory')
self.button_history = pyxbmct.Button("", focusTexture=self.icon % 'fhistory',
noFocusTexture=self.icon % 'nfhistory')
self.placeControl(self.button_history, 0, 11, 1, 1)
self.button_controlcenter = pyxbmct.Button("", focusTexture = self.icon % 'fcontrolcenter', noFocusTexture = self.icon % 'nfcontrolcenter')
self.button_controlcenter = pyxbmct.Button("", focusTexture=self.icon % 'fcontrolcenter',
noFocusTexture=self.icon % 'nfcontrolcenter')
self.placeControl(self.button_controlcenter, 0, 12, 1, 1)
# Main
@ -115,8 +126,10 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
def set_navigation(self):
# Top menu
self.button_downloadstatus.setNavigation(self.listing, self.listing, self.last_right_button, self.button_torrentclient)
self.button_torrentclient.setNavigation(self.listing, self.listing, self.button_downloadstatus, self.button_keyboard)
self.button_downloadstatus.setNavigation(self.listing, self.listing, self.last_right_button,
self.button_torrentclient)
self.button_torrentclient.setNavigation(self.listing, self.listing, self.button_downloadstatus,
self.button_keyboard)
self.button_keyboard.setNavigation(self.listing, self.listing, self.button_torrentclient, self.input_search)
self.input_search.setNavigation(self.listing, self.listing, self.button_keyboard, self.button_search)
self.button_search.setNavigation(self.listing, self.listing, self.input_search, self.button_history)
@ -124,7 +137,8 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.button_controlcenter.setNavigation(self.listing, self.listing, self.button_history, self.last_right_button)
# Main
self.listing.setNavigation(self.input_search, self.input_search, self.button_downloadstatus, self.last_right_button)
self.listing.setNavigation(self.input_search, self.input_search, self.button_downloadstatus,
self.last_right_button)
if self.listing.size():
self.setFocus(self.listing)
@ -202,7 +216,8 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
else:
img = __root__ + '/icons/unfav.png'
link = {'mode': 'history_search_item', 'filename': 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, img)
def history_action(self, action, addtime, fav):
@ -221,19 +236,12 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.history()
def browser(self, params={}):
def browser(self, hash = None, tdir = None):
from resources.utorrent.net import Download
self.listing.reset()
menu, dirs = [], []
contextMenustring = 'XBMC.RunPlugin(%s)' % ('%s?action=%s&url=%s') % (sys.argv[0], 'uTorrentBrowser', '%s')
get = params.get
action = get('action')
hash = get('hash')
ind = get('ind')
tdir = get('tdir')
DownloadList = Download().list()
if DownloadList == False:
showMessage(self.localize('Error'), self.localize('No connection! Check settings!'), forced=True)
@ -241,6 +249,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
if not hash:
self.right_menu('browser')
self.reconnect(pyxbmct.ACTION_NAV_BACK, self.history)
for data in DownloadList:
status = " "
img = ''
@ -262,7 +271,9 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
menu.append(
{"title": title, "image": img, "argv": {'mode': 'browser_item', 'hash': str(data['id'])}})
elif not tdir:
self.right_menu('browser_file')
self.right_menu('browser_subfolder')
self.reconnect(pyxbmct.ACTION_NAV_BACK, self.browser)
self.drawItem('..', {'mode': 'browser_moveup'}, isFolder=True)
dllist = sorted(Download().listfiles(hash), key=lambda x: x[0])
for name, percent, ind, size in dllist:
if '/' not in name:
@ -270,61 +281,50 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
menu.append({"title": title, "image": '',
"argv": {'mode': 'browser_file', 'hash': hash, 'ind': str(ind)}})
else:
tdir = name.split('/')[0]
if tdir not in dirs: dirs.append(tdir)
newtdir = name.split('/')[0]
if newtdir not in dirs: dirs.append(newtdir)
elif tdir:
self.right_menu('browser_subfolder')
tdir_up = tdir[:len(tdir)-len(tdir.split('/')[-1])-1] if '/' in tdir else None
self.drawItem('..', {'mode': 'browser_subfolder', 'hash': hash, 'tdir': tdir_up}, isFolder=True)
dllist = sorted(Download().listfiles(hash), key=lambda x: x[0])
for name, percent, ind, size in dllist:
if '/' in name and tdir in name:
menu.append(
{"title": '[' + str(percent) + '%]' + '[' + str(size) + '] ' + name[len(tdir) + 1:], "image":'',
"argv": {'hash': hash, 'ind': str(ind), 'action': 'context'}})
for i in dirs:
app = {'mode':'browser_folder', 'hash': hash, 'tdir': i}
link = json.dumps(app)
popup = []
folder = True
actions = [('3', self.localize('High Priority Files')), ('copy', self.localize('Copy Files in Root')), ('0', self.localize('Skip All Files'))]
for a, title in actions:
app['action'] = a
popup.append((self.localize(title), contextMenustring % urllib.quote_plus(json.dumps(app))))
self.drawItem(i, 'uTorrentBrowser', link, isFolder=folder)
if name[:len(tdir)] == tdir:
name = name[len(tdir) + 1:]
if '/' not in name:
title = '[%s%%][%s]%s' % (str(percent), str(size), name)
menu.append({"title": title, "image": '',
"argv": {'mode': 'browser_file', 'hash': hash, 'ind': str(ind)}})
else:
newtdir = tdir+'/'+name.split('/')[0]
if newtdir not in dirs: dirs.append(newtdir)
for tdir in dirs:
params = {'mode': 'browser_subfolder', 'hash': hash, 'tdir': tdir}
title = tdir.split('/')[-1] if '/' in tdir else tdir
self.drawItem(title, params, isFolder = True)
for i in menu:
app = i['argv']
link = json.dumps(app)
params = i['argv']
img = i['image']
popup = []
if not hash:
actions = [('start', self.localize('Start')), ('stop', self.localize('Stop')),
('remove', self.localize('Remove')),
('3', self.localize('High Priority Files')), ('0', self.localize('Skip All Files')),
('removedata', self.localize('Remove with files'))]
folder = True
else:
actions = [('3', self.localize('High Priority')), ('0', self.localize('Skip File')),
('play', self.localize('Play File'))]
folder = False
for a, title in actions:
app['action'] = a
popup.append((self.localize(title), contextMenustring % urllib.quote_plus(json.dumps(app))))
self.drawItem(i['title'], link, image=img, isFolder=folder)
self.drawItem(i['title'], params, image = img, isFolder = folder)
# def drawItem(self, title, params, image = None, isFolder = False):
if self.listing.size():
self.setFocus(self.listing)
else:
self.setFocus(self.button_torrentclient)
return
def browser_action(self, params={}):
def browser_action(self, hash, action, tdir = None, ind = None):
from resources.utorrent.net import Download
menu = []
get = params.get
action = get('action')
hash = get('hash')
ind = get('ind')
tdir = get('tdir')
DownloadList = Download().list()
if DownloadList == False:
@ -340,20 +340,20 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
folder = data['dir']
break
if isRemoteTorr():
t_dir = self.__settings__.getSetting("torrent_dir")
torrent_dir = self.__settings__.getSetting("torrent_dir")
torrent_replacement = self.__settings__.getSetting("torrent_replacement")
empty = [None, '']
if t_dir in empty or torrent_replacement in empty:
if torrent_dir in empty or torrent_replacement in empty:
if xbmcgui.Dialog().yesno(
self.localize('Remote Torrent-client'),
self.localize('You didn\'t set up replacement path in setting.'),
self.localize('For example /media/dl_torr/ to smb://SERVER/dl_torr/. Setup now?')):
if t_dir in empty:
if torrent_dir in empty:
torrent_dir()
self.__settings__.openSettings()
return
folder = folder.replace(t_dir, torrent_replacement)
folder = folder.replace(torrent_dir, torrent_replacement)
if (ind or ind == 0) and action == 'play':
for data in dllist:
if data[2] == int(ind):
@ -384,6 +384,10 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
showMessage(self.localize('Torrent-client Browser'), self.localize('Copied %d files!') % i, forced=True)
return
elif not tdir and action not in ('0', '3'):
if action == 'removedata':
ok = xbmcgui.Dialog().yesno(self.localize('Torrent-client Browser'),
self.localize('Delete torrent with files?'))
if not ok: sys.exit(1)
Download().action_simple(action, hash)
elif action in ('0', '3'):
dllist = sorted(Download().listfiles(hash), key=lambda x: x[0])
@ -395,7 +399,6 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
menu.append((hash, action, str(ind)))
Download().setprio_simple_multi(menu)
return
xbmc.executebuiltin('Container.Refresh')
return
def open_torrent(self, link, tdir=None):
@ -408,7 +411,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
dirList, contentListNew = cutFolder(self.contentList, tdir)
if not tdir:
self.drawItem('..', {'mode': 'torrent_moveup', 'filename': link}, isFolder=True)
params = {'mode': 'torrent_moveup', 'filename': link}
else:
params = {'mode': 'torrent_subfolder', 'filename': link}
self.drawItem('..', params, isFolder=True)
@ -431,33 +434,35 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
def get_menulist(self, mode):
label_list = ["Empty","Empty","Empty","Empty","Empty","Empty"]
label_list = ["Empty", "Empty", "Empty", "Empty", "Empty", "Empty", "Empty"]
if mode in ['search', 'search_item', 'torrent_play']:
label_list = ["Open",
label_list = [self.localize('Open'),
self.localize('Download via T-client'),
self.localize('Download via Libtorrent'),
'Info']
elif mode in ['torrent_subfolder', 'torrent_moveup']:
label_list = ["Open"]
self.localize('Info'),]
elif mode in ['torrent_subfolder', 'torrent_moveup',
'browser_moveup']:
label_list = [self.localize('Open'),]
elif mode in ['history', 'history_search_item']:
label_list = [self.localize('Open'),
self.localize('Edit'),
self.localize('Individual Tracker Options'),
'Fav/Unfav',
self.localize('Fav. / Unfav.'),
self.localize('Delete')]
elif mode in ['browser', 'browser_item']:
label_list = [self.localize('Start'), self.localize('Stop'),
self.localize('Remove'), self.localize('High Priority Files'),
label_list = [self.localize('Open'), self.localize('Start'), self.localize('Stop'),
self.localize('Remove'), self.localize('High Priority'),
self.localize('Skip All Files'), self.localize('Remove with files')]
elif mode in ['browser_file']:
label_list = [self.localize('High Priority'), self.localize('Skip File'),
self.localize('Play File')]
elif mode in ['browser_folder']:
label_list = [self.localize('High Priority Files'),
label_list = [self.localize('Play File'),
self.localize('High Priority'), self.localize('Skip File')]
elif mode in ['browser_subfolder']:
label_list = [self.localize('Open'),
self.localize('High Priority'),
self.localize('Skip All Files'),
self.localize('Copy Files in Root'),]
self.localize('Copy in Root'), ]
return label_list
@ -502,12 +507,15 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
button = getattr(self, "button_right" + str(index))
if self.right_buttons_count == 1:
button.setNavigation(self.button_controlcenter, self.button_right1, self.listing, self.input_search)
button.setNavigation(self.button_controlcenter,
self.button_right1, self.listing, self.input_search)
else:
if index == button_num_list[0]:
button.setNavigation(self.button_controlcenter, self.button_right2, self.listing, self.input_search)
button.setNavigation(getattr(self, "button_right" + str(self.right_buttons_count)),
self.button_right2, self.listing, self.input_search)
elif index == button_num_list[-1]:
button.setNavigation(getattr(self, "button_right" + str(index-1)), self.button_right1, self.listing,
button.setNavigation(getattr(self, "button_right" + str(index - 1)), self.button_right1,
self.listing,
self.input_search)
else:
button.setNavigation(getattr(self, "button_right" + str(index - 1)),
@ -557,11 +565,11 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
def setlabel(self, button, label):
label = label.decode('utf-8')
log(label+' '+str(len(label)))
debug('setlabel: ' + label + ' ' + str(len(label)))
if len(label) > 10:
spaces = label.count(' ')
log('spaces=' + str(spaces))
debug('setlabel spaces=' + str(spaces))
if spaces == 0:
words = [label[:10], label[10:]]
label = '%s-\r\n%s' % (words[0], words[1])
@ -579,38 +587,45 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
button.setLabel(label)
def right_press1(self):
item = self.listing.getSelectedItem()
params = json.loads(item.getfilename())
log('params ' + str(params))
mode = params.get('mode')
filename = params.get('filename')
hash = params.get('hash')
ind = params.get('ind')
tdir = params.get('tdir')
self.listing.reset()
if mode == 'search_item':
self.open_torrent(filename)
elif mode == 'torrent_subfolder':
if mode in ['search_item', 'torrent_subfolder']:
self.open_torrent(filename, tdir)
elif mode == 'torrent_moveup':
self.search()
self.setFocus(self.listing)
elif mode == 'torrent_play':
action = 'playTorrent'
url = self.form_link(action, params)
url = self.form_link('playTorrent', params)
xbmc.executebuiltin('xbmc.RunPlugin("%s")' % (url))
self.close()
elif mode == 'history_search_item':
addtime = params.get('addtime')
self.input_search.setText(filename)
self.search(addtime)
elif mode == 'browser_item':
self.browser(params)
elif mode in ['browser_item', 'browser_subfolder']:
self.browser(hash, tdir)
elif mode == 'browser_moveup':
self.browser(hash, tdir)
elif mode == 'browser_file':
self.browser_action(hash, 'play', tdir = tdir, ind = ind)
self.close()
def right_press2(self):
item = self.listing.getSelectedItem()
params = json.loads(item.getfilename())
mode = params.get('mode')
filename = params.get('filename')
hash = params.get('hash')
ind = params.get('ind')
tdir = params.get('tdir')
if mode == 'torrent_play':
action = 'downloadFilesList'
link = {'ind': str(params.get('url'))}
@ -624,12 +639,21 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
elif mode == 'history_search_item':
self.input_search.setText(filename)
self.setFocus(self.input_search)
elif mode == 'browser_item':
self.browser_action(hash, 'start')
elif mode == 'browser_subfolder':
self.browser_action(hash, '3', tdir=tdir, ind=ind)
elif mode == 'browser_file':
self.browser_action(hash, '3', tdir=tdir, ind=ind)
def right_press3(self):
item = self.listing.getSelectedItem()
params = json.loads(item.getfilename())
mode = params.get('mode')
filename = params.get('filename')
hash = params.get('hash')
ind = params.get('ind')
tdir = params.get('tdir')
if mode == 'torrent_play':
action = 'downloadLibtorrent'
link = {'ind': str(params.get('url'))}
@ -643,35 +667,68 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
elif mode == 'history_search_item':
params['title'] = params.get('filename')
self.controlCenter(params)
elif mode == 'browser_item':
self.browser_action(hash, 'stop')
elif mode == 'browser_subfolder':
self.browser_action(hash, '0', tdir=tdir, ind=ind)
elif mode == 'browser_file':
self.browser_action(hash, '0', tdir=tdir, ind=ind)
def right_press4(self):
item = self.listing.getSelectedItem()
params = json.loads(item.getfilename())
mode = params.get('mode')
filename = params.get('filename')
hash = params.get('hash')
ind = params.get('ind')
tdir = params.get('tdir')
if mode == 'history_search_item':
addtime = params.get('addtime')
fav = params.get('fav')
self.history_action('fav', addtime, fav)
else:
elif mode == 'search_item':
cleanlabel = re.sub('\[[^\]]*\]', '', item.getLabel())
ttl, yr = xbmc.getCleanMovieTitle(cleanlabel)
infoW = InfoWindow(ttl, yr)
infoW.doModal()
del infoW
elif mode == 'browser_item':
self.browser_action(hash, 'remove')
self.browser()
elif mode == 'browser_subfolder':
self.browser_action(hash, 'copy', tdir=tdir, ind=ind)
def right_press5(self):
item = self.listing.getSelectedItem()
params = json.loads(item.getfilename())
mode = params.get('mode')
filename = params.get('filename')
hash = params.get('hash')
if mode == 'history_search_item':
addtime = params.get('addtime')
fav = params.get('fav')
self.history_action('delete', addtime, fav)
elif mode == 'browser_item':
self.browser_action(hash, '3')
def right_press6(self):
pass
item = self.listing.getSelectedItem()
params = json.loads(item.getfilename())
mode = params.get('mode')
filename = params.get('filename')
hash = params.get('hash')
if mode == 'browser_item':
self.browser_action(hash, '0')
def right_press7(self):
item = self.listing.getSelectedItem()
params = json.loads(item.getfilename())
mode = params.get('mode')
filename = params.get('filename')
hash = params.get('hash')
if mode == 'browser_item':
self.browser_action(hash, 'removedata')
self.browser()
def localize(self, string):
try:
@ -706,9 +763,9 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
import controlcenter
controlcenter.main()
def reconnect(self, event, callabel):
def reconnect(self, event, callable):
self.disconnect(event)
self.connect(event, callabel)
self.connect(event, callable)
def version_check(self):
return False if int(xbmc.getInfoLabel("System.BuildVersion")[:2]) < 17 else True
@ -718,8 +775,6 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
class InfoWindow(pyxbmct.AddonDialogWindow):
def __init__(self, title="", year=""):
super(InfoWindow, self).__init__(title)
self.title = title
@ -729,7 +784,6 @@ class InfoWindow(pyxbmct.AddonDialogWindow):
self.connect_controls()
# self.set_navigation()
def set_controls(self):
# pyxbmct.AddonWindow().setImage(__root__ + '/resources/skins/Default/media/ConfluenceDialogBack.png')
# self.placeControl(self.background, 0, 0, rowspan=3, columnspan=2)
@ -744,7 +798,6 @@ class InfoWindow(pyxbmct.AddonDialogWindow):
# self.button_search = pyxbmct.Button("Search")
# self.placeControl(self.button_search, 0, 5, 1, 2)
def connect_controls(self):
from resources.scrapers.scrapers import Scrapers
self.Scraper = Scrapers()
@ -766,6 +819,7 @@ class InfoWindow(pyxbmct.AddonDialogWindow):
self.logoimg.setImage(meta.get('thumbnail'))
self.plot.setText(meta.get('plot'))
def log(msg):
try:
xbmc.log("### [%s]: %s" % (__plugin__, msg,), level=xbmc.LOGNOTICE)
@ -774,8 +828,8 @@ def log(msg):
except:
xbmc.log("### [%s]: %s" % (__plugin__, 'ERROR LOG',), level=xbmc.LOGNOTICE)
def titleMake(seeds, leechers, size, title):
def titleMake(seeds, leechers, size, title):
# AARRGGBB
clGreen = '[COLOR FF008000]%s[/COLOR]'
clDodgerblue = '[COLOR FF1E90FF]%s[/COLOR]'