Fixed #331 - Added availability and piece size to Torrent Info pane.

This commit is contained in:
Alex Dedul 2007-07-21 18:08:32 +00:00
parent 3bba92929d
commit 92acd7907e
4 changed files with 902 additions and 845 deletions

File diff suppressed because it is too large Load Diff

View File

@ -651,9 +651,6 @@ class Manager:
# when needed, and perhaps only once in a long while (they are mostly just
# approximations anyhow
def calc_availability(self, unique_ID):
return deluge_stats.calc_availability(self.get_core_torrent_peer_info(unique_ID))
def calc_swarm_speed(self, unique_ID):
pieces_per_sec = deluge_stats.calc_swarm_speed(self.get_core_torrent_peer_info(unique_ID))
piece_length = self.get_core_torrent_state(unique_ID)

View File

@ -34,24 +34,6 @@ import time
old_peer_info = None
old_peer_info_timestamp = None
# Availability - how many complete copies are among our peers
def calc_availability(peer_info):
if len(peer_info) == 0:
return 0
num_pieces = len(peer_info[0].pieces)
freqs = [0]*num_pieces
for peer in peer_info:
for piece in num_pieces:
freqs[piece] = freqs[piece] + peer['pieces'][piece]
minimum = min(freqs)
# frac = freqs.count(minimum + 1) # Does this mean something?
return minimum
# Swarm speed - try to guess the speed of the entire swarm
# We return #pieces / second. The calling function should convert pieces to KB, if it wants
# Note that we return the delta from the last call. If the client calls too soon, this may

View File

@ -613,6 +613,8 @@ class DelugeGTK:
self.text_summary_name = self.wtree.get_widget("summary_name")
self.text_summary_total_size = self.wtree.get_widget("summary_total_size")
self.text_summary_pieces = self.wtree.get_widget("summary_pieces")
self.text_summary_piece_size = self.wtree.get_widget("summary_piece_size")
self.text_summary_availability = self.wtree.get_widget("summary_availability")
self.text_summary_total_downloaded = self.wtree.get_widget("summary_total_downloaded")
self.text_summary_total_uploaded = self.wtree.get_widget("summary_total_uploaded")
self.text_summary_download_speed = self.wtree.get_widget("summary_download_speed")
@ -997,6 +999,8 @@ class DelugeGTK:
self.wtree.get_widget("summary_name").set_text(state['name'])
self.text_summary_total_size.set_text(common.fsize(state["total_wanted"]))
self.text_summary_pieces.set_text(str(state["num_pieces"]))
self.text_summary_piece_size.set_text(common.fsize(state["piece_length"]))
self.text_summary_availability.set_text(str(round(state["distributed_copies"], 2)))
self.text_summary_total_downloaded.set_text(common.fsize(state["total_done"]) \
+ " (" + common.fsize(state["total_download"]) + ")")
self.text_summary_total_uploaded.set_text(common.fsize(self.manager.unique_IDs\
@ -1226,6 +1230,8 @@ class DelugeGTK:
self.wtree.get_widget("summary_name").set_text("")
self.text_summary_total_size.set_text("")
self.text_summary_pieces.set_text("")
self.text_summary_piece_size.set_text("")
self.text_summary_availability.set_text("")
self.text_summary_total_downloaded.set_text("")
self.text_summary_total_uploaded.set_text("")
self.text_summary_download_speed.set_text("")