mirror of
https://github.com/anasty17/mirror-leech-telegram-bot.git
synced 2025-01-07 03:26:46 +08:00
minor fixes
Signed-off-by: anasty17 <e.anastayyar@gmail.com>
This commit is contained in:
parent
375838a973
commit
cb601eb8df
@ -1,6 +1,6 @@
|
||||
from asyncio import sleep, wait_for
|
||||
from asyncio import sleep
|
||||
|
||||
from bot import intervals, jd_lock, jd_downloads, LOGGER
|
||||
from bot import intervals, jd_lock, jd_downloads
|
||||
from ..ext_utils.bot_utils import new_task, retry_function
|
||||
from ..ext_utils.jdownloader_booter import jdownloader
|
||||
from ..ext_utils.status_utils import get_task_by_gid
|
||||
@ -12,7 +12,7 @@ async def remove_download(gid):
|
||||
return
|
||||
await retry_function(
|
||||
jdownloader.device.downloads.remove_links,
|
||||
package_ids=[gid],
|
||||
package_ids=jd_downloads[gid]["ids"],
|
||||
)
|
||||
if task := await get_task_by_gid(gid):
|
||||
await task.listener.on_download_error("Download removed manually!")
|
||||
|
@ -112,8 +112,6 @@ def trim_path(path):
|
||||
async def add_jd_download(listener, path):
|
||||
try:
|
||||
async with jd_lock:
|
||||
gid = token_urlsafe(12)
|
||||
jd_downloads[gid] = {"status": "collect", "path": path}
|
||||
if jdownloader.device is None:
|
||||
raise MYJDException(jdownloader.error)
|
||||
|
||||
@ -141,6 +139,10 @@ async def add_jd_download(listener, path):
|
||||
jdownloader.device.linkgrabber.remove_links,
|
||||
package_ids=odl_list,
|
||||
)
|
||||
|
||||
gid = token_urlsafe(12)
|
||||
jd_downloads[gid] = {"status": "collect", "path": path}
|
||||
|
||||
if await aiopath.exists(listener.link):
|
||||
async with aiopen(listener.link, "rb") as dlc:
|
||||
content = await dlc.read()
|
||||
|
@ -182,7 +182,7 @@ class YoutubeDLHelper:
|
||||
)
|
||||
return
|
||||
if self._listener.is_cancelled:
|
||||
raise ValueError
|
||||
return
|
||||
async_to_sync(self._listener.on_download_complete)
|
||||
except ValueError:
|
||||
self._on_download_error("Download Stopped by User!")
|
||||
|
Loading…
Reference in New Issue
Block a user