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', self.drawItem('< %s >' % self.localize('Download Status'), 'DownloadStatus', image=self.ROOT + '/icons/download.png',
contextMenu=DLScontextMenu, replaceMenu=False) contextMenu=DLScontextMenu, replaceMenu=False)
self.drawItem('< %s >' % self.localize('Torrent-client Browser'), 'uTorrentBrowser', self.drawItem('< %s >' % self.localize('Torrent-client Browser'), 'uTorrentBrowser',
image=self.ROOT + '/icons/' + self.getTorrentClientIcon()) image=self.ROOT + '/icons/' + getTorrentClientIcon())
if self.history_bool: if self.history_bool:
WatchedHistorycontextMenu=[] WatchedHistorycontextMenu=[]
WatchedHistorycontextMenu.extend(contextMenu) WatchedHistorycontextMenu.extend(contextMenu)
@ -1940,19 +1940,6 @@ class Core:
i=delete_russian(ok=True, action='return') i=delete_russian(ok=True, action='return')
showMessage(self.localize('Return Russian stuff'),self.localize('%d files have been returned')%i) 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={}): def callback(self, params={}):
get = params.get get = params.get

View File

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

View File

@ -2190,3 +2190,16 @@ def get_platform():
ret["arch"] = "arm" ret["arch"] = "arm"
return ret 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 You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. 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 pyxbmct.addonwindow as pyxbmct
import Localization import xbmcaddon
import re import xbmcgui
import xbmcvfs
from functions import *
__settings__ = xbmcaddon.Addon(id='plugin.video.torrenter') __settings__ = xbmcaddon.Addon(id='plugin.video.torrenter')
__language__ = __settings__.getLocalizedString __language__ = __settings__.getLocalizedString
@ -33,13 +32,14 @@ __root__ = __settings__.getAddonInfo('path')
log('SYS ARGV: ' + str(sys.argv)) log('SYS ARGV: ' + str(sys.argv))
#https://github.com/xbmc/xbmc/blob/8d4a5bba55638dfd0bdc5e7de34f3e5293f99933/xbmc/input/Key.h # https://github.com/xbmc/xbmc/blob/8d4a5bba55638dfd0bdc5e7de34f3e5293f99933/xbmc/input/Key.h
ACTION_STOP = 13 ACTION_STOP = 13
ACTION_PLAYER_PLAY = 79 ACTION_PLAYER_PLAY = 79
ACTION_MOUSE_RIGHT_CLICK = 101 ACTION_MOUSE_RIGHT_CLICK = 101
ACTION_CONTEXT_MENU = 117 ACTION_CONTEXT_MENU = 117
ACTION_SHOW_OSD = 24 ACTION_SHOW_OSD = 24
class SearchWindow(pyxbmct.AddonDialogWindow): class SearchWindow(pyxbmct.AddonDialogWindow):
__settings__ = sys.modules["__main__"].__settings__ __settings__ = sys.modules["__main__"].__settings__
fileList = [] fileList = []
@ -57,6 +57,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
count = 0 count = 0
icon = __root__ + '/icons/searchwindow/%s.png' icon = __root__ + '/icons/searchwindow/%s.png'
icon_tc = __root__ + '/icons/searchwindow/%s' + getTorrentClientIcon()
def __init__(self, title="", s_param={}): def __init__(self, title="", s_param={}):
super(SearchWindow, self).__init__(title) super(SearchWindow, self).__init__(title)
@ -69,30 +70,40 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.history() self.history()
def set_controls(self): def set_controls(self):
self.background.setImage('%s/icons/%s.png' %(__root__, 'ContentPanel')) if not __settings__.getSetting('debug') == 'true':
self.background.setImage('%s/icons/%s.png' % (__root__, 'ContentPanel'))
#Top menu # 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.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.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.placeControl(self.button_keyboard, 0, 4, 1, 1)
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, 5, 1, 5) 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.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.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) self.placeControl(self.button_controlcenter, 0, 12, 1, 1)
#Main # Main
self.listing = pyxbmct.List(_imageWidth=60, _imageHeight=60, _itemTextXOffset=1, self.listing = pyxbmct.List(_imageWidth=60, _imageHeight=60, _itemTextXOffset=1,
_itemTextYOffset=0, _itemHeight=60, _space=0, _alignmentY=4) _itemTextYOffset=0, _itemHeight=60, _space=0, _alignmentY=4)
self.placeControl(self.listing, 1, 0, 8, 14) self.placeControl(self.listing, 1, 0, 8, 14)
#Right menu # Right menu
self.right_menu() self.right_menu()
def connect_controls(self): def connect_controls(self):
@ -114,17 +125,20 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.connect(pyxbmct.ACTION_MOVE_DOWN, self.right_menu_set_label) self.connect(pyxbmct.ACTION_MOVE_DOWN, self.right_menu_set_label)
def set_navigation(self): def set_navigation(self):
#Top menu # Top menu
self.button_downloadstatus.setNavigation(self.listing, self.listing, self.last_right_button, self.button_torrentclient) self.button_downloadstatus.setNavigation(self.listing, self.listing, self.last_right_button,
self.button_torrentclient.setNavigation(self.listing, self.listing, self.button_downloadstatus, self.button_keyboard) 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.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.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) self.button_search.setNavigation(self.listing, self.listing, self.input_search, self.button_history)
self.button_history.setNavigation(self.listing, self.listing, self.button_search, self.button_controlcenter) self.button_history.setNavigation(self.listing, self.listing, self.button_search, self.button_controlcenter)
self.button_controlcenter.setNavigation(self.listing, self.listing, self.button_history, self.last_right_button) self.button_controlcenter.setNavigation(self.listing, self.listing, self.button_history, self.last_right_button)
#Main # 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(): if self.listing.size():
self.setFocus(self.listing) self.setFocus(self.listing)
@ -155,32 +169,32 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
else: else:
self.input_search.setText(search) self.input_search.setText(search)
query = search query = search
#self.setFocus(self.listing) # self.setFocus(self.listing)
else: else:
query = self.input_search.getText() query = self.input_search.getText()
self.history() self.history()
else: else:
query = self.input_search.getText() query = self.input_search.getText()
log('Search query: '+str(query)) log('Search query: ' + str(query))
if not addtime and query == self.last_query: if not addtime and query == self.last_query:
addtime = self.addtime addtime = self.addtime
searchersList = get_searchersList(addtime) searchersList = get_searchersList(addtime)
#cache # cache
if (query != self.last_query or self.searchersList != searchersList) and len(query)>0: if (query != self.last_query or self.searchersList != searchersList) and len(query) > 0:
self.filesList = get_filesList(query, searchersList, addtime) self.filesList = get_filesList(query, searchersList, addtime)
self.addtime = addtime self.addtime = addtime
self.searchersList = searchersList self.searchersList = searchersList
self.last_query = query self.last_query = query
elif len(query)==0: elif len(query) == 0:
self.filesList = [] self.filesList = []
if 1==1: if 1 == 1:
if self.filesList: if self.filesList:
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)
self.drawItem(title, {'mode':'search_item', 'filename': link}, image) self.drawItem(title, {'mode': 'search_item', 'filename': link}, image)
self.setFocus(self.listing) self.setFocus(self.listing)
def history(self): def history(self):
@ -202,7 +216,8 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
else: else:
img = __root__ + '/icons/unfav.png' 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) self.drawItem(bbstring % title, link, img)
def history_action(self, action, addtime, fav): def history_action(self, action, addtime, fav):
@ -221,19 +236,12 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.history() self.history()
def browser(self, params={}): def browser(self, hash = None, tdir = None):
from resources.utorrent.net import Download from resources.utorrent.net import Download
self.listing.reset() self.listing.reset()
menu, dirs = [], [] menu, dirs = [], []
contextMenustring = 'XBMC.RunPlugin(%s)' % ('%s?action=%s&url=%s') % (sys.argv[0], 'uTorrentBrowser', '%s') 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() DownloadList = Download().list()
if DownloadList == False: if DownloadList == False:
showMessage(self.localize('Error'), self.localize('No connection! Check settings!'), forced=True) showMessage(self.localize('Error'), self.localize('No connection! Check settings!'), forced=True)
@ -241,9 +249,10 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
if not hash: if not hash:
self.right_menu('browser') self.right_menu('browser')
self.reconnect(pyxbmct.ACTION_NAV_BACK, self.history)
for data in DownloadList: for data in DownloadList:
status = " " status = " "
img='' img = ''
if data['status'] in ('seed_pending', 'stopped'): if data['status'] in ('seed_pending', 'stopped'):
status = TextBB(' [||] ', 'b') status = TextBB(' [||] ', 'b')
elif data['status'] in ('seeding', 'downloading'): elif data['status'] in ('seeding', 'downloading'):
@ -257,74 +266,65 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
elif data['status'] == 'downloading': elif data['status'] == 'downloading':
img = os.path.join(__root__, 'icons', 'download-icon.png') img = os.path.join(__root__, 'icons', 'download-icon.png')
title = '[%s%%]%s%s [%s]' % (str(data['progress']),status,data['name'],str(data['ratio'])) title = '[%s%%]%s%s [%s]' % (str(data['progress']), status, data['name'], str(data['ratio']))
#title = '[' + str(data['progress']) + '%]' + status + data['name'] + ' [' + str(data['ratio']) + ']' # title = '[' + str(data['progress']) + '%]' + status + data['name'] + ' [' + str(data['ratio']) + ']'
menu.append( menu.append(
{"title": title, "image":img, "argv": {'mode':'browser_item', 'hash': str(data['id'])}}) {"title": title, "image": img, "argv": {'mode': 'browser_item', 'hash': str(data['id'])}})
elif not tdir: 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]) dllist = sorted(Download().listfiles(hash), key=lambda x: x[0])
for name, percent, ind, size in dllist: for name, percent, ind, size in dllist:
if '/' not in name: if '/' not in name:
title = '[%s%%][%s]%s' % (str(percent), str(size), name) title = '[%s%%][%s]%s' % (str(percent), str(size), name)
menu.append({"title": title, "image":'', menu.append({"title": title, "image": '',
"argv": {'mode':'browser_file', 'hash': hash, 'ind': str(ind)}}) "argv": {'mode': 'browser_file', 'hash': hash, 'ind': str(ind)}})
else: else:
tdir = name.split('/')[0] newtdir = name.split('/')[0]
if tdir not in dirs: dirs.append(tdir) if newtdir not in dirs: dirs.append(newtdir)
elif tdir: 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]) dllist = sorted(Download().listfiles(hash), key=lambda x: x[0])
for name, percent, ind, size in dllist: 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: if name[:len(tdir)] == tdir:
app = {'mode':'browser_folder', 'hash': hash, 'tdir': i} name = name[len(tdir) + 1:]
link = json.dumps(app) if '/' not in name:
popup = [] title = '[%s%%][%s]%s' % (str(percent), str(size), name)
folder = True menu.append({"title": title, "image": '',
actions = [('3', self.localize('High Priority Files')), ('copy', self.localize('Copy Files in Root')), ('0', self.localize('Skip All Files'))] "argv": {'mode': 'browser_file', 'hash': hash, 'ind': str(ind)}})
for a, title in actions: else:
app['action'] = a newtdir = tdir+'/'+name.split('/')[0]
popup.append((self.localize(title), contextMenustring % urllib.quote_plus(json.dumps(app)))) if newtdir not in dirs: dirs.append(newtdir)
self.drawItem(i, 'uTorrentBrowser', link, isFolder=folder)
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: for i in menu:
app = i['argv'] params = i['argv']
link = json.dumps(app)
img = i['image'] img = i['image']
popup = [] popup = []
if not hash: 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 folder = True
else: else:
actions = [('3', self.localize('High Priority')), ('0', self.localize('Skip File')),
('play', self.localize('Play File'))]
folder = False 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)
#def drawItem(self, title, params, image = None, isFolder = False):
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 return
def browser_action(self, params={}): def browser_action(self, hash, action, tdir = None, ind = None):
from resources.utorrent.net import Download from resources.utorrent.net import Download
menu = [] menu = []
get = params.get
action = get('action')
hash = get('hash')
ind = get('ind')
tdir = get('tdir')
DownloadList = Download().list() DownloadList = Download().list()
if DownloadList == False: if DownloadList == False:
@ -333,27 +333,27 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
if (ind or ind == 0) and action in ('0', '3'): if (ind or ind == 0) and action in ('0', '3'):
Download().setprio_simple(hash, action, ind) Download().setprio_simple(hash, action, ind)
elif action in ['play','copy']: elif action in ['play', 'copy']:
p, dllist, i, folder, filename = DownloadList, Download().listfiles(hash), 0, None, None p, dllist, i, folder, filename = DownloadList, Download().listfiles(hash), 0, None, None
for data in p: for data in p:
if data['id'] == hash: if data['id'] == hash:
folder = data['dir'] folder = data['dir']
break break
if isRemoteTorr(): if isRemoteTorr():
t_dir = self.__settings__.getSetting("torrent_dir") torrent_dir = self.__settings__.getSetting("torrent_dir")
torrent_replacement = self.__settings__.getSetting("torrent_replacement") torrent_replacement = self.__settings__.getSetting("torrent_replacement")
empty = [None, ''] 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( if xbmcgui.Dialog().yesno(
self.localize('Remote Torrent-client'), self.localize('Remote Torrent-client'),
self.localize('You didn\'t set up replacement path in setting.'), 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?')): 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() torrent_dir()
self.__settings__.openSettings() self.__settings__.openSettings()
return return
folder = folder.replace(t_dir, torrent_replacement) folder = folder.replace(torrent_dir, torrent_replacement)
if (ind or ind == 0) and action == 'play': if (ind or ind == 0) and action == 'play':
for data in dllist: for data in dllist:
if data[2] == int(ind): if data[2] == int(ind):
@ -362,28 +362,32 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
filename = os.path.join(folder, filename) filename = os.path.join(folder, filename)
xbmc.executebuiltin('xbmc.PlayMedia("' + filename.encode('utf-8') + '")') xbmc.executebuiltin('xbmc.PlayMedia("' + filename.encode('utf-8') + '")')
elif tdir and action == 'copy': elif tdir and action == 'copy':
path=os.path.join(folder, tdir) path = os.path.join(folder, tdir)
dirs, files=xbmcvfs.listdir(path) dirs, files = xbmcvfs.listdir(path)
if len(dirs) > 0: if len(dirs) > 0:
dirs.insert(0, self.localize('./ (Root folder)')) dirs.insert(0, self.localize('./ (Root folder)'))
for dd in dirs: for dd in dirs:
dd = file_decode(dd) dd = file_decode(dd)
dds=xbmcvfs.listdir(os.path.join(path,dd))[0] dds = xbmcvfs.listdir(os.path.join(path, dd))[0]
if len(dds)>0: if len(dds) > 0:
for d in dds: for d in dds:
dirs.append(dd+os.sep+d) dirs.append(dd + os.sep + d)
ret = xbmcgui.Dialog().select(self.localize('Choose directory:'), dirs) ret = xbmcgui.Dialog().select(self.localize('Choose directory:'), dirs)
if ret > 0: if ret > 0:
path=os.path.join(path, dirs[ret]) path = os.path.join(path, dirs[ret])
dirs, files=xbmcvfs.listdir(path) dirs, files = xbmcvfs.listdir(path)
for file in files: for file in files:
if not xbmcvfs.exists(os.path.join(path,file)): if not xbmcvfs.exists(os.path.join(path, file)):
xbmcvfs.delete(os.path.join(path,file)) xbmcvfs.delete(os.path.join(path, file))
xbmcvfs.copy(os.path.join(path,file),os.path.join(folder,file)) xbmcvfs.copy(os.path.join(path, file), os.path.join(folder, file))
i=i+1 i = i + 1
showMessage(self.localize('Torrent-client Browser'), self.localize('Copied %d files!') % i, forced=True) showMessage(self.localize('Torrent-client Browser'), self.localize('Copied %d files!') % i, forced=True)
return return
elif not tdir and action not in ('0', '3'): 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) Download().action_simple(action, hash)
elif action in ('0', '3'): elif action in ('0', '3'):
dllist = sorted(Download().listfiles(hash), key=lambda x: x[0]) dllist = sorted(Download().listfiles(hash), key=lambda x: x[0])
@ -395,11 +399,10 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
menu.append((hash, action, str(ind))) menu.append((hash, action, str(ind)))
Download().setprio_simple_multi(menu) Download().setprio_simple_multi(menu)
return return
xbmc.executebuiltin('Container.Refresh')
return return
def open_torrent(self, link, tdir = None): def open_torrent(self, link, tdir=None):
#cache # cache
if link != self.last_link: if link != self.last_link:
self.contentList = get_contentList(link) self.contentList = get_contentList(link)
self.last_link = link self.last_link = link
@ -408,19 +411,19 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
dirList, contentListNew = cutFolder(self.contentList, tdir) dirList, contentListNew = cutFolder(self.contentList, tdir)
if not tdir: if not tdir:
self.drawItem('..', {'mode': 'torrent_moveup', 'filename': link}, isFolder=True) params = {'mode': 'torrent_moveup', 'filename': link}
else: else:
params = {'mode': 'torrent_subfolder', 'filename': link} params = {'mode': 'torrent_subfolder', 'filename': link}
self.drawItem('..', params, isFolder=True) self.drawItem('..', params, isFolder=True)
dirList = sorted(dirList, key=lambda x: x[0], reverse=False) 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, 'filename': 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 = ''
if len(ids_video_result)>0: if len(ids_video_result) > 0:
for identifier in ids_video_result: for identifier in ids_video_result:
ids_video = ids_video + str(identifier) + ',' ids_video = ids_video + str(identifier) + ','
@ -431,33 +434,35 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
def get_menulist(self, mode): 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']: 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 T-client'),
self.localize('Download via Libtorrent'), self.localize('Download via Libtorrent'),
'Info'] self.localize('Info'),]
elif mode in ['torrent_subfolder', 'torrent_moveup']: elif mode in ['torrent_subfolder', 'torrent_moveup',
label_list = ["Open"] 'browser_moveup']:
label_list = [self.localize('Open'),]
elif mode in ['history', 'history_search_item']: elif mode in ['history', 'history_search_item']:
label_list = [self.localize('Open'), label_list = [self.localize('Open'),
self.localize('Edit'), self.localize('Edit'),
self.localize('Individual Tracker Options'), self.localize('Individual Tracker Options'),
'Fav/Unfav', self.localize('Fav. / Unfav.'),
self.localize('Delete')] self.localize('Delete')]
elif mode in ['browser', 'browser_item']: elif mode in ['browser', 'browser_item']:
label_list = [self.localize('Start'), self.localize('Stop'), label_list = [self.localize('Open'), self.localize('Start'), self.localize('Stop'),
self.localize('Remove'), self.localize('High Priority Files'), self.localize('Remove'), self.localize('High Priority'),
self.localize('Skip All Files'), self.localize('Remove with files')] self.localize('Skip All Files'), self.localize('Remove with files')]
elif mode in ['browser_file']: elif mode in ['browser_file']:
label_list = [self.localize('High Priority'), self.localize('Skip File'), label_list = [self.localize('Play File'),
self.localize('Play File')] self.localize('High Priority'), self.localize('Skip File')]
elif mode in ['browser_folder']: elif mode in ['browser_subfolder']:
label_list = [self.localize('High Priority Files'), label_list = [self.localize('Open'),
self.localize('High Priority'),
self.localize('Skip All Files'), self.localize('Skip All Files'),
self.localize('Copy Files in Root'),] self.localize('Copy in Root'), ]
return label_list return label_list
@ -481,33 +486,36 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
if not mode == 'place': if not mode == 'place':
self.last_right_buttons_count = self.right_buttons_count self.last_right_buttons_count = self.right_buttons_count
remove_list = [getattr(self, "button_right" + str(index)) for index remove_list = [getattr(self, "button_right" + str(index)) for index
in range(1, self.last_right_buttons_count+1)] in range(1, self.last_right_buttons_count + 1)]
self.disconnectEventList(remove_list) self.disconnectEventList(remove_list)
self.removeControls(remove_list) self.removeControls(remove_list)
label_list = self.get_menulist(mode) label_list = self.get_menulist(mode)
self.right_buttons_count = len(label_list) self.right_buttons_count = len(label_list)
button_num_list = range(1, self.right_buttons_count+1) button_num_list = range(1, self.right_buttons_count + 1)
for index in button_num_list: for index in button_num_list:
setattr(self, "button_right" + str(index), pyxbmct.Button(label_list[index - 1])) setattr(self, "button_right" + str(index), pyxbmct.Button(label_list[index - 1]))
button = getattr(self, "button_right" + str(index)) button = getattr(self, "button_right" + str(index))
self.connect(button, getattr(self, "right_press"+str(index))) self.connect(button, getattr(self, "right_press" + str(index)))
self.placeControl(button, index, 14, 1, 2) self.placeControl(button, index, 14, 1, 2)
#Navigation # Navigation
self.last_right_button = self.button_right1 self.last_right_button = self.button_right1
for index in button_num_list: for index in button_num_list:
button = getattr(self, "button_right" + str(index)) button = getattr(self, "button_right" + str(index))
if self.right_buttons_count == 1: 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: else:
if index == button_num_list[0]: 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]: 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) self.input_search)
else: else:
button.setNavigation(getattr(self, "button_right" + str(index - 1)), button.setNavigation(getattr(self, "button_right" + str(index - 1)),
@ -519,7 +527,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.set_navigation() self.set_navigation()
def right_menu_set_label(self): def right_menu_set_label(self):
debug('start right_menu_set_label'+str(self.getFocus())) debug('start right_menu_set_label' + str(self.getFocus()))
if self.getFocus() == self.listing: if self.getFocus() == self.listing:
item = self.listing.getSelectedItem() item = self.listing.getSelectedItem()
params = json.loads(item.getfilename()) params = json.loads(item.getfilename())
@ -531,13 +539,13 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.set_menulist(mode) self.set_menulist(mode)
def set_menulist(self, mode): def set_menulist(self, mode):
self.count+=1 self.count += 1
label_list = self.get_menulist(mode) label_list = self.get_menulist(mode)
debug('set_menulist; '+str(label_list)) debug('set_menulist; ' + str(label_list))
right_buttons_count = len(label_list) right_buttons_count = len(label_list)
button_num_list = range(1, right_buttons_count+1) button_num_list = range(1, right_buttons_count + 1)
debug('set_menulist button_num_list: '+str(button_num_list)) debug('set_menulist button_num_list: ' + str(button_num_list))
for index in button_num_list: for index in button_num_list:
button = getattr(self, "button_right" + str(index)) button = getattr(self, "button_right" + str(index))
@ -557,11 +565,11 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
def setlabel(self, button, label): def setlabel(self, button, label):
label = label.decode('utf-8') label = label.decode('utf-8')
log(label+' '+str(len(label))) debug('setlabel: ' + label + ' ' + str(len(label)))
if len(label) > 10: if len(label) > 10:
spaces = label.count(' ') spaces = label.count(' ')
log('spaces=' + str(spaces)) debug('setlabel spaces=' + str(spaces))
if spaces == 0: if spaces == 0:
words = [label[:10], label[10:]] words = [label[:10], label[10:]]
label = '%s-\r\n%s' % (words[0], words[1]) label = '%s-\r\n%s' % (words[0], words[1])
@ -579,38 +587,45 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
button.setLabel(label) button.setLabel(label)
def right_press1(self): def right_press1(self):
item = self.listing.getSelectedItem() item = self.listing.getSelectedItem()
params = json.loads(item.getfilename()) params = json.loads(item.getfilename())
log('params ' + str(params))
mode = params.get('mode') mode = params.get('mode')
filename = params.get('filename') filename = params.get('filename')
hash = params.get('hash')
ind = params.get('ind')
tdir = params.get('tdir') tdir = params.get('tdir')
self.listing.reset() self.listing.reset()
if mode == 'search_item': if mode in ['search_item', 'torrent_subfolder']:
self.open_torrent(filename)
elif mode == 'torrent_subfolder':
self.open_torrent(filename, tdir) self.open_torrent(filename, tdir)
elif mode == 'torrent_moveup': elif mode == 'torrent_moveup':
self.search() self.search()
self.setFocus(self.listing) self.setFocus(self.listing)
elif mode == 'torrent_play': elif mode == 'torrent_play':
action = 'playTorrent' url = self.form_link('playTorrent', params)
url = self.form_link(action, params)
xbmc.executebuiltin('xbmc.RunPlugin("%s")' % (url)) xbmc.executebuiltin('xbmc.RunPlugin("%s")' % (url))
self.close() self.close()
elif mode == 'history_search_item': elif mode == 'history_search_item':
addtime = params.get('addtime') addtime = params.get('addtime')
self.input_search.setText(filename) self.input_search.setText(filename)
self.search(addtime) self.search(addtime)
elif mode == 'browser_item': elif mode in ['browser_item', 'browser_subfolder']:
self.browser(params) 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): def right_press2(self):
item = self.listing.getSelectedItem() item = self.listing.getSelectedItem()
params = json.loads(item.getfilename()) params = json.loads(item.getfilename())
mode = params.get('mode') mode = params.get('mode')
filename = params.get('filename') filename = params.get('filename')
hash = params.get('hash')
ind = params.get('ind')
tdir = params.get('tdir')
if mode == 'torrent_play': if mode == 'torrent_play':
action = 'downloadFilesList' action = 'downloadFilesList'
link = {'ind': str(params.get('url'))} link = {'ind': str(params.get('url'))}
@ -624,12 +639,21 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
elif mode == 'history_search_item': elif mode == 'history_search_item':
self.input_search.setText(filename) self.input_search.setText(filename)
self.setFocus(self.input_search) 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): def right_press3(self):
item = self.listing.getSelectedItem() item = self.listing.getSelectedItem()
params = json.loads(item.getfilename()) params = json.loads(item.getfilename())
mode = params.get('mode') mode = params.get('mode')
filename = params.get('filename') filename = params.get('filename')
hash = params.get('hash')
ind = params.get('ind')
tdir = params.get('tdir')
if mode == 'torrent_play': if mode == 'torrent_play':
action = 'downloadLibtorrent' action = 'downloadLibtorrent'
link = {'ind': str(params.get('url'))} link = {'ind': str(params.get('url'))}
@ -643,35 +667,68 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
elif mode == 'history_search_item': elif mode == 'history_search_item':
params['title'] = params.get('filename') params['title'] = params.get('filename')
self.controlCenter(params) 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): def right_press4(self):
item = self.listing.getSelectedItem() item = self.listing.getSelectedItem()
params = json.loads(item.getfilename()) params = json.loads(item.getfilename())
mode = params.get('mode') mode = params.get('mode')
filename = params.get('filename') filename = params.get('filename')
hash = params.get('hash')
ind = params.get('ind')
tdir = params.get('tdir')
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')
self.history_action('fav', addtime, fav) self.history_action('fav', addtime, fav)
else: elif mode == 'search_item':
cleanlabel = re.sub('\[[^\]]*\]', '', item.getLabel()) cleanlabel = re.sub('\[[^\]]*\]', '', item.getLabel())
ttl, yr = xbmc.getCleanMovieTitle(cleanlabel) ttl, yr = xbmc.getCleanMovieTitle(cleanlabel)
infoW = InfoWindow(ttl, yr) infoW = InfoWindow(ttl, yr)
infoW.doModal() infoW.doModal()
del infoW 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): def right_press5(self):
item = self.listing.getSelectedItem() item = self.listing.getSelectedItem()
params = json.loads(item.getfilename()) params = json.loads(item.getfilename())
mode = params.get('mode') mode = params.get('mode')
filename = params.get('filename') filename = params.get('filename')
hash = params.get('hash')
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')
self.history_action('delete', addtime, fav) self.history_action('delete', addtime, fav)
elif mode == 'browser_item':
self.browser_action(hash, '3')
def right_press6(self): 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): def localize(self, string):
try: try:
@ -679,7 +736,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
except: except:
return string return string
def drawItem(self, title, params, 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}
@ -706,20 +763,18 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
import controlcenter import controlcenter
controlcenter.main() controlcenter.main()
def reconnect(self, event, callabel): def reconnect(self, event, callable):
self.disconnect(event) self.disconnect(event)
self.connect(event, callabel) self.connect(event, callable)
def version_check(self): def version_check(self):
return False if int(xbmc.getInfoLabel( "System.BuildVersion" )[:2]) < 17 else True return False if int(xbmc.getInfoLabel("System.BuildVersion")[:2]) < 17 else True
def onFocus(self): def onFocus(self):
log(str(self.getFocusId())) log(str(self.getFocusId()))
class InfoWindow(pyxbmct.AddonDialogWindow): class InfoWindow(pyxbmct.AddonDialogWindow):
def __init__(self, title="", year=""): def __init__(self, title="", year=""):
super(InfoWindow, self).__init__(title) super(InfoWindow, self).__init__(title)
self.title = title self.title = title
@ -727,12 +782,11 @@ class InfoWindow(pyxbmct.AddonDialogWindow):
self.setGeometry(600, 600, 3, 3) self.setGeometry(600, 600, 3, 3)
self.set_controls() self.set_controls()
self.connect_controls() self.connect_controls()
#self.set_navigation() # self.set_navigation()
def set_controls(self): def set_controls(self):
#pyxbmct.AddonWindow().setImage(__root__ + '/resources/skins/Default/media/ConfluenceDialogBack.png') # pyxbmct.AddonWindow().setImage(__root__ + '/resources/skins/Default/media/ConfluenceDialogBack.png')
#self.placeControl(self.background, 0, 0, rowspan=3, columnspan=2) # self.placeControl(self.background, 0, 0, rowspan=3, columnspan=2)
self.listing = pyxbmct.List(_imageWidth=30, _imageHeight=30, _itemTextXOffset=1, self.listing = pyxbmct.List(_imageWidth=30, _imageHeight=30, _itemTextXOffset=1,
_itemTextYOffset=0, _itemHeight=30, _space=0, _alignmentY=0) _itemTextYOffset=0, _itemHeight=30, _space=0, _alignmentY=0)
self.placeControl(self.listing, 0, 1, 2, 2) self.placeControl(self.listing, 0, 1, 2, 2)
@ -741,9 +795,8 @@ class InfoWindow(pyxbmct.AddonDialogWindow):
self.plot = pyxbmct.TextBox() self.plot = pyxbmct.TextBox()
self.placeControl(self.plot, 2, 0, 1, columnspan=3) self.placeControl(self.plot, 2, 0, 1, columnspan=3)
self.plot.autoScroll(1000, 1000, 1000) self.plot.autoScroll(1000, 1000, 1000)
#self.button_search = pyxbmct.Button("Search") # self.button_search = pyxbmct.Button("Search")
#self.placeControl(self.button_search, 0, 5, 1, 2) # self.placeControl(self.button_search, 0, 5, 1, 2)
def connect_controls(self): def connect_controls(self):
from resources.scrapers.scrapers import Scrapers from resources.scrapers.scrapers import Scrapers
@ -757,26 +810,27 @@ class InfoWindow(pyxbmct.AddonDialogWindow):
""" """
self.connect(pyxbmct.ACTION_NAV_BACK, self.close) self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
self.connect(pyxbmct.ACTION_PREVIOUS_MENU, self.close) self.connect(pyxbmct.ACTION_PREVIOUS_MENU, self.close)
self.listing.addItem ("Title: %s" % meta.get('title')) self.listing.addItem("Title: %s" % meta.get('title'))
self.listing.addItem ("genre: %s" % meta.get('genre')) self.listing.addItem("genre: %s" % meta.get('genre'))
self.listing.addItem ("rating: %s" % meta.get('rating')) self.listing.addItem("rating: %s" % meta.get('rating'))
self.listing.addItem ("year: %s" % meta.get('year')) self.listing.addItem("year: %s" % meta.get('year'))
self.listing.addItem ("runtime: %sm" % meta.get('runtime')) self.listing.addItem("runtime: %sm" % meta.get('runtime'))
if meta.get('thumbnail'): if meta.get('thumbnail'):
self.logoimg.setImage (meta.get('thumbnail')) self.logoimg.setImage(meta.get('thumbnail'))
self.plot.setText(meta.get('plot')) self.plot.setText(meta.get('plot'))
def log(msg): def log(msg):
try: try:
xbmc.log("### [%s]: %s" % (__plugin__,msg,), level=xbmc.LOGNOTICE ) xbmc.log("### [%s]: %s" % (__plugin__, msg,), level=xbmc.LOGNOTICE)
except UnicodeEncodeError: except UnicodeEncodeError:
xbmc.log("### [%s]: %s" % (__plugin__,msg.encode("utf-8", "ignore"),), level=xbmc.LOGNOTICE ) xbmc.log("### [%s]: %s" % (__plugin__, msg.encode("utf-8", "ignore"),), level=xbmc.LOGNOTICE)
except: except:
xbmc.log("### [%s]: %s" % (__plugin__,'ERROR LOG',), level=xbmc.LOGNOTICE ) xbmc.log("### [%s]: %s" % (__plugin__, 'ERROR LOG',), level=xbmc.LOGNOTICE)
def titleMake(seeds, leechers, size, title): def titleMake(seeds, leechers, size, title):
# AARRGGBB
#AARRGGBB
clGreen = '[COLOR FF008000]%s[/COLOR]' clGreen = '[COLOR FF008000]%s[/COLOR]'
clDodgerblue = '[COLOR FF1E90FF]%s[/COLOR]' clDodgerblue = '[COLOR FF1E90FF]%s[/COLOR]'
clDimgray = '[COLOR FF999999]%s[/COLOR]' clDimgray = '[COLOR FF999999]%s[/COLOR]'
@ -794,8 +848,8 @@ def titleMake(seeds, leechers, size, title):
def main(params={}): def main(params={}):
dialog = SearchWindow("Torrenter Search Window", params) 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__':