From 1299545bc600a5c1b328f3c0b575613771a4cf4b Mon Sep 17 00:00:00 2001 From: Krutyi 4el <60041069+Krutyi-4el@users.noreply.github.com> Date: Sat, 18 Nov 2023 13:05:53 +0200 Subject: [PATCH 1/3] treat empty playlists as invalid --- musicbot/audiocontroller.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/musicbot/audiocontroller.py b/musicbot/audiocontroller.py index b5d09635..5f5cb024 100644 --- a/musicbot/audiocontroller.py +++ b/musicbot/audiocontroller.py @@ -351,16 +351,16 @@ async def process_song(self, track: str) -> Optional[Song]: Starts playing if it is the first song""" loaded_song = await loader.load_song(track) - if isinstance(loaded_song, Song): + if not loaded_song: + return None + elif isinstance(loaded_song, Song): self.playlist.add(loaded_song) - elif isinstance(loaded_song, list): + else: for song in loaded_song: self.playlist.add(song) loaded_song = Song( linkutils.Origins.Playlist, linkutils.Sites.Unknown ) - else: - return None if self.current_song is None: print("Playing {}".format(track)) From 6f96f974f64ba198fd669979e4af2caaf030a35b Mon Sep 17 00:00:00 2001 From: Krutyi 4el <60041069+Krutyi-4el@users.noreply.github.com> Date: Sat, 18 Nov 2023 13:21:26 +0200 Subject: [PATCH 2/3] fix Spotify playlists without query part --- musicbot/linkutils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/musicbot/linkutils.py b/musicbot/linkutils.py index 3cc856f1..19da22dd 100644 --- a/musicbot/linkutils.py +++ b/musicbot/linkutils.py @@ -99,7 +99,9 @@ async def get_spotify_playlist(url: str) -> list: ) async with aiohttp.ClientSession(headers=headers) as session: - async with session.get(url + "&nd=1") as response: + if "?si=" in url: + url += "&nd=1" + async with session.get(url) as response: page = await response.text() soup = BeautifulSoup(page, "html.parser") From d9b55ec77774ae62e8a1e01088c6cbb1312b2d56 Mon Sep 17 00:00:00 2001 From: Krutyi 4el <60041069+Krutyi-4el@users.noreply.github.com> Date: Sat, 18 Nov 2023 13:26:47 +0200 Subject: [PATCH 3/3] redirect FFmpeg stderr to bot stderr --- musicbot/audiocontroller.py | 1 + 1 file changed, 1 insertion(+) diff --git a/musicbot/audiocontroller.py b/musicbot/audiocontroller.py index 5f5cb024..1b260653 100644 --- a/musicbot/audiocontroller.py +++ b/musicbot/audiocontroller.py @@ -327,6 +327,7 @@ async def play_song(self, song: Song): before_options="-reconnect 1 -reconnect_streamed 1" " -reconnect_delay_max 5", options="-loglevel error", + stderr=sys.stderr, ), after=self.next_song, )