Fix for case-sensitive contenttype from file extension (#348)
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Tue, 31 May 2022 08:25:38 +0000 (10:25 +0200)
committerGitHub <noreply@github.com>
Tue, 31 May 2022 08:25:38 +0000 (10:25 +0200)
music_assistant/controllers/music/providers/filesystem.py

index e6832fe364b6b313ae05d759cb4d070a7b4d5ad2..904d28a41dc46adcdb3986237f4d2eebb1887bdd 100644 (file)
@@ -224,6 +224,8 @@ class FileSystemProvider(MusicProvider):
         # check if albums are deleted
         for album_id in albums:
             album = await self.mass.music.albums.get_db_item(album_id)
+            if not album:
+                continue
             prov_album_id = next(
                 x.item_id for x in album.provider_ids if x.prov_id == self.id
             )
@@ -430,12 +432,14 @@ class FileSystemProvider(MusicProvider):
             return TinyTag.get(itempath)
 
         tags = await self.mass.loop.run_in_executor(None, parse_tag)
+        _, ext = Path(itempath).name.rsplit(".", 1)
+        content_type = CONTENT_TYPE_EXT.get(ext.lower())
 
         return StreamDetails(
             type=StreamType.FILE,
             provider=self.type,
             item_id=item_id,
-            content_type=ContentType(itempath.split(".")[-1]),
+            content_type=content_type,
             path=itempath,
             sample_rate=tags.samplerate or 44100,
             bit_depth=16,  # TODO: parse bitdepth