Fix: Always prefer ID3 tags
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Mon, 17 Feb 2025 11:58:21 +0000 (12:58 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Mon, 17 Feb 2025 11:58:21 +0000 (12:58 +0100)
music_assistant/helpers/tags.py

index 6ff8ece5d099cde88bfd870cb58a0fa457001aed..987cdf115d5760fc38dcbfc1d996c70d5c6d4c6f 100644 (file)
@@ -392,10 +392,14 @@ class AudioTags:
             x for x in raw["streams"] if x.get("codec_name", "") in ("mjpeg", "png")
         )
         # convert all tag-keys (gathered from all streams) to lowercase without spaces
+        # prefer format as that contains the actual ID3 tags
+        # append any tags found in streams (but don't overwrite format tags)
         tags = {}
-        for stream in raw["streams"] + [raw["format"]]:
+        for stream in [raw["format"]] + raw["streams"]:
             for key, value in stream.get("tags", {}).items():
                 alt_key = key.lower().replace(" ", "").replace("_", "").replace("-", "")
+                if alt_key in tags:
+                    continue
                 tags[alt_key] = value
 
         return AudioTags(