rus fixes

pull/3/head
DiMartinoXBMC 2016-03-14 20:38:33 +03:00
parent ccfcbf6089
commit ef6584dd8c
2 changed files with 20 additions and 17 deletions

View File

@ -126,8 +126,8 @@ class Libtorrent:
#baseName = localize_path(os.path.basename(self.getFilePath())) #baseName = localize_path(os.path.basename(self.getFilePath()))
if not xbmcvfs.exists(self.torrentFilesPath): if not xbmcvfs.exists(self.torrentFilesPath):
xbmcvfs.mkdirs(self.torrentFilesPath) xbmcvfs.mkdirs(self.torrentFilesPath)
newFile = self.torrentFilesPath + self.md5( newFile = self.torrentFilesPath + self.md5(torrentUrl) + '.torrent'
torrentUrl) + '.torrent' #self.md5(baseName) + '.' + if newFile != torrentFile:
if xbmcvfs.exists(newFile): if xbmcvfs.exists(newFile):
xbmcvfs.delete(newFile) xbmcvfs.delete(newFile)
if not xbmcvfs.exists(newFile): if not xbmcvfs.exists(newFile):

View File

@ -2049,14 +2049,17 @@ def localize_path(path):
import chardet import chardet
if not isinstance(path, unicode): path = path.decode(chardet.detect(path)['encoding']) if not isinstance(path, unicode): path = path.decode(chardet.detect(path)['encoding'])
if not sys.platform.startswith('win'): if not sys.platform.startswith('win'):
path = path.encode(True and sys.getfilesystemencoding() or 'utf-8') path = encode_msg(path)
return path return path
def delocalize_path(path): def encode_msg(msg):
import chardet try:
if not isinstance(path, unicode): path = path.decode(chardet.detect(path)['encoding']) msg = isinstance(msg, unicode) and msg.encode(True and sys.getfilesystemencoding() or 'utf-8') or msg
path = path.encode('utf-8') except:
return path import traceback
log(traceback.format_exc())
msg = msg.encode('utf-8')
return msg
def get_platform(): def get_platform():
ret = { ret = {