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

Method getWaitingProgress

module/gui/Queue.py:165–188  ·  view source on GitHub ↗

returns time to wait, caches startingtime to provide progress

(self, item)

Source from the content-addressed store, hash-verified

163 return QVariant()
164
165 def getWaitingProgress(self, item):
166 """
167 returns time to wait, caches startingtime to provide progress
168 """
169 locker = QMutexLocker(self.mutex)
170 if isinstance(item, Link):
171 if item.data["status"] == 5 and item.data["downloading"]:
172 until = float(item.data["downloading"]["wait_until"])
173 try:
174 since, until_old = self.wait_dict[item.id]
175 if not until == until_old:
176 raise Exception
177 except:
178 since = time()
179 self.wait_dict[item.id] = since, until
180 since = float(since)
181 max_wait = float(until-since)
182 rest = int(until-time())
183 if rest < 0:
184 return 0, None
185 res = 100/max_wait
186 perc = rest*res
187 return perc, rest
188 return None
189
190 def getProgress(self, item, locked=True):
191 """

Callers 1

paintMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected