fixes
parent
7c11ef619a
commit
3eb68a166a
16
Core.py
16
Core.py
|
@ -1554,10 +1554,13 @@ class Core:
|
|||
searcher = classMatch.group(1)
|
||||
url = Searchers().downloadWithSearcher(classMatch.group(2), searcher)
|
||||
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:
|
||||
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={}):
|
||||
get = params.get
|
||||
|
@ -1576,7 +1579,8 @@ class Core:
|
|||
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
|
||||
if not torrent: torrent = Downloader.Torrent(self.userStorageDirectory,
|
||||
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'
|
||||
hasSize = False
|
||||
|
@ -1612,9 +1616,11 @@ class Core:
|
|||
'XBMC.RunPlugin(%s)' % ('%s?action=%s&ind=%s') % (
|
||||
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,
|
||||
action2=ids_video.rstrip(','), contextMenu=contextMenu, replaceMenu=False, fileSize=filesize)
|
||||
action2=ids_video.rstrip(','), contextMenu=contextMenu,
|
||||
replaceMenu=False, fileSize=filesize)
|
||||
view_style('openTorrent')
|
||||
p_handle = int(sys.argv[1])
|
||||
try:
|
||||
|
|
|
@ -1375,7 +1375,8 @@ def get_contentList(url):
|
|||
torrent = Downloader.Torrent(userStorageDirectory, url, torrentFilesDirectory=torrentFilesDirectory)
|
||||
|
||||
debug('1'+__settings__.getSetting("lastTorrent"))
|
||||
__settings__.setSetting("lastTorrent", torrent.saveTorrent(url))
|
||||
filename = torrent.saveTorrent(url)
|
||||
__settings__.setSetting("lastTorrent", filename)
|
||||
debug('2'+__settings__.getSetting("lastTorrent"))
|
||||
|
||||
append_filesize = __settings__.getSetting("append_filesize") == 'true'
|
||||
|
@ -1393,7 +1394,7 @@ def get_contentList(url):
|
|||
|
||||
debug('get_contentList contentList: ' + str(contentList))
|
||||
|
||||
return contentList
|
||||
return contentList, filename
|
||||
|
||||
def join_list(l, char=', ', replace=''):
|
||||
string=''
|
||||
|
|
|
@ -96,6 +96,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
|
|||
'last_addtime': None,
|
||||
'last_query': None,
|
||||
'last_link': None,
|
||||
'last_filename': None,
|
||||
'route': [{'mode': 'close', 'params': {}, 'last_listing_item': 0}]
|
||||
}
|
||||
|
||||
|
@ -238,8 +239,8 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
|
|||
xbmcvfs.mkdirs(__tmppath__)
|
||||
navi_file = os.path.join(__tmppath__, 'navi.txt')
|
||||
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": []}'
|
||||
with open(xbmc.translatePath(navi_file), 'wb') as f: f.write(nav_content)
|
||||
self.set_navi()
|
||||
with open(xbmc.translatePath(navi_file), 'wb') as f: f.write(str(self.navi))
|
||||
read = xbmcvfs.File(navi_file, 'r')
|
||||
navi = read.read()
|
||||
read.close()
|
||||
|
@ -804,8 +805,11 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
|
|||
|
||||
# cache
|
||||
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_filename'] = filename
|
||||
|
||||
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)
|
||||
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.navi_save('open_torrent')
|
||||
|
@ -1045,6 +1050,8 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
|
|||
self.navi_back()
|
||||
elif mode == 'torrent_play':
|
||||
if index == 1:
|
||||
if filename and xbmcvfs.exists(filename):
|
||||
params['url'] = ensure_str(filename)
|
||||
url = self.form_link('playSTRM', params)
|
||||
xbmc.executebuiltin('xbmc.RunPlugin("%s")' % (url))
|
||||
__settings__.setSetting('loadsw_onstop', 'true')
|
||||
|
|
Loading…
Reference in New Issue