sw release

pull/15/head
DiMartinoXBMC 2017-01-06 00:22:10 +03:00
parent 9622dc9f67
commit 94e02d116b
13 changed files with 2234 additions and 1417 deletions

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@ from StringIO import StringIO
import zlib
from functions import file_decode, file_encode
from functions import magnet_alert, log, debug
from functions import magnet_alert, log, loadsw_onstop
import xbmcvfs
@ -81,6 +81,7 @@ class AceStream:
def __exit__(self):
self.TSplayer.end()
loadsw_onstop() # Reload Search Window
def play_url_ind(self, ind, label, icon):
self.TSplayer.play_url_ind(int(ind), label, str(icon), '')

View File

@ -30,7 +30,7 @@ import xbmcgui
import xbmcvfs
import xbmcaddon
import Localization
from functions import localize_path, isSubtitle, DownloadDB, log, debug, is_writable, unquote, file_url
from functions import localize_path, isSubtitle, loadsw_onstop, is_writable, file_url
import os
@ -326,6 +326,8 @@ class AnteoPlayer(xbmc.Player):
xbmc.Player().stop()
loadsw_onstop() # Reload Search Window
if '1' != self.__settings__.getSetting("keep_files") and 'Saved Files' not in self.userStorageDirectory:
xbmc.sleep(1000)
clearStorage(self.userStorageDirectory)

175
Core.py
View File

@ -39,6 +39,7 @@ class Core:
language = {0: 'en', 1: 'ru', 2: 'uk', 3: 'he', 4: 'hu'}.get(int(__settings__.getSetting("language")))
scrapperDB_ver = {'en':'1.1', 'ru':'1.3', 'he':'1.3'}
torrent_info_style = int(__settings__.getSetting('torrent_info_style'))
searchwindowmode = int(__settings__.getSetting('searchwindowmode'))
log('SYS ARGV: ' + str(sys.argv))
@ -53,7 +54,8 @@ class Core:
def sectionMenu(self):
if self.__settings__.getSetting('plugin_name') != self.__plugin__:
#Every update run
first_run_250()
first_run_260()
self.__settings__.setSetting('first_run_260', 'True')
self.__settings__.setSetting('plugin_name', self.__plugin__)
#check_network_advancedsettings()
check_download_dir()
@ -65,52 +67,100 @@ class Core:
contextMenu = [(self.localize('Search Control Window'),
'xbmc.RunScript(%s,)' % os.path.join(ROOT, 'controlcenter.py'))]
self.drawItem('< %s >' % self.localize('Search Window') + ' (BETA)', 'searchWindow',
image=self.ROOT + '/icons/kodi.png', isFolder=False)
#Search Window
if self.searchwindowmode < 3:
self.drawItem('< %s >' % self.localize('Search Window'), 'searchWindow',
image=self.ROOT + '/icons/kodi.png', isFolder=False)
if self.history_bool:
HistorycontextMenu=[]
#History
if self.history_bool and self.searchwindowmode > 0:
HistorycontextMenu = []
HistorycontextMenu.extend(contextMenu)
HistorycontextMenu.append(
(self.localize('Clear %s') % self.localize('Search History'), ListString % ('History', 'clear', 'addtime', '')))
self.drawItem('< %s >' % self.localize('Search History'), 'History',
image=self.ROOT + '/icons/history2.png', contextMenu=HistorycontextMenu, replaceMenu=False)
self.drawItem('< %s >' % self.localize('Search'), 'search', image=self.ROOT + '/icons/search.png', )
(self.localize('Clear %s') % self.localize('Search History'),
ListString % ('History', 'clear', 'addtime', '')))
if self.searchwindowmode == 1:
self.drawItem('< %s >' % self.localize('Search History'), 'swHistory',
image=self.ROOT + '/icons/history2.png', contextMenu=HistorycontextMenu, replaceMenu=False)
else:
self.drawItem('< %s >' % self.localize('Search History'), 'History',
image=self.ROOT + '/icons/history2.png', contextMenu=HistorycontextMenu, replaceMenu=False)
#Search
if self.searchwindowmode == 1:
self.drawItem('< %s >' % self.localize('Search'), 'swsearch', image=self.ROOT + '/icons/search.png',)
elif self.searchwindowmode > 1:
self.drawItem('< %s >' % self.localize('Search'), 'search', image=self.ROOT + '/icons/search.png', )
#Media
CLcontextMenu=[]
CLcontextMenu.extend(contextMenu)
CLcontextMenu.append((self.localize('Reset All Cache DBs'),
ListString % ('full_download', '', 'url', json.dumps({'action': 'delete'}))))
self.drawItem('< %s >' % self.localize('Content Lists'), 'openContent', image=self.ROOT + '/icons/media.png',
contextMenu=CLcontextMenu, replaceMenu=False)
#DL Status
DLScontextMenu=[(self.localize('Start All'), ListString % ('DownloadStatus', 'startall', 'addtime', '')),
(self.localize('Stop All'), ListString % ('DownloadStatus', 'stopall', 'addtime', '')),]
DLScontextMenu.append(
(self.localize('Clear %s') % self.localize('Download Status'), ListString % ('DownloadStatus', 'clear', 'addtime', '')))
DLScontextMenu.extend(contextMenu)
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/' + getTorrentClientIcon())
if self.history_bool:
if self.searchwindowmode == 1:
self.drawItem('< %s >' % self.localize('Download Status'), 'swDownloadStatus',
image=self.ROOT + '/icons/download.png',
contextMenu=DLScontextMenu, replaceMenu=False)
elif self.searchwindowmode > 1:
self.drawItem('< %s >' % self.localize('Download Status'), 'DownloadStatus',
image=self.ROOT + '/icons/download.png',
contextMenu=DLScontextMenu, replaceMenu=False)
#Torrent-client
if self.searchwindowmode == 1:
self.drawItem('< %s >' % self.localize('Torrent-client Browser'), 'swuTorrentBrowser',
image=self.ROOT + '/icons/' + getTorrentClientIcon())
elif self.searchwindowmode > 1:
self.drawItem('< %s >' % self.localize('Torrent-client Browser'), 'uTorrentBrowser',
image=self.ROOT + '/icons/' + getTorrentClientIcon())
#Watched
if self.history_bool and self.searchwindowmode > 0:
WatchedHistorycontextMenu=[]
WatchedHistorycontextMenu.extend(contextMenu)
WatchedHistorycontextMenu.append(
(self.localize('Clear %s') % self.localize('Watched History'), ListString % ('WatchedHistory', 'clear', 'addtime', '')))
self.drawItem('< %s >' % self.localize('Watched History'), 'WatchedHistory',
image=self.ROOT + '/icons/watched.png', contextMenu=WatchedHistorycontextMenu, replaceMenu=False)
if self.searchwindowmode == 1:
self.drawItem('< %s >' % self.localize('Watched History'), 'swWatchedHistory',
image=self.ROOT + '/icons/watched.png', contextMenu=WatchedHistorycontextMenu,
replaceMenu=False)
else:
self.drawItem('< %s >' % self.localize('Watched History'), 'WatchedHistory',
image=self.ROOT + '/icons/watched.png', contextMenu=WatchedHistorycontextMenu,
replaceMenu=False)
#Torr player
self.drawItem('< %s >' % self.localize('.torrent Player'), 'torrentPlayer',
image=self.ROOT + '/icons/torrentPlayer.png')
image=self.ROOT + '/icons/torrentPlayer.png', isFolder = False)
#Search Control Window
self.drawItem('< %s >' % self.localize('Search Control Window'), 'controlCenter',
image=self.ROOT + '/icons/settings.png', isFolder=False)
#Magnet player
self.drawItem('< %s >' % self.localize('Magnet-link Player'), 'magentPlayer',
image=self.ROOT + '/icons/magnet.png')
image=self.ROOT + '/icons/magnet.png', isFolder = False)
#Debug
if self.debug:
self.drawItem('full_download', 'full_download', image=self.ROOT + '/icons/magnet.png')
self.drawItem('test', 'test', image=self.ROOT + '/icons/magnet.png', isFolder=False)
#Clear storage
if '0' != self.__settings__.getSetting("keep_files"):
self.drawItem('< %s >' % self.localize('Clear Storage'), 'clearStorage', isFolder=True,
image=self.ROOT + '/icons/clear.png')
view_style('sectionMenu')
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
@ -243,54 +293,43 @@ class Core:
lockView('wide')
def test(self, params={}):
#from Anteoloader import AnteoPlayer
#from python_libtorrent import get_libtorrent
#self.lt=get_libtorrent()
#self.torrentFile='D:\\test.torrent'
#self.session = self.lt.session()
#e=self.lt.bdecode(xbmcvfs.File(self.torrentFile,'rb').read())
#self.torrentFileInfo = self.lt.torrent_info(e)
#torrent_info={'ti': self.torrentFileInfo,
# 'save_path': self.userStorageDirectory,
# 'flags': 0x300,
# #'storage_mode': self.lt.storage_mode_t(1),
# 'paused': False,
# #'auto_managed': False,
# #'duplicate_is_error': True
# }
#self.torrentHandle = self.session.add_torrent(torrent_info)
#log(self.torrentHandle.torrent_file())
#self.session.remove_torrent(self.torrentHandle)
import searchwindow
params = {'mode': 'file_browser', 'path':'D:\\', 'tdir':'D:\\FRAPS\\'}
searchwindow.main(params)
#params['url']='0'
#if not xbmcvfs.exists(torrentUrl):
# action = xbmcgui.Dialog()
# torrentUrl = action.browse(1, self.localize('Choose .torrent in video library'), 'video', '.torrent')
#if torrentUrl and xbmcvfs.exists(torrentUrl):
# if 0 != len(torrentUrl):
# self.Downloader = Downloader.Torrent(self.userStorageDirectory, torrentUrl)
# else:
# log(self.__plugin__ + " Unexpected access to method Anteoloader() without torrent content")
#if self.Downloader:
# x=self.Downloader.getContentList()
# print str(x)
# xbmc.sleep(1000)
# self.Downloader.__exit__()
#self.Player = AnteoPlayer(userStorageDirectory=self.userStorageDirectory, torrentUrl=torrentUrl, params=params)
def swHistory(self, params={}):
import searchwindow
params = {'mode': 'history'}
searchwindow.main(params)
def swDownloadStatus(self, params={}):
import searchwindow
params = {'mode': 'downloadstatus'}
searchwindow.main(params)
def swuTorrentBrowser(self, params={}):
import searchwindow
params = {'mode': 'browser'}
searchwindow.main(params)
def swWatchedHistory(self, params={}):
import searchwindow
params = {'mode': 'watched'}
searchwindow.main(params)
def swsearch(self, params={}):
if len(Searchers().get_active())<1:
noActiveSerachers()
return
keyboard = xbmc.Keyboard('', self.localize('Search Phrase'))
keyboard.doModal()
params["query"] = keyboard.getText()
if keyboard.isConfirmed():
params["mode"] = 'search'
import searchwindow
searchwindow.main(params)
#xbmcgui.Dialog().ok('Dam Son!','Now send this shit to DiMartino')
from resources.proxy import antizapret
filename = os.path.join(tempdir(),"antizapret.pac_config")
import shelve
from contextlib import contextmanager, closing
with closing(shelve.open(filename, writeback=True)) as d:
import time
log(str(d))
log(str(time.time()))
log(str((time.time() - d["created_at"])))
ttl = 24*3600
if ttl > 0 and (time.time() - d["created_at"]) > ttl:
log('xxx')
def DownloadStatus(self, params={}):
db = DownloadDB()
@ -1382,7 +1421,6 @@ class Core:
params["url"] = urllib.quote_plus(unescape(urllib.unquote_plus(query)))
else:
params["url"] = urllib.quote_plus(unescape(urllib.unquote_plus(defaultKeyword)))
#print str(params)
self.torrentPlayer(params)
def torrentPlayer(self, params={}):
@ -1403,7 +1441,12 @@ class Core:
% ('torrentPlayer', url))
return
if url:
self.openTorrent(params)
if self.searchwindowmode > 1:
self.openTorrent(params)
else:
import searchwindow
params = {'mode': 'open_torrent', 'link': url}
searchwindow.main(params)
def userStorage(self, params):
save=False

View File

@ -30,7 +30,7 @@ import xbmcvfs
import xbmcaddon
import xbmcplugin
import Localization
from functions import encode_msg, isSubtitle, is_writable, file_url, localize_path
from functions import loadsw_onstop, isSubtitle, is_writable, file_url, localize_path
import os
@ -301,6 +301,8 @@ class InposPlayer(xbmc.Player):
xbmc.Player().stop()
loadsw_onstop() # Reload Search Window
if '1' != self.__settings__.getSetting("keep_files") and 'Saved Files' not in self.userStorageDirectory:
xbmc.sleep(1000)
clearStorage(self.userStorageDirectory)

View File

@ -809,6 +809,8 @@ def localize(text):
'Play (from start)':'Lejátszás (az elejétől)',
},
'ru': {
'is recommended for Kodi 17 users and now out of beta.': 'рекомендовано пользователям Kodi 17 и вышло из беты.',
'You can disable it usage in Settings.':'Его можно отключить в настройках плагина.',
'Move Up': 'Вверх',
'Torrenter Search Window': 'Окно Поиска Torrenter',
'Cancel': 'Отмена',

View File

@ -30,7 +30,7 @@ import Downloader
import xbmcgui
import xbmcvfs
import Localization
from functions import calculate, showMessage, clearStorage, WatchedHistoryDB, DownloadDB, get_ids_video, log, debug, foldername, ensure_str
from functions import calculate, showMessage, clearStorage, WatchedHistoryDB, DownloadDB, get_ids_video, log, debug, foldername, ensure_str, loadsw_onstop
ROOT = sys.modules["__main__"].__root__
RESOURCES_PATH = os.path.join(ROOT, 'resources')
@ -184,6 +184,8 @@ class TorrentPlayer(xbmc.Player):
debug('************************************* NO! break')
break
loadsw_onstop() # Reload Search Window
self.torrent.stopSession()
self.torrent.threadComplete = True
self.torrent.checkThread()

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.torrenter" name="Torrenter" version="2.5.6" provider-name="DiMartino">
<addon id="plugin.video.torrenter" name="Torrenter" version="2.6.0" provider-name="DiMartino">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.libtorrent"/>

View File

@ -1,5 +1,8 @@
English changelog at http://bit.ly/1MfSVUP
[B]Version 2.5.6[/B]
[+] Списки Медиа: Добавлен RuTorOrg
[B]Version 2.5.5[/B]
[+] Control Center: Исправлена работа выбора трекеров для определенного запроса
[+] Торрент-клиент: При скачивании одного файла торрент-клиентом теперь автоматически выбирается раздача

View File

@ -1870,6 +1870,18 @@ def first_run_250():
#ok = xbmcgui.Dialog().ok('< %s >' % (Localization.localize('Torrenter Update ') + '2.4.2'),
# Localization.localize('Torrent2HTTP enabled! Can be changed in Settings.'))
def first_run_260():
if not __settings__.getSetting('first_run_260') == 'True':
yes=xbmcgui.Dialog().yesno('< %s >' % (Localization.localize('Torrenter Update ') + '2.6.0'),
Localization.localize('Torrenter Search Window')+' '
+Localization.localize('is recommended for Kodi 17 users and now out of beta.')
+Localization.localize('You can disable it usage in Settings.'),
Localization.localize('Would you like to try it?'),)
if yes:
import searchwindow
searchwindow.main()
def seeking_warning(seek):
if __settings__.getSetting('torrent_player')!='1':
seek_point = '%02d:%02d:%02d' % ((seek / (60*60)), (seek / 60) % 60, seek % 60)
@ -2266,3 +2278,9 @@ def get_item():
item.setInfo(type='Video', infoLabels=infoLabels)
return item
def loadsw_onstop():
if __settings__.getSetting('loadsw_onstop') == 'true':
import searchwindow
params = {'mode': 'load'}
searchwindow.main(params)

View File

@ -79,6 +79,12 @@
<string id="30103">Advanced</string>
<string id="30104">Torrent-client</string>
<string id="30105">Hentai (fine-tuning)</string>
<string id="30106">Search Window Mode</string>
<string id="30107">Enabled, hide old style</string>
<string id="30108">Enabled, replace old style</string>
<string id="30109">Enabled, optional</string>
<string id="30110">Disabled</string>
<string id="30111">Search Window Transparent Background</string>
<string id="50301">Save path</string>
<string id="50302">Call dialog</string>
<string id="50303">Default</string>

View File

@ -6,6 +6,7 @@
<setting id="sort_search" type="enum" label="30061" default="0" lvalues="30062|30063|30064"/>
<setting id="skin_optimization" type="enum" label="30002" default="1" lvalues="30003|30018|30017|30016|30019|30066|30067|30071|30076"/>
<setting id="open_option" type="enum" label="30034" default="0" lvalues="30035|30036|30037|30038"/>
<setting id="searchwindowmode" type="enum" label="30106" default="1" lvalues="30107|30108|30109|30110"/>
</category>
<category label="30103">
<setting id="timeout" type="enum" lvalues="30026|30027|30028" label="30025" default="1"/>
@ -72,5 +73,6 @@
<setting id="enable_dht" type="bool" label="30070" default="true" visible="!eq(-8,1)"/>
<setting id="append_filesize" type="bool" label="30069" default="true"/>
<setting id="torrent_info_style" type="enum" label="30072" default="0" lvalues="30073|30074|30075"/>
<setting id="sw_transparent_back" type="bool" label="30111" default="false"/>
</category>
</settings>

View File

@ -21,7 +21,7 @@ import pyxbmct.addonwindow as pyxbmct
import xbmcaddon
import xbmcgui
import xbmcvfs
import json
import xbmc
from functions import *
@ -49,7 +49,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
last_top_button = None
last_right_button = None
last_listing_mode = None
route = None
route = {}
count = 0
navi_right_menu = []
navi_top_menu = []
@ -60,6 +60,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
def __init__(self, params = None):
log('SearchWindow init params: '+str(params))
super(SearchWindow, self).__init__(self.localize('Torrenter Search Window'))
__settings__.setSetting('loadsw_onstop', 'false')
self.setGeometry(1280, 720, 9, 16)
self.set_navi()
self.set_controls()
@ -69,9 +70,20 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.navi_load()
elif params.get('mode') == 'search':
self.search(params)
elif params.get('mode') == 'history':
self.history()
elif params.get('mode') == 'downloadstatus':
self.downloadstatus()
elif params.get('mode') == 'browser':
self.browser()
elif params.get('mode') == 'watched':
self.watched()
elif params.get('mode') == 'open_torrent':
self.open_torrent(params)
elif params.get('mode') == 'file_browser':
self.file_browser(params)
else:
self.navi_load()
#self.history()
def set_navi(self):
self.navi = {
@ -87,11 +99,9 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
}
def set_controls(self):
if not __settings__.getSetting('debug') == 'true':
if not __settings__.getSetting('sw_transparent_back') == 'true':
self.background.setImage('%s/icons/%s.png' % (__root__, 'ContentPanel'))
#self.background.setImage('%s/icons/%s.png' % (__root__, 'ContentPanel'))
# Top menu
self.button_downloadstatus = pyxbmct.Button("",
focusTexture=self.icon % 'fdownloadstatus',
@ -187,20 +197,20 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
('WindowClose', 'effect=fade start=100 end=0 time=500',)])
def navi_back(self):
log('navi_back init')
debug('navi_back init')
self.navi['route'].pop(-1)
self.navi_restore()
def navi_route_reset(self):
log('navi_route_reset init')
debug('navi_route_reset init')
self.navi['route'] = [self.navi['route'][0]]
def navi_route_pop(self):
log('navi_route_pop init')
debug('navi_route_pop init')
self.navi['route'].pop(-1)
def navi_restore(self):
log('navi_restore init')
debug('navi_restore init')
self.route = self.navi['route'].pop(-1)
action = getattr(self, self.route['mode'])
try:
@ -211,17 +221,17 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.set_focus(self.route['mode'])
log('self.route[last_listing_item]: ' + str(self.route['last_listing_item']))
debug('self.route[last_listing_item]: ' + str(self.route['last_listing_item']))
if self.route['last_listing_item'] > 0:
self.listing.selectItem(self.route['last_listing_item'])
except:
import traceback
log('navi_restore ERROR '+traceback.format_exc())
debug('navi_restore ERROR '+traceback.format_exc())
self.set_navi()
self.history()
def navi_load(self):
log('navi_load init')
debug('navi_load init')
__tmppath__ = os.path.join(xbmc.translatePath('special://temp'), 'xbmcup', 'plugin.video.torrenter')
if not xbmcvfs.exists(__tmppath__):
xbmcvfs.mkdirs(__tmppath__)
@ -230,14 +240,15 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
navi = read.read()
read.close()
log('navi_load navi: '+str(navi))
debug('navi_load navi: '+str(navi))
log('navi_load navi: ' + str(navi['route']))
if navi and len(navi) > 0:
self.navi = json.loads(navi)
self.navi_restore()
def navi_save(self, mode = None):
log('navi_save init')
debug('navi_save init')
if mode: self.set_focus(mode)
@ -252,23 +263,23 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
write.close()
def navi_update(self):
log('navi_update init')
debug('navi_update init')
try:
focused_control = self.getFocus()
except:
focused_control = None
debug('start navi_update' + str(focused_control))
log(str(self.navi['route']))
debug(str(self.navi['route']))
if focused_control == self.listing:
item_index = self.listing.getSelectedPosition()
self.navi['route'][-1]['last_listing_item'] = item_index
log('self.listing getSelectedPosition ' + str(item_index))
debug('self.listing getSelectedPosition ' + str(item_index))
item = self.listing.getSelectedItem()
params = json.loads(item.getfilename())
mode = params.get('mode')
log('navi_update:' + str(mode))
debug('navi_update:' + str(mode))
if self.last_listing_mode != mode:
self.last_listing_mode = mode
debug('set_menulist navi_update:' + str(mode))
@ -284,17 +295,17 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.update_navigation()
def navi_route(self, mode, params = {}, right_menu = None):
log('navi_route init')
debug('navi_route init')
try:
focused_control = self.getFocus()
except:
focused_control = None
if focused_control in self.navi_top_menu:
log('focused_control in self.navi[\'top_menu\']')
debug('focused_control in self.navi[\'top_menu\']')
self.navi_route_reset()
log('***** self.navi[\'route\'].append *****' + str(mode) + str(params))
debug('***** self.navi[\'route\'].append *****' + str(mode) + str(params))
self.navi['route'].append({'mode': mode,
'params': params,
@ -304,8 +315,11 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.listing.reset()
def set_focus(self, mode):
if mode and not self.listing.size() and hasattr(self, "button_" + mode):
self.setFocus(getattr(self, "button_" + mode))
if not self.listing.size():
if mode and hasattr(self, "button_" + mode):
self.setFocus(getattr(self, "button_" + mode))
else:
self.setFocus(self.input_search)
else:
self.setFocus(self.listing)
@ -316,7 +330,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
get = params.get
addtime = get('addtime')
query = get('query')
route = self.navi['route'][-1]
self.route = self.navi['route'][-1]
if query:
self.input_search.setText(query)
@ -331,10 +345,10 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
searchersList = get_searchersList(addtime)
# cache
route['params']['query'] = query
self.route['params']['query'] = query
if (query != self.navi['last_query'] or self.navi['searchersList'] != searchersList) and len(query) > 0:
self.navi['filesList'] = get_filesList(query, searchersList, addtime)
route['params']['addtime'] = addtime
self.route['params']['addtime'] = addtime
self.navi['last_addtime'] = addtime
self.navi['searchersList'] = searchersList
self.navi['last_query'] = query
@ -449,6 +463,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
__settings__.setSetting("lastTorrent", torrent.saveTorrent(url))
xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.torrenter/?action=playTorrent&url='+str(ind)+'&seek='+str(seek)+'")')
__settings__.setSetting('loadsw_onstop', 'true')
self.close()
if action == 'clear':
@ -574,7 +589,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
filename = data[0]
break
filename = os.path.join(folder, filename)
xbmc.executebuiltin('xbmc.PlayMedia("' + filename.encode('utf-8') + '")')
self.file_play(filename)
elif tdir and action == 'copy':
path = os.path.join(folder, tdir)
dirs, files = xbmcvfs.listdir(path)
@ -744,13 +759,11 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
path = encode_msg(path)
tdir = encode_msg(tdir)
if tdir == os.path.dirname(path):
if mode == 'moveup' and tdir == os.path.dirname(path):
self.downloadstatus()
elif mode == 'file':
xbmc.Player().play(localize_path(tdir))
self.close()
swPlayer().play(localize_path(tdir))
else:
self.drawItem('..', {'mode': 'moveup', 'path': path,
'tdir': os.path.dirname(tdir)}, image = 'DefaultFolderBack.png', isFolder=True)
@ -767,6 +780,10 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.navi_save('file_browser')
def file_play(self, file):
self.close()
swPlayer().play(item = file)
def open_torrent(self, params):
self.navi_route('open_torrent', params)
@ -1013,6 +1030,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
if index == 1:
url = self.form_link('playTorrent', params)
xbmc.executebuiltin('xbmc.RunPlugin("%s")' % (url))
__settings__.setSetting('loadsw_onstop', 'true')
self.close()
elif index == 2:
action = 'downloadFilesList'
@ -1066,9 +1084,6 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
elif index == 3: action = '0'
self.browser_action(hash, action, tdir = tdir, ind = ind)
if index == 1:
self.close()
elif mode in ['downloadstatus', 'downloadstatus_subfolder', 'downloadstatus_file']:
if index == 1: action = 'play'
elif index == 2: action = 'start'
@ -1210,6 +1225,24 @@ def main(params = None):
del dialog # You need to delete your instance when it is no longer needed
# because underlying xbmcgui classes are not grabage-collected.
class swPlayer(xbmc.Player):
def play(self, item):
xbmc.Player().play(item = item)
i = 0
while not self.isPlaying() and i < 100:
i += 1
xbmc.sleep(500)
log('swPlayer not started '+str(i))
if i > 99:
return False
else:
while not xbmc.abortRequested and self.isPlaying():
xbmc.sleep(500)
log('swPlayer playing')
params = {'mode': 'load'}
main(params)
if __name__ == '__main__':
try: