Add local lrc lyrics parsing to filesystem provider (#2166)
authorFabian Munkes <105975993+fmunkes@users.noreply.github.com>
Sun, 4 May 2025 19:28:07 +0000 (21:28 +0200)
committerGitHub <noreply@github.com>
Sun, 4 May 2025 19:28:07 +0000 (21:28 +0200)
music_assistant/providers/filesystem_local/__init__.py

index d0ca6ef751beb0cccc637f2ae00830b1b0093511..1595c26f58eda4d0037b84abe0c013e2ce50484c 100644 (file)
@@ -971,6 +971,16 @@ class LocalFileSystemProvider(MusicProvider):
                     tags.track_album_loudness,
                 )
             )
+
+        # possible lrclib metadata
+        # synced lyrics are saved as "filename.lrc" by lrcget alongside
+        # the actual file location - just change the file extension
+        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()
+
         return track
 
     async def _parse_artist(