Skip to content

Commit 552af88

Browse files
fix(player.py): handle case when current track is not set before fetching lyrics
1 parent f12ff1c commit 552af88

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lava/classes/player.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
from re import S
23
from typing import TYPE_CHECKING, Optional, Union
34

45
import pylrc
@@ -56,8 +57,13 @@ async def fetch_and_update_lyrics(self) -> Union[Lyrics[LyricLine], None]:
5657
if self.lyrics is not None:
5758
return self.lyrics
5859

60+
if not self.current:
61+
return None
62+
5963
try:
60-
lrc = syncedlyrics.search(f"{self.current.title} {self.current.author}")
64+
lrc = await self.bot.loop.run_in_executor(
65+
None, syncedlyrics.search, f"{self.current.title} {self.current.author}"
66+
)
6167
except Exception:
6268
return MISSING
6369

0 commit comments

Comments
 (0)