From c4cc4f75353e416373565170d3aed778c2180f0f Mon Sep 17 00:00:00 2001 From: OzGav Date: Mon, 17 Nov 2025 05:15:09 +1000 Subject: [PATCH] Handle non-UTF8 .lrc files gracefully to prevent playback blocking (#2640) --- .../providers/filesystem_local/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/music_assistant/providers/filesystem_local/__init__.py b/music_assistant/providers/filesystem_local/__init__.py index 500cf579..cb786c29 100644 --- a/music_assistant/providers/filesystem_local/__init__.py +++ b/music_assistant/providers/filesystem_local/__init__.py @@ -995,8 +995,15 @@ class LocalFileSystemProvider(MusicProvider): assert file_item.ext is not None # for type checking lrc_path = f"{file_item.absolute_path.removesuffix(file_item.ext)}lrc" if await self.exists(lrc_path): - async with aiofiles.open(lrc_path) as lrc_file: - track.metadata.lrc_lyrics = await lrc_file.read() + try: + async with aiofiles.open(lrc_path, encoding="utf-8") as lrc_file: + track.metadata.lrc_lyrics = await lrc_file.read() + except Exception as err: + self.logger.warning( + "Failed to read lyrics file %s: %s", + lrc_path, + str(err), + ) return track -- 2.34.1