MCPcopy Index your code
hub / github.com/pyload/pyload / getSpeed

Method getSpeed

module/gui/Queue.py:220–243  ·  view source on GitHub ↗

calculate download speed

(self, item)

Source from the content-addressed store, hash-verified

218 return 0
219
220 def getSpeed(self, item):
221 """
222 calculate download speed
223 """
224 if isinstance(item, Link):
225 if item.data["downloading"]:
226 return int(item.data["downloading"]["speed"])
227 elif isinstance(item, Package):
228 count = len(item.children)
229 speed_sum = 0
230 all_waiting = True
231 running = False
232 for child in item.children:
233 val = 0
234 if child.data["downloading"]:
235 if not child.data["statusmsg"] == "waiting":
236 all_waiting = False
237 val = int(child.data["downloading"]["speed"])
238 running = True
239 speed_sum += val
240 if count == 0 or not running or all_waiting:
241 return None
242 return speed_sum
243 return None
244
245 def data(self, index, role=Qt.DisplayRole):
246 """

Callers 2

dataMethod · 0.95
queueChangedMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected