From 09a555df0fb8c518f25a8b3305b0750dd7ddaa78 Mon Sep 17 00:00:00 2001 From: ElAntonioB Date: Thu, 29 Dec 2016 09:13:17 +0200 Subject: [PATCH 1/3] Use xbmc.translatePath on storage setting Convert special:// path to absolute ones for file operations to work. Fix reference to "path" setting for AceStream --- Core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core.py b/Core.py index 7286a3f..2cd1eab 100644 --- a/Core.py +++ b/Core.py @@ -30,7 +30,7 @@ class Core: __plugin__ = sys.modules["__main__"].__plugin__ __settings__ = sys.modules["__main__"].__settings__ ROOT = sys.modules["__main__"].__root__ - userStorageDirectory = localize_path(__settings__.getSetting("storage"))#file_encode(__settings__.getSetting("storage")) + userStorageDirectory = localize_path(xbmc.translatePath(__settings__.getSetting("storage")))#file_encode(__settings__.getSetting("storage")) torrentFilesDirectory = 'torrents' debug = __settings__.getSetting('debug') == 'true' torrent_player = __settings__.getSetting("torrent_player") @@ -1455,9 +1455,9 @@ class Core: #xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.yatp/?action=play&torrent=%s&file_index=%s")' % (urllib.quote_plus(torrentUrl), params['url'])) elif self.torrent_player == '1': __ASsettings__ = xbmcaddon.Addon(id='script.module.torrent.ts') - folder=__ASsettings__.getSetting("folder") + folder=__ASsettings__.getSetting("path") save=__ASsettings__.getSetting("save") - __ASsettings__.setSetting("folder", self.__settings__.getSetting("storage")) + __ASsettings__.setSetting("path", xbmc.translatePath(self.__settings__.getSetting("storage"))) __ASsettings__.setSetting("save", self.__settings__.getSetting("keep_files")) xbmc.sleep(1000) torrent = Downloader.Torrent(self.userStorageDirectory, torrentUrl, self.torrentFilesDirectory) @@ -1468,7 +1468,7 @@ class Core: label = unquote(get("label"), os.path.basename(path)) torrent.play_url_ind(int(ind), label, icon) torrent.__exit__() - __ASsettings__.setSetting("folder", folder) + __ASsettings__.setSetting("path", folder) __ASsettings__.setSetting("save", save) def saveUrlTorrent(self, url): From 6b5ffb56da9e2f90529ed011a86a585fa15f2627 Mon Sep 17 00:00:00 2001 From: ElAntonioB Date: Thu, 29 Dec 2016 09:15:52 +0200 Subject: [PATCH 2/3] storage path usage fix for functions.py --- functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions.py b/functions.py index 22736e3..846d037 100644 --- a/functions.py +++ b/functions.py @@ -43,7 +43,7 @@ except: __settings__ = xbmcaddon.Addon(id='plugin.video.torrenter') __language__ = __settings__.getLocalizedString ROOT = __settings__.getAddonInfo('path') # .decode('utf-8').encode(sys.getfilesystemencoding()) -userStorageDirectory = __settings__.getSetting("storage") +userStorageDirectory = xbmc.translatePath(__settings__.getSetting("storage")) torrentFilesDirectory = 'torrents' USERAGENT = "Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0" __addonpath__ = __settings__.getAddonInfo('path') @@ -2265,4 +2265,4 @@ def get_item(): }) item.setInfo(type='Video', infoLabels=infoLabels) - return item \ No newline at end of file + return item From 0adea94cd0f0ef5f08962fb14bed7760bff48daa Mon Sep 17 00:00:00 2001 From: ElAntonioB Date: Thu, 29 Dec 2016 15:07:46 +0200 Subject: [PATCH 3/3] Close dialogs before recursive call Here is how it would fail otherwise with local torrent: 10:31:40.149 T:6140948480 NOTICE: ### [Torrenter v.2.5.5ja]: Torrenter v.2.5.5ja 10:31:40.184 T:6140948480 NOTICE: ### [Torrenter v.2.5.5ja]: SYS ARGV: ['plugin://plugin.video.torrenter/', '3', '?action=torrentPlayer&url'] 10:31:40.441 T:6143242240 DEBUG: ------ Window Init (DialogBusy.xml) ------ 10:31:40.441 T:6143242240 DEBUG: Window DialogBusy.xml was already loaded 10:31:40.441 T:6143242240 DEBUG: Alloc resources: 0.09ms 10:31:40.443 T:6143242240 INFO: Loading skin file: FileBrowser.xml, load type: KEEP_IN_MEMORY 10:31:40.465 T:6143242240 DEBUG: Load FileBrowser.xml: 21.30ms 10:31:40.466 T:6143242240 DEBUG: Alloc resources: 22.84ms (21.71 ms skin load) 10:31:40.483 T:6143242240 DEBUG: ------ Window Init (FileBrowser.xml) ------ 10:31:40.484 T:6143242240 DEBUG: Window FileBrowser.xml was already loaded 10:31:40.484 T:6143242240 DEBUG: Alloc resources: 0.02ms 10:31:48.076 T:6143242240 DEBUG: ------ Window Deinit (FileBrowser.xml) ------ 10:31:48.112 T:6140948480 NOTICE: ### [Torrenter v.2.5.5ja]: Imported TSengine from ASCore 10:31:48.119 T:6140948480 DEBUG: DialogProgress::Open called 10:31:48.119 T:6140948480 DEBUG: ------ Window Init (DialogConfirm.xml) ------ 10:31:48.120 T:6140948480 DEBUG: Window DialogConfirm.xml was already loaded 10:31:48.120 T:6140948480 DEBUG: Alloc resources: 1.00ms 10:31:48.126 T:6140948480 DEBUG: NSUSerDefaults: compressed /userdata/addon_data/script.module.torrent.ts/settings.xml from 643 to 288 10:31:48.133 T:6140948480 DEBUG: Previous line repeats 1 times. 10:31:48.133 T:6140948480 NOTICE: ### [Torrenter v.2.5.5ja]: xbmcvfs.File for smb://srv/Main/Kodi/Torrents/293.torrent 10:31:48.136 T:6140948480 DEBUG: CSMBFile::Open - opened smb://srv/Main/Kodi/Torrents/293.torrent, fd=10000 10:31:48.145 T:6140948480 DEBUG: CSMBFile::Close closing fd 10000 10:31:49.604 T:6140948480 DEBUG: NSUSerDefaults: compressed /userdata/addon_data/plugin.video.torrenter/settings.xml from 4555 to 1068 10:31:49.643 T:6143242240 DEBUG: Previous line repeats 3 times. 10:31:49.643 T:6143242240 DEBUG: Activating window ID: 10025 10:31:49.643 T:6143242240 INFO: Activate of window '10025' refused because there are active modal dialogs 10:31:49.893 T:6143242240 DEBUG: ------ Window Deinit (DialogConfirm.xml) ------ 10:32:16.976 T:6148403200 DEBUG: Thread JobWorker 0 terminating (autodelete) --- Core.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Core.py b/Core.py index 7286a3f..35e71b5 100644 --- a/Core.py +++ b/Core.py @@ -1397,6 +1397,7 @@ class Core: self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url)) self.__settings__.setSetting("lastTorrentUrl", url) if url: + xbmc.executebuiltin("Dialog.Close(all,true)") xbmc.executebuiltin( 'XBMC.ActivateWindow(%s)' % 'Videos,plugin://plugin.video.torrenter/?action=%s&url=%s' % ('torrentPlayer', url))