опять ненужные проверки

sandbox1
inpos 2016-03-13 19:03:33 +03:00
parent 2a3ff4a264
commit 5e1b05d4a9
3 changed files with 5 additions and 11 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.pyrrent2http" name="pyrrent2http" version="0.8.1" provider-name="inpos"> <addon id="script.module.pyrrent2http" name="pyrrent2http" version="0.8.2" provider-name="inpos">
<requires> <requires>
<import addon="xbmc.python" version="2.14.0"/> <import addon="xbmc.python" version="2.14.0"/>
<import addon="script.module.libtorrent" /> <import addon="script.module.libtorrent" />

View File

@ -233,7 +233,7 @@ class Engine:
if not self.is_alive(): if not self.is_alive():
raise Error("Can't start pyrrent2http, see log for details", Error.PROCESS_ERROR) raise Error("Can't start pyrrent2http, see log for details", Error.PROCESS_ERROR)
try: try:
self.status(1) #self.status(1)
initialized = True initialized = True
break break
except Error: except Error:

View File

@ -269,7 +269,7 @@ class TorrentFS(object):
self.files = self.__files_() self.files = self.__files_()
if startIndex < 0: if startIndex < 0:
logging.info('No -file-index specified, downloading will be paused until any file is requested') 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: if startIndex == i:
self.setPriority(i, 1) self.setPriority(i, 1)
else: else:
@ -306,10 +306,6 @@ class TorrentFS(object):
self.info = self.handle.get_torrent_info() self.info = self.handle.get_torrent_info()
def HasTorrentInfo(self): def HasTorrentInfo(self):
return self.info is not None 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): def LoadFileProgress(self):
self.progresses = self.handle.file_progress() self.progresses = self.handle.file_progress()
for i, f in enumerate(self.files): for i, f in enumerate(self.files):
@ -322,7 +318,7 @@ class TorrentFS(object):
bytes_ = 0 bytes_ = 0
return bytes_ return bytes_
def __files_(self): def __files_(self):
info = self.TorrentInfo() info = self.info
files_ = [] files_ = []
for i in range(info.num_files()): for i in range(info.num_files()):
file_ = self.__file_at_(i) file_ = self.__file_at_(i)
@ -332,7 +328,7 @@ class TorrentFS(object):
files_.append(file_) files_.append(file_)
return files_ return files_
def __file_at_(self, index): def __file_at_(self, index):
info = self.TorrentInfo() info = self.info
fileEntry = info.file_at(index) fileEntry = info.file_at(index)
fe_path = fileEntry.path fe_path = fileEntry.path
path = os.path.abspath(os.path.join(self.save_path, localize_path(fe_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): if isinstance(alert, alertClass):
return alert return alert
def loop(self): def loop(self):
def sigterm_handler(_signo, _stack_frame):
self.forceShutdown = True
self.statsTicker = Ticker(30) self.statsTicker = Ticker(30)
self.saveResumeDataTicker = Ticker(5) self.saveResumeDataTicker = Ticker(5)
time_start = time.time() time_start = time.time()