sandbox1
inpos 2016-03-12 20:07:49 +03:00
parent ccd8fc386a
commit 6b0a1084ec
1 changed files with 7 additions and 3 deletions

View File

@ -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):