diff --git a/bot/helper/mirror_utils/download_utils/qbit_downloader.py b/bot/helper/mirror_utils/download_utils/qbit_downloader.py index 53fda11207d..f2bd34cb1a3 100644 --- a/bot/helper/mirror_utils/download_utils/qbit_downloader.py +++ b/bot/helper/mirror_utils/download_utils/qbit_downloader.py @@ -145,12 +145,12 @@ def update(self): if tor_info.state == "metaDL": self.stalled_time = time.time() if time.time() - self.meta_time >= 999999999: # timeout while downloading metadata - self.updater.cancel() self.client.torrents_pause(torrent_hashes=self.ext_hash) time.sleep(0.3) self.listener.onDownloadError("Dead Torrent!") self.client.torrents_delete(torrent_hashes=self.ext_hash) self.client.auth_log_out() + self.updater.cancel() elif tor_info.state == "downloading": self.stalled_time = time.time() if (TORRENT_DIRECT_LIMIT is not None or TAR_UNZIP_LIMIT is not None) and not self.checked: @@ -164,29 +164,28 @@ def update(self): result = check_limit(size, TORRENT_DIRECT_LIMIT, TAR_UNZIP_LIMIT, is_tar_ext) self.checked = True if result: - self.updater.cancel() self.client.torrents_pause(torrent_hashes=self.ext_hash) time.sleep(0.3) self.listener.onDownloadError(f"{mssg}.\nYour File/Folder size is {get_readable_file_size(size)}") self.client.torrents_delete(torrent_hashes=self.ext_hash) self.client.auth_log_out() + self.updater.cancel() elif tor_info.state == "stalledDL": if time.time() - self.stalled_time >= 999999999: # timeout after downloading metadata - self.updater.cancel() self.client.torrents_pause(torrent_hashes=self.ext_hash) time.sleep(0.3) self.listener.onDownloadError("Dead Torrent!") self.client.torrents_delete(torrent_hashes=self.ext_hash) self.client.auth_log_out() + self.updater.cancel() elif tor_info.state == "error": - self.updater.cancel() self.client.torrents_pause(torrent_hashes=self.ext_hash) time.sleep(0.3) self.listener.onDownloadError("No enough space for this torrent on device") self.client.torrents_delete(torrent_hashes=self.ext_hash) self.client.auth_log_out() - elif tor_info.state == "uploading" or tor_info.state.lower().endswith("up"): self.updater.cancel() + elif tor_info.state == "uploading" or tor_info.state.lower().endswith("up"): self.client.torrents_pause(torrent_hashes=self.ext_hash) if self.qbitsel: for dirpath, subdir, files in os.walk(f"{self.dire}", topdown=False): @@ -202,6 +201,7 @@ def update(self): self.listener.onDownloadComplete() self.client.torrents_delete(torrent_hashes=self.ext_hash) self.client.auth_log_out() + self.updater.cancel() except: self.updater.cancel()