From 8c87fa1999022657b812549b90a9d78cfe7350cb Mon Sep 17 00:00:00 2001 From: anas Date: Sat, 28 Aug 2021 19:01:22 +0300 Subject: [PATCH] Minor Fix Signed-off-by: anas --- bot/__init__.py | 4 ++-- .../mirror_utils/download_utils/qbit_downloader.py | 9 ++++++--- .../mirror_utils/status_utils/qbit_download_status.py | 2 ++ qBittorrent.conf | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bot/__init__.py b/bot/__init__.py index 91e104cb75b..50da6d0403d 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -43,8 +43,8 @@ alive = subprocess.Popen(["python3", "alive.py"]) -subprocess.run(["mkdir", "-p", "./.config/qBittorrent"]) -subprocess.run(["cp", "qBittorrent.conf", "./.config/qBittorrent/qBittorrent.conf"]) +subprocess.run(["mkdir", "-p", ".config/qBittorrent"]) +subprocess.run(["cp", "qBittorrent.conf", ".config/qBittorrent/qBittorrent.conf"]) subprocess.run(["qbittorrent-nox", "-d"]) Interval = [] diff --git a/bot/helper/mirror_utils/download_utils/qbit_downloader.py b/bot/helper/mirror_utils/download_utils/qbit_downloader.py index e75b41260b7..44553b439ef 100644 --- a/bot/helper/mirror_utils/download_utils/qbit_downloader.py +++ b/bot/helper/mirror_utils/download_utils/qbit_downloader.py @@ -90,9 +90,8 @@ def add_torrent(self, link, dire, listener, qbitsel): try: tor_info = tor_info[0] if tor_info.state == "metaDL" or tor_info.state == "checkingResumeData": - time.sleep(0.5) + time.sleep(1) else: - time.sleep(2) deleteMessage(listener.bot, meta) break except: @@ -140,6 +139,7 @@ def update(self): self.stalled_time = time.time() if time.time() - self.meta_time >= 999999999: # timeout while downloading metadata 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() @@ -159,6 +159,7 @@ def update(self): self.checked = True if result: 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() @@ -167,6 +168,7 @@ def update(self): elif tor_info.state == "stalledDL": if time.time() - self.stalled_time >= 999999999: # timeout after downloading metadata 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() @@ -174,7 +176,8 @@ def update(self): return elif tor_info.state == "error": self.client.torrents_pause(torrent_hashes=self.ext_hash) - self.listener.onDownloadError("Error. IDK why, report in @SlamBugReport") + 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() self.updater.cancel() diff --git a/bot/helper/mirror_utils/status_utils/qbit_download_status.py b/bot/helper/mirror_utils/status_utils/qbit_download_status.py index fff0cfca972..da053a89d67 100644 --- a/bot/helper/mirror_utils/status_utils/qbit_download_status.py +++ b/bot/helper/mirror_utils/status_utils/qbit_download_status.py @@ -5,6 +5,7 @@ from bot import DOWNLOAD_DIR, LOGGER, get_client from bot.helper.ext_utils.bot_utils import MirrorStatus, get_readable_file_size, get_readable_time from .status import Status +from time import sleep class QbDownloadStatus(Status): @@ -78,5 +79,6 @@ def gid(self): def cancel_download(self): LOGGER.info(f"Cancelling Download: {self.name()}") self.client.torrents_pause(torrent_hashes=self.__hash) + sleep(0.3) self.listener.onDownloadError('Download stopped by user!') self.client.torrents_delete(torrent_hashes=self.__hash) diff --git a/qBittorrent.conf b/qBittorrent.conf index a4a07767e6d..3de5abe40f3 100644 --- a/qBittorrent.conf +++ b/qBittorrent.conf @@ -41,7 +41,7 @@ Downloads\UseIncompleteExtension=true Queueing\IgnoreSlowTorrents=true Queueing\MaxActiveDownloads=50 Queueing\MaxActiveTorrents=100 -Queueing\QueueingEnabled=true +Queueing\QueueingEnabled=false WebUI\CSRFProtection=true WebUI\ClickjackingProtection=true WebUI\HTTPS\Enabled=false