fixes
parent
7c11ef619a
commit
3eb68a166a
16
Core.py
16
Core.py
|
@ -1554,10 +1554,13 @@ class Core:
|
||||||
searcher = classMatch.group(1)
|
searcher = classMatch.group(1)
|
||||||
url = Searchers().downloadWithSearcher(classMatch.group(2), searcher)
|
url = Searchers().downloadWithSearcher(classMatch.group(2), searcher)
|
||||||
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
|
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
|
||||||
self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url))
|
filename = torrent.saveTorrent(url)
|
||||||
|
self.__settings__.setSetting("lastTorrent", filename)
|
||||||
if fileIndex == None: fileIndex = chooseFile(torrent.getContentList())
|
if fileIndex == None: fileIndex = chooseFile(torrent.getContentList())
|
||||||
if fileIndex:
|
if fileIndex:
|
||||||
xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.torrenter/?action=playTorrent&url='+fileIndex+'")')
|
params = {'url': fileIndex, 'filename': filename}
|
||||||
|
self.playTorrent(params)
|
||||||
|
#xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.torrenter/?action=playTorrent&url=%s' % (fileIndex))
|
||||||
|
|
||||||
def openTorrent(self, params={}):
|
def openTorrent(self, params={}):
|
||||||
get = params.get
|
get = params.get
|
||||||
|
@ -1576,7 +1579,8 @@ class Core:
|
||||||
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
|
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
|
||||||
if not torrent: torrent = Downloader.Torrent(self.userStorageDirectory,
|
if not torrent: torrent = Downloader.Torrent(self.userStorageDirectory,
|
||||||
torrentFilesDirectory=self.torrentFilesDirectory)
|
torrentFilesDirectory=self.torrentFilesDirectory)
|
||||||
self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url))
|
filename = torrent.saveTorrent(url)
|
||||||
|
self.__settings__.setSetting("lastTorrent", filename)
|
||||||
|
|
||||||
append_filesize = self.__settings__.getSetting("append_filesize") == 'true'
|
append_filesize = self.__settings__.getSetting("append_filesize") == 'true'
|
||||||
hasSize = False
|
hasSize = False
|
||||||
|
@ -1612,9 +1616,11 @@ class Core:
|
||||||
'XBMC.RunPlugin(%s)' % ('%s?action=%s&ind=%s') % (
|
'XBMC.RunPlugin(%s)' % ('%s?action=%s&ind=%s') % (
|
||||||
sys.argv[0], 'downloadLibtorrent', str(identifier))),
|
sys.argv[0], 'downloadLibtorrent', str(identifier))),
|
||||||
]
|
]
|
||||||
link = {'url': identifier, 'thumbnail': thumbnail, 'save_folder':save_folder, 'filename':url}
|
link = {'url': identifier, 'thumbnail': thumbnail, 'save_folder':save_folder,
|
||||||
|
'filename':ensure_str(filename)}
|
||||||
self.drawItem(title, 'playTorrent', link, image=thumbnail, isFolder=False,
|
self.drawItem(title, 'playTorrent', link, image=thumbnail, isFolder=False,
|
||||||
action2=ids_video.rstrip(','), contextMenu=contextMenu, replaceMenu=False, fileSize=filesize)
|
action2=ids_video.rstrip(','), contextMenu=contextMenu,
|
||||||
|
replaceMenu=False, fileSize=filesize)
|
||||||
view_style('openTorrent')
|
view_style('openTorrent')
|
||||||
p_handle = int(sys.argv[1])
|
p_handle = int(sys.argv[1])
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1375,7 +1375,8 @@ def get_contentList(url):
|
||||||
torrent = Downloader.Torrent(userStorageDirectory, url, torrentFilesDirectory=torrentFilesDirectory)
|
torrent = Downloader.Torrent(userStorageDirectory, url, torrentFilesDirectory=torrentFilesDirectory)
|
||||||
|
|
||||||
debug('1'+__settings__.getSetting("lastTorrent"))
|
debug('1'+__settings__.getSetting("lastTorrent"))
|
||||||
__settings__.setSetting("lastTorrent", torrent.saveTorrent(url))
|
filename = torrent.saveTorrent(url)
|
||||||
|
__settings__.setSetting("lastTorrent", filename)
|
||||||
debug('2'+__settings__.getSetting("lastTorrent"))
|
debug('2'+__settings__.getSetting("lastTorrent"))
|
||||||
|
|
||||||
append_filesize = __settings__.getSetting("append_filesize") == 'true'
|
append_filesize = __settings__.getSetting("append_filesize") == 'true'
|
||||||
|
@ -1393,7 +1394,7 @@ def get_contentList(url):
|
||||||
|
|
||||||
debug('get_contentList contentList: ' + str(contentList))
|
debug('get_contentList contentList: ' + str(contentList))
|
||||||
|
|
||||||
return contentList
|
return contentList, filename
|
||||||
|
|
||||||
def join_list(l, char=', ', replace=''):
|
def join_list(l, char=', ', replace=''):
|
||||||
string=''
|
string=''
|
||||||
|
|
|
@ -96,6 +96,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
|
||||||
'last_addtime': None,
|
'last_addtime': None,
|
||||||
'last_query': None,
|
'last_query': None,
|
||||||
'last_link': None,
|
'last_link': None,
|
||||||
|
'last_filename': None,
|
||||||
'route': [{'mode': 'close', 'params': {}, 'last_listing_item': 0}]
|
'route': [{'mode': 'close', 'params': {}, 'last_listing_item': 0}]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,8 +239,8 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
|
||||||
xbmcvfs.mkdirs(__tmppath__)
|
xbmcvfs.mkdirs(__tmppath__)
|
||||||
navi_file = os.path.join(__tmppath__, 'navi.txt')
|
navi_file = os.path.join(__tmppath__, 'navi.txt')
|
||||||
if not xbmcvfs.exists(navi_file):
|
if not xbmcvfs.exists(navi_file):
|
||||||
nav_content = '{"last_link": null, "last_query": null, "filesList": [], "last_addtime": null, "last_top_button": 5, "route": [{"params": {}, "last_listing_item": 0, "mode": "close"}, {"last_listing_item": 0, "params": {}, "mode": "history"}], "contentList": [], "last_right_button": 1, "searchersList": []}'
|
self.set_navi()
|
||||||
with open(xbmc.translatePath(navi_file), 'wb') as f: f.write(nav_content)
|
with open(xbmc.translatePath(navi_file), 'wb') as f: f.write(str(self.navi))
|
||||||
read = xbmcvfs.File(navi_file, 'r')
|
read = xbmcvfs.File(navi_file, 'r')
|
||||||
navi = read.read()
|
navi = read.read()
|
||||||
read.close()
|
read.close()
|
||||||
|
@ -804,8 +805,11 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
|
||||||
|
|
||||||
# cache
|
# cache
|
||||||
if link != self.navi['last_link']:
|
if link != self.navi['last_link']:
|
||||||
self.navi['contentList'] = get_contentList(link)
|
self.navi['contentList'], filename = get_contentList(link)
|
||||||
|
else:
|
||||||
|
filename = self.navi['last_filename']
|
||||||
self.navi['last_link'] = link
|
self.navi['last_link'] = link
|
||||||
|
self.navi['last_filename'] = filename
|
||||||
|
|
||||||
dirList, contentListNew = cutFolder(self.navi['contentList'], tdir)
|
dirList, contentListNew = cutFolder(self.navi['contentList'], tdir)
|
||||||
|
|
||||||
|
@ -825,7 +829,8 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
|
||||||
|
|
||||||
contentListNew = sorted(contentListNew, key=lambda x: x[0], reverse=False)
|
contentListNew = sorted(contentListNew, key=lambda x: x[0], reverse=False)
|
||||||
for title, identifier, filesize in contentListNew:
|
for title, identifier, filesize in contentListNew:
|
||||||
params = {'mode': 'torrent_play', 'fileIndex': identifier, 'url2': ids_video.rstrip(','), 'url': link}
|
params = {'mode': 'torrent_play', 'fileIndex': identifier, 'url2': ids_video.rstrip(','), 'url': link,
|
||||||
|
'filename': filename}
|
||||||
self.drawItem(title, params)
|
self.drawItem(title, params)
|
||||||
|
|
||||||
self.navi_save('open_torrent')
|
self.navi_save('open_torrent')
|
||||||
|
@ -1045,6 +1050,8 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
|
||||||
self.navi_back()
|
self.navi_back()
|
||||||
elif mode == 'torrent_play':
|
elif mode == 'torrent_play':
|
||||||
if index == 1:
|
if index == 1:
|
||||||
|
if filename and xbmcvfs.exists(filename):
|
||||||
|
params['url'] = ensure_str(filename)
|
||||||
url = self.form_link('playSTRM', params)
|
url = self.form_link('playSTRM', params)
|
||||||
xbmc.executebuiltin('xbmc.RunPlugin("%s")' % (url))
|
xbmc.executebuiltin('xbmc.RunPlugin("%s")' % (url))
|
||||||
__settings__.setSetting('loadsw_onstop', 'true')
|
__settings__.setSetting('loadsw_onstop', 'true')
|
||||||
|
|
Loading…
Reference in New Issue