From 4375c0d0a39b4387d4f9f0d2d4b94cdf0236a51d Mon Sep 17 00:00:00 2001 From: scoob Date: Sat, 25 Feb 2023 21:57:54 -0500 Subject: [PATCH] To add substitute yt-dlp, and return more search results. --- ircradio/irc.py | 2 +- ircradio/youtube.py | 7 ++++--- requirements.txt | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ircradio/irc.py b/ircradio/irc.py index cb4997e..6ffe844 100644 --- a/ircradio/irc.py +++ b/ircradio/irc.py @@ -159,7 +159,7 @@ class Commands: else: random.shuffle(songs) 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}") @staticmethod diff --git a/ircradio/youtube.py b/ircradio/youtube.py index 60b9d04..90bdf79 100644 --- a/ircradio/youtube.py +++ b/ircradio/youtube.py @@ -38,7 +38,8 @@ class YouTube: proc = await asyncio.create_subprocess_exec( *[ #"/home/radio/ircradio/venv/bin/youtube-dl", - "youtube-dl", + "/home/radio/ircradio/venv/bin/yt-dlp", + #"yt-dlp", "--add-metadata", "--write-all-thumbnails", "--write-info-json", @@ -46,7 +47,7 @@ class YouTube: "--max-filesize", "30M", "--extract-audio", "--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}"], stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) @@ -134,7 +135,7 @@ class YouTube: async def update(): pip_path = os.path.join(os.path.dirname(sys.executable), "pip") 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, stderr=asyncio.subprocess.PIPE) stdout, stderr = await proc.communicate() diff --git a/requirements.txt b/requirements.txt index b58bb7e..359f909 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ quart -youtube-dl +yt-dlp aiofiles aiohttp bottom