From 5e1b05d4a94a6944cb86b543debed4d887ab2913 Mon Sep 17 00:00:00 2001 From: inpos Date: Sun, 13 Mar 2016 19:03:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BE=D0=BF=D1=8F=D1=82=D1=8C=20=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D1=83=D0=B6=D0=BD=D1=8B=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addon.xml | 2 +- lib/pyrrent2http/engine.py | 2 +- lib/pyrrent2http/pyrrent2http.py | 12 +++--------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/addon.xml b/addon.xml index 986facd..e6edd8b 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/lib/pyrrent2http/engine.py b/lib/pyrrent2http/engine.py index 6580674..349285a 100644 --- a/lib/pyrrent2http/engine.py +++ b/lib/pyrrent2http/engine.py @@ -233,7 +233,7 @@ class Engine: if not self.is_alive(): raise Error("Can't start pyrrent2http, see log for details", Error.PROCESS_ERROR) try: - self.status(1) + #self.status(1) initialized = True break except Error: diff --git a/lib/pyrrent2http/pyrrent2http.py b/lib/pyrrent2http/pyrrent2http.py index e5f3f2b..18a2ccd 100644 --- a/lib/pyrrent2http/pyrrent2http.py +++ b/lib/pyrrent2http/pyrrent2http.py @@ -269,7 +269,7 @@ class TorrentFS(object): self.files = self.__files_() if startIndex < 0: logging.info('No -file-index specified, downloading will be paused until any file is requested') - for i in range(self.TorrentInfo().num_files()): + for i in range(self.info.num_files()): if startIndex == i: self.setPriority(i, 1) else: @@ -306,10 +306,6 @@ class TorrentFS(object): self.info = self.handle.get_torrent_info() def HasTorrentInfo(self): return self.info is not None - def TorrentInfo(self): - while not isinstance(self.info, lt.torrent_info): - time.sleep(0.1) - return self.info def LoadFileProgress(self): self.progresses = self.handle.file_progress() for i, f in enumerate(self.files): @@ -322,7 +318,7 @@ class TorrentFS(object): bytes_ = 0 return bytes_ def __files_(self): - info = self.TorrentInfo() + info = self.info files_ = [] for i in range(info.num_files()): file_ = self.__file_at_(i) @@ -332,7 +328,7 @@ class TorrentFS(object): files_.append(file_) return files_ def __file_at_(self, index): - info = self.TorrentInfo() + info = self.info fileEntry = info.file_at(index) fe_path = fileEntry.path path = os.path.abspath(os.path.join(self.save_path, localize_path(fe_path))) @@ -881,8 +877,6 @@ class Pyrrent2http(object): if isinstance(alert, alertClass): return alert def loop(self): - def sigterm_handler(_signo, _stack_frame): - self.forceShutdown = True self.statsTicker = Ticker(30) self.saveResumeDataTicker = Ticker(5) time_start = time.time()