Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
Signed-off-by: anasty17 <[email protected]>
  • Loading branch information
anasty17 committed Nov 22, 2023
1 parent 17cb95f commit b3f0775
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
4 changes: 2 additions & 2 deletions bot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
INCOMPLETE_TASK_NOTIFIER,
scheduler,
)
from .helper.ext_utils.files_utils import start_cleanup, clean_all, exit_clean_up
from .helper.ext_utils.files_utils import clean_all, exit_clean_up
from .helper.ext_utils.bot_utils import cmd_exec, sync_to_async, initiate_help_messages
from .helper.ext_utils.status_utils import get_readable_file_size, get_readable_time
from .helper.ext_utils.db_handler import DbManger
Expand Down Expand Up @@ -231,7 +231,7 @@ async def send_incompelete_task_message(cid, msg):

async def main():
await gather(
start_cleanup(),
clean_all(),
torrent_search.initiate_search_tools(),
restart_notification(),
initiate_help_messages(),
Expand Down
15 changes: 3 additions & 12 deletions bot/helper/ext_utils/files_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,25 +89,16 @@ async def clean_download(path):
LOGGER.error(str(e))


async def start_cleanup():
async def clean_all():
aria2.remove_all(True)
get_client().torrents_delete(torrent_hashes="all")
try:
await aiormtree(DOWNLOAD_DIR)
except Exception as e:
LOGGER.error(str(e))
except:
pass
await makedirs(DOWNLOAD_DIR, exist_ok=True)


def clean_all():
aria2.remove_all(True)
get_client().torrents_delete(torrent_hashes="all")
try:
rmtree(DOWNLOAD_DIR)
except Exception as e:
LOGGER.error(str(e))


def exit_clean_up(signal, frame):
try:
LOGGER.info("Please wait, while we clean up and stop the running downloads")
Expand Down

0 comments on commit b3f0775

Please sign in to comment.