From 142a9cf4a9344af3744bea30fd38f450a5a0a94f Mon Sep 17 00:00:00 2001 From: inpos Date: Sat, 5 Mar 2016 18:09:26 +0300 Subject: [PATCH] =?UTF-8?q?=D0=90=D0=B2=D1=82=D0=BE=D0=BC=D0=B0=D1=82?= =?UTF-8?q?=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=BE=D0=B5=20=D0=BE=D0=BF=D1=80?= =?UTF-8?q?=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=B4=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B8=20=D1=84=D0=B0=D0=B9?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addon.xml | 5 ++--- lib/pyrrent2http/pyrrent2http.py | 10 ++++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/addon.xml b/addon.xml index 4fa3352..634d254 100644 --- a/addon.xml +++ b/addon.xml @@ -2,9 +2,8 @@ - - + + diff --git a/lib/pyrrent2http/pyrrent2http.py b/lib/pyrrent2http/pyrrent2http.py index 1aaf70f..87ddf49 100644 --- a/lib/pyrrent2http/pyrrent2http.py +++ b/lib/pyrrent2http/pyrrent2http.py @@ -149,6 +149,8 @@ class TorrentFile(object): def __init__(self, tfs, fileEntry, savePath, index): self.tfs = tfs self.fileEntry = fileEntry + self.name = self.Name() + self.unicode_name = self.name.decode(chardet.detect(self.name)['encoding']) self.savePath = savePath self.index = index self.piece_length = int(self.pieceLength()) @@ -219,7 +221,7 @@ class TorrentFile(object): return True def Close(self): if self.closed: return - self.log('Closing %s...' % (self.Name(),)) + self.log('Closing %s...' % (self.name,)) self.tfs.removeOpenedFile(self) self.closed = True if self.filePtr is not None: @@ -411,7 +413,7 @@ class TorrentFS(object): tf.closed = False self.fileCounter += 1 tf.num = self.fileCounter - tf.log('Opening %s...' % (tf.Name(),)) + tf.log('Opening %s...' % (tf.name,)) tf.SetPriority(1) startPiece, _ = tf.Pieces() self.handle.set_piece_deadline(startPiece, 50) @@ -892,9 +894,9 @@ class Pyrrent2http(object): if self.TorrentFS.HasTorrentInfo(): files = self.TorrentFS.Files() for file_ in files: - Url = 'http://' + self.config.bindAddress + '/files/' + urllib.quote(file_.Name()) + Url = 'http://' + self.config.bindAddress + '/files/' + urllib.quote(file_.name) fi = { - 'name': file_.Name(), + 'name': file_.unicode_name, 'size': file_.size, 'offset': file_.offset, 'download': file_.Downloaded(),