def update_active_downloads(self): """ This may change the active_downloads dict, you should get a dict copy before calling this method. """ for id_item, download_item in self.active_downloads.items(): th = self.thread_downloads[download_item.id] self.update_download_item(th, download_item) old_status = download_item.status if old_status in (cons.STATUS_STOPPED, cons.STATUS_FINISHED, cons.STATUS_ERROR): if old_status == cons.STATUS_STOPPED: self.stopped_downloads[id_item] = download_item elif old_status == cons.STATUS_FINISHED: self.complete_downloads[id_item] = download_item else: #status == cons.STATUS_ERROR download_item.fail_count += 1 if download_item.fail_count > conf.get_retries_limit(): download_item.status = cons.STATUS_STOPPED self.stopped_downloads[id_item] = download_item else: download_item.status = cons.STATUS_QUEUE self.queue_downloads[id_item] = download_item del self.thread_downloads[id_item] del self.active_downloads[id_item] self.global_slots.remove_slot() self.next_download() if old_status == cons.STATUS_FINISHED: events.download_complete.emit(download_item) if not self.active_downloads and old_status != cons.STATUS_STOPPED: events.all_downloads_complete.emit() if th.limit_exceeded and self.active_downloads and old_status == cons.STATUS_ERROR: events.limit_exceeded.emit()
def __init__(self, parent, *args, **kwargs): """""" AddonCore.__init__(self, parent) self.name = _("Shutdown") self.old_retries_count = conf.get_retries_limit() if self.old_retries_count == RETRIES_LIMIT: conf.set_retries_limit(str(99)) self.old_retries_count = 99
def load(self): self.retries_box.setValue(conf.get_retries_limit()) if conf.get_html_dl(): self.html_box.toggle() self.conn_box.setValue(conf.get_max_conn())