From 6b0a1084ec1a2bb63f8feb0f7b22db67a96f202c Mon Sep 17 00:00:00 2001 From: inpos Date: Sat, 12 Mar 2016 20:07:49 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BE=D0=B9...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pyrrent2http/pyrrent2http.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/pyrrent2http/pyrrent2http.py b/lib/pyrrent2http/pyrrent2http.py index 3eb4d14..d4c29ba 100644 --- a/lib/pyrrent2http/pyrrent2http.py +++ b/lib/pyrrent2http/pyrrent2http.py @@ -323,13 +323,14 @@ class TorrentFS(object): return bytes_ def __files_(self): info = self.TorrentInfo() + files_ = [] for i in range(info.num_files()): file_ = self.__file_at_(i) file_.downloaded = self.getFileDownloadedBytes(i) if file_.size > 0: file_.progress = float(file_.downloaded)/float(file_.size) - self.files.append(file_) - return self.files + files_.append(file_) + return files_ def __file_at_(self, index): info = self.TorrentInfo() fileEntry = info.file_at(index) @@ -643,7 +644,10 @@ class Pyrrent2http(object): except: info = self.torrentHandle.get_torrent_info() logging.info('Downloading torrent: %s' % (info.name(),)) - self.TorrentFS = TorrentFS(self, self.torrentHandle, self.config.fileIndex) + try: + self.TorrentFS = TorrentFS(self, self.torrentHandle, self.config.fileIndex) + except Exception as e: + logging.error(e.args) def startHTTP(self): #def http_server_loop(listener, alive):