rus fixes
This commit is contained in:
		
							parent
							
								
									ccfcbf6089
								
							
						
					
					
						commit
						ef6584dd8c
					
				@ -126,17 +126,17 @@ class Libtorrent:
 | 
			
		||||
                #baseName = localize_path(os.path.basename(self.getFilePath()))
 | 
			
		||||
                if not xbmcvfs.exists(self.torrentFilesPath):
 | 
			
		||||
                    xbmcvfs.mkdirs(self.torrentFilesPath)
 | 
			
		||||
                newFile = self.torrentFilesPath + self.md5(
 | 
			
		||||
                    torrentUrl) + '.torrent' #self.md5(baseName) + '.' +
 | 
			
		||||
                if xbmcvfs.exists(newFile):
 | 
			
		||||
                    xbmcvfs.delete(newFile)
 | 
			
		||||
                if not xbmcvfs.exists(newFile):
 | 
			
		||||
                    try:
 | 
			
		||||
                        xbmcvfs.rename(torrentFile, newFile)
 | 
			
		||||
                    except Exception, e:
 | 
			
		||||
                        log('Unable to rename torrent file from %s to %s in Torrent::renameTorrent. Exception: %s' %
 | 
			
		||||
                            (torrentFile, newFile, str(e)))
 | 
			
		||||
                        return
 | 
			
		||||
                newFile = self.torrentFilesPath + self.md5(torrentUrl) + '.torrent'
 | 
			
		||||
                if newFile != torrentFile:
 | 
			
		||||
                    if xbmcvfs.exists(newFile):
 | 
			
		||||
                        xbmcvfs.delete(newFile)
 | 
			
		||||
                    if not xbmcvfs.exists(newFile):
 | 
			
		||||
                        try:
 | 
			
		||||
                            xbmcvfs.rename(torrentFile, newFile)
 | 
			
		||||
                        except Exception, e:
 | 
			
		||||
                            log('Unable to rename torrent file from %s to %s in Torrent::renameTorrent. Exception: %s' %
 | 
			
		||||
                                (torrentFile, newFile, str(e)))
 | 
			
		||||
                            return
 | 
			
		||||
                self.torrentFile = newFile
 | 
			
		||||
                if not self.torrentFileInfo:
 | 
			
		||||
                    e=self.lt.bdecode(xbmcvfs.File(self.torrentFile,'rb').read())
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										15
									
								
								functions.py
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								functions.py
									
									
									
									
									
								
							@ -2049,14 +2049,17 @@ def localize_path(path):
 | 
			
		||||
    import chardet
 | 
			
		||||
    if not isinstance(path, unicode): path = path.decode(chardet.detect(path)['encoding'])
 | 
			
		||||
    if not sys.platform.startswith('win'):
 | 
			
		||||
        path = path.encode(True and sys.getfilesystemencoding() or 'utf-8')
 | 
			
		||||
        path = encode_msg(path)
 | 
			
		||||
    return path
 | 
			
		||||
 | 
			
		||||
def delocalize_path(path):
 | 
			
		||||
    import chardet
 | 
			
		||||
    if not isinstance(path, unicode): path = path.decode(chardet.detect(path)['encoding'])
 | 
			
		||||
    path = path.encode('utf-8')
 | 
			
		||||
    return path
 | 
			
		||||
def encode_msg(msg):
 | 
			
		||||
    try:
 | 
			
		||||
        msg = isinstance(msg, unicode) and msg.encode(True and sys.getfilesystemencoding() or 'utf-8') or msg
 | 
			
		||||
    except:
 | 
			
		||||
        import traceback
 | 
			
		||||
        log(traceback.format_exc())
 | 
			
		||||
        msg = msg.encode('utf-8')
 | 
			
		||||
    return msg
 | 
			
		||||
 | 
			
		||||
def get_platform():
 | 
			
		||||
    ret = {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user