mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-19 00:02:11 +00:00
Coroutine fix
This commit is contained in:
@@ -929,7 +929,7 @@ async def get_file(ctx, source, link):
|
|||||||
url_dict["songs"] = file_list
|
url_dict["songs"] = file_list
|
||||||
url_data["urls"].append(url_dict.copy())
|
url_data["urls"].append(url_dict.copy())
|
||||||
file_name_f = youtube_download.default_filename
|
file_name_f = youtube_download.default_filename
|
||||||
youtube_download.download_songs(
|
coro = asyncio.to_thread(youtube_download.download_songs,
|
||||||
songs=url_data,
|
songs=url_data,
|
||||||
output_dir=MUSIC_FOLDER,
|
output_dir=MUSIC_FOLDER,
|
||||||
format_str="bestaudio/best",
|
format_str="bestaudio/best",
|
||||||
@@ -942,6 +942,7 @@ async def get_file(ctx, source, link):
|
|||||||
multi_core=0,
|
multi_core=0,
|
||||||
proxy="",
|
proxy="",
|
||||||
)
|
)
|
||||||
|
_ = await coro
|
||||||
dir_path = (url_dict["save_path"].resolve()).as_posix()
|
dir_path = (url_dict["save_path"].resolve()).as_posix()
|
||||||
if platform == "win32":
|
if platform == "win32":
|
||||||
dir_path = dir_path.replace("/", "\\")
|
dir_path = dir_path.replace("/", "\\")
|
||||||
@@ -995,7 +996,8 @@ async def get_file(ctx, source, link):
|
|||||||
ydl_opts["postprocessors"].append(mp3_postprocess_opts.copy())
|
ydl_opts["postprocessors"].append(mp3_postprocess_opts.copy())
|
||||||
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
||||||
try:
|
try:
|
||||||
ydl.download([query])
|
coro = asyncio.to_thread(ydl.download, [query])
|
||||||
|
_ = await coro
|
||||||
except Exception as exce: # pylint: disable=broad-exception-caught
|
except Exception as exce: # pylint: disable=broad-exception-caught
|
||||||
logger.error(exce)
|
logger.error(exce)
|
||||||
logger.info(
|
logger.info(
|
||||||
@@ -1577,8 +1579,7 @@ async def zagraj_mi_kawalek(ctx):
|
|||||||
async with ctx.typing():
|
async with ctx.typing():
|
||||||
search_time_glob = datetime.now()
|
search_time_glob = datetime.now()
|
||||||
logger.info("Zaczynam szukać timestamp %s", datetime.now())
|
logger.info("Zaczynam szukać timestamp %s", datetime.now())
|
||||||
coro = asyncio.to_thread(wyszukaj,ctx=ctx)
|
file = await wyszukaj(ctx=ctx)
|
||||||
file = await coro
|
|
||||||
logger.info(
|
logger.info(
|
||||||
"Koniec szukania(timestamp %s zajęło %s",
|
"Koniec szukania(timestamp %s zajęło %s",
|
||||||
datetime.now(),
|
datetime.now(),
|
||||||
|
|||||||
Reference in New Issue
Block a user