returns time to wait, caches startingtime to provide progress
(self, item)
| 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 | """ |