Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
Signed-off-by: anasty17 <[email protected]>
  • Loading branch information
anasty17 committed Nov 14, 2024
1 parent f97076b commit 7f9855f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def __init__(self, listener):
self._eta = "-"
self._listener = listener
self._gid = ""
self._downloading = False
self._ext = ""
self.is_playlist = False
self.opts = {
Expand Down Expand Up @@ -93,7 +92,6 @@ def eta(self):
return self._eta

def _on_download_progress(self, d):
self._downloading = True
if self._listener.is_cancelled:
raise ValueError("Cancelling...")
if d["status"] == "finished":
Expand Down Expand Up @@ -336,8 +334,7 @@ async def add_download(self, path, qual, playlist, options):
async def cancel_task(self):
self._listener.is_cancelled = True
LOGGER.info(f"Cancelling Download: {self._listener.name}")
if not self._downloading:
await self._listener.on_download_error("Download Cancelled by User!")
await self._listener.on_download_error("Download Cancelled by User!")

def _set_options(self, options):
options = options.split("|")
Expand Down
26 changes: 12 additions & 14 deletions bot/helper/mirror_leech_utils/telegram_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,20 +314,18 @@ async def upload(self, o_files, ft_delete):
self._corrupted += 1
if self._listener.is_cancelled:
return
continue
finally:
if (
not self._listener.is_cancelled
and await aiopath.exists(self._up_path)
and (
not self._listener.seed
or self._listener.new_dir
or dirpath.endswith("/splited_files_mltb")
or "/copied_mltb/" in self._up_path
or delete_file
)
):
await remove(self._up_path)
if (
not self._listener.is_cancelled
and await aiopath.exists(self._up_path)
and (
not self._listener.seed
or self._listener.new_dir
or dirpath.endswith("/splited_files_mltb")
or "/copied_mltb/" in self._up_path
or delete_file
)
):
await remove(self._up_path)
for key, value in list(self._media_dict.items()):
for subkey, msgs in list(value.items()):
if len(msgs) > 1:
Expand Down

0 comments on commit 7f9855f

Please sign in to comment.