Zeugma440 / atldotnet

Fully managed, portable and easy-to-use C# library to read and edit audio data and metadata (tags) from various audio formats, playlists and CUE sheets
MIT License
440 stars 60 forks source link

Re-creating Track.AdditionalFields causes tag duplication #260

Closed GOATS2K closed 2 months ago

GOATS2K commented 3 months ago

The problem

Tags written with Track.AdditionalFields get duplicated upon re-saving with changes.

Environment

Code To Reproduce Issue [ Good To Have ]

Consider this scenario, a track initially gets tagged like this:

track.AdditionalFields = new Dictionary<string, string>()
        {
            { "CATALOGNUMBER",  "CAT1" }
        };
track.Save();

Then, the user updates the catalog number:

track.AdditionalFields = new Dictionary<string, string>()
        {
            { "CATALOGNUMBER",  "CAT2" }
        };
track.Save();

Observe that the CATALOGNUMBER field has been duplicated in the file (flac), and contains both CAT1 and CAT2.

GOATS2K commented 3 months ago

Aha, I just realized that Track already has ISRC and CatalogNumber tags - using those instead bypasses the duplication issue. I still think this'd be good to fix though. :)

Zeugma440 commented 2 months ago

Thanks. This is a specific bug that happens on any tagging format when you update the value of a standard field using AdditionalFields instead of using the standard property (e.g. track.AdditionalFields["CATALOGNUMBER"] = "CAT1" instead of track.CatalogNumber = "CAT1").

The issue has been fixed and the fix will be available on next release ✅

Zeugma440 commented 2 months ago

Fix is available on today's v5.22.

Please close the issue if it works on your side~