Add 'files' key to torrent status.

This commit is contained in:
Andrew Resch 2007-10-28 06:30:02 +00:00
parent 8f592b6330
commit ae81a28e6b
1 changed files with 15 additions and 2 deletions

View File

@ -95,6 +95,18 @@ class Torrent:
return ratio
def get_files(self):
"""Returns a list of files this torrent contains"""
ret = []
files = self.handle.torrent_info().files()
for file in files:
ret.append({
'path': file.path,
'size': file.size,
'offset': file.offset
})
return ret
def get_status(self, keys):
"""Returns the status of the torrent based on the keys provided"""
# Create the full dictionary
@ -150,7 +162,8 @@ class Torrent:
"ratio": self.get_ratio(),
"tracker": status.current_tracker,
"tracker_status": self.tracker_status,
"save_path": self.save_path
"save_path": self.save_path,
"files": self.get_files()
}
# Create the desired status dictionary and return it