minor changes

Signed-off-by: anasty17 <e.anastayyar@gmail.com>
This commit is contained in:
anasty17 2024-11-14 14:23:52 +02:00
parent f97076bf49
commit 7f9855f13c
No known key found for this signature in database
GPG Key ID: EAAC8A2DF2861DE4
2 changed files with 13 additions and 18 deletions

View File

@ -49,7 +49,6 @@ class YoutubeDLHelper:
self._eta = "-"
self._listener = listener
self._gid = ""
self._downloading = False
self._ext = ""
self.is_playlist = False
self.opts = {
@ -93,7 +92,6 @@ class YoutubeDLHelper:
return self._eta
def _on_download_progress(self, d):
self._downloading = True
if self._listener.is_cancelled:
raise ValueError("Cancelling...")
if d["status"] == "finished":
@ -336,8 +334,7 @@ class YoutubeDLHelper:
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("|")

View File

@ -314,20 +314,18 @@ class TelegramUploader:
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: