To add substitute yt-dlp, and return more search results.

This commit is contained in:
scoob 2023-02-25 21:57:54 -05:00
parent 665468a1a6
commit 4375c0d0a3
3 changed files with 6 additions and 5 deletions

View File

@ -159,7 +159,7 @@ class Commands:
else: else:
random.shuffle(songs) random.shuffle(songs)
await send_message(target, "Multiple found:") await send_message(target, "Multiple found:")
for s in songs[:4]: for s in songs[:8]:
await send_message(target, f"{s.utube_id} | {s.title}") await send_message(target, f"{s.utube_id} | {s.title}")
@staticmethod @staticmethod

View File

@ -38,7 +38,8 @@ class YouTube:
proc = await asyncio.create_subprocess_exec( proc = await asyncio.create_subprocess_exec(
*[ *[
#"/home/radio/ircradio/venv/bin/youtube-dl", #"/home/radio/ircradio/venv/bin/youtube-dl",
"youtube-dl", "/home/radio/ircradio/venv/bin/yt-dlp",
#"yt-dlp",
"--add-metadata", "--add-metadata",
"--write-all-thumbnails", "--write-all-thumbnails",
"--write-info-json", "--write-info-json",
@ -46,7 +47,7 @@ class YouTube:
"--max-filesize", "30M", "--max-filesize", "30M",
"--extract-audio", "--extract-audio",
"--audio-format", "vorbis", "--audio-format", "vorbis",
"-o", f"{settings.dir_music}/%(id)s.ogg", "-o", f"{settings.dir_music}/%(id)s",
f"https://www.youtube.com/watch?v={utube_id}"], f"https://www.youtube.com/watch?v={utube_id}"],
stdout=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE) stderr=asyncio.subprocess.PIPE)
@ -134,7 +135,7 @@ class YouTube:
async def update(): async def update():
pip_path = os.path.join(os.path.dirname(sys.executable), "pip") pip_path = os.path.join(os.path.dirname(sys.executable), "pip")
proc = await asyncio.create_subprocess_exec( proc = await asyncio.create_subprocess_exec(
*[sys.executable, pip_path, "install", "--upgrade", "youtube-dl"], *[sys.executable, pip_path, "install", "--upgrade", "yt-dlp"],
stdout=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE) stderr=asyncio.subprocess.PIPE)
stdout, stderr = await proc.communicate() stdout, stderr = await proc.communicate()

View File

@ -1,5 +1,5 @@
quart quart
youtube-dl yt-dlp
aiofiles aiofiles
aiohttp aiohttp
bottom bottom