Merge pull request #71 from ElAntonioB/fix-special-paths

Fix handling special:// paths
pull/15/head
DiMartinoXBMC 2016-12-29 17:50:03 +03:00 committed by GitHub
commit ec89d3c710
2 changed files with 6 additions and 6 deletions

View File

@ -30,7 +30,7 @@ class Core:
__plugin__ = sys.modules["__main__"].__plugin__ __plugin__ = sys.modules["__main__"].__plugin__
__settings__ = sys.modules["__main__"].__settings__ __settings__ = sys.modules["__main__"].__settings__
ROOT = sys.modules["__main__"].__root__ 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' torrentFilesDirectory = 'torrents'
debug = __settings__.getSetting('debug') == 'true' debug = __settings__.getSetting('debug') == 'true'
torrent_player = __settings__.getSetting("torrent_player") torrent_player = __settings__.getSetting("torrent_player")
@ -1456,9 +1456,9 @@ class Core:
#xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.yatp/?action=play&torrent=%s&file_index=%s")' % (urllib.quote_plus(torrentUrl), params['url'])) #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': elif self.torrent_player == '1':
__ASsettings__ = xbmcaddon.Addon(id='script.module.torrent.ts') __ASsettings__ = xbmcaddon.Addon(id='script.module.torrent.ts')
folder=__ASsettings__.getSetting("folder") folder=__ASsettings__.getSetting("path")
save=__ASsettings__.getSetting("save") 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")) __ASsettings__.setSetting("save", self.__settings__.getSetting("keep_files"))
xbmc.sleep(1000) xbmc.sleep(1000)
torrent = Downloader.Torrent(self.userStorageDirectory, torrentUrl, self.torrentFilesDirectory) torrent = Downloader.Torrent(self.userStorageDirectory, torrentUrl, self.torrentFilesDirectory)
@ -1469,7 +1469,7 @@ class Core:
label = unquote(get("label"), os.path.basename(path)) label = unquote(get("label"), os.path.basename(path))
torrent.play_url_ind(int(ind), label, icon) torrent.play_url_ind(int(ind), label, icon)
torrent.__exit__() torrent.__exit__()
__ASsettings__.setSetting("folder", folder) __ASsettings__.setSetting("path", folder)
__ASsettings__.setSetting("save", save) __ASsettings__.setSetting("save", save)
def saveUrlTorrent(self, url): def saveUrlTorrent(self, url):

View File

@ -43,7 +43,7 @@ except:
__settings__ = xbmcaddon.Addon(id='plugin.video.torrenter') __settings__ = xbmcaddon.Addon(id='plugin.video.torrenter')
__language__ = __settings__.getLocalizedString __language__ = __settings__.getLocalizedString
ROOT = __settings__.getAddonInfo('path') # .decode('utf-8').encode(sys.getfilesystemencoding()) ROOT = __settings__.getAddonInfo('path') # .decode('utf-8').encode(sys.getfilesystemencoding())
userStorageDirectory = __settings__.getSetting("storage") userStorageDirectory = xbmc.translatePath(__settings__.getSetting("storage"))
torrentFilesDirectory = 'torrents' torrentFilesDirectory = 'torrents'
USERAGENT = "Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0" USERAGENT = "Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0"
__addonpath__ = __settings__.getAddonInfo('path') __addonpath__ = __settings__.getAddonInfo('path')