mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-13 13:05:37 +00:00
Add 'files' key to torrent status.
This commit is contained in:
parent
8f592b6330
commit
ae81a28e6b
@ -94,7 +94,19 @@ class Torrent:
|
|||||||
return 0.0
|
return 0.0
|
||||||
|
|
||||||
return ratio
|
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):
|
def get_status(self, keys):
|
||||||
"""Returns the status of the torrent based on the keys provided"""
|
"""Returns the status of the torrent based on the keys provided"""
|
||||||
# Create the full dictionary
|
# Create the full dictionary
|
||||||
@ -150,7 +162,8 @@ class Torrent:
|
|||||||
"ratio": self.get_ratio(),
|
"ratio": self.get_ratio(),
|
||||||
"tracker": status.current_tracker,
|
"tracker": status.current_tracker,
|
||||||
"tracker_status": self.tracker_status,
|
"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
|
# Create the desired status dictionary and return it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user