Skip to content

Commit

Permalink
Minor Fix
Browse files Browse the repository at this point in the history
Signed-off-by: anas <[email protected]>
  • Loading branch information
anasty17 committed Aug 28, 2021
1 parent eb518d4 commit 8c87fa1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
9 changes: 6 additions & 3 deletions bot/helper/mirror_utils/download_utils/qbit_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -167,14 +168,16 @@ 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()
self.updater.cancel()
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()
Expand Down
2 changes: 2 additions & 0 deletions bot/helper/mirror_utils/status_utils/qbit_download_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion qBittorrent.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8c87fa1

Please sign in to comment.