From: OzGav Date: Sun, 16 Nov 2025 19:15:09 +0000 (+1000) Subject: Handle non-UTF8 .lrc files gracefully to prevent playback blocking (#2640) X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=c4cc4f75353e416373565170d3aed778c2180f0f;p=music-assistant-server.git Handle non-UTF8 .lrc files gracefully to prevent playback blocking (#2640) --- 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