Skip to content

Commit

Permalink
ID3v2 : Don't read numerical composer tag as a Genre [#285]
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeugma440 committed Oct 25, 2024
1 parent 0e2034e commit 02e37d8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ATL/AudioData/IO/ID3v2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ Frame size encoding conventions
strData = Utils.StripEndingZeroChars(frameEncoding.GetString(bData));

// Parse GENRE frame
if (Frame.ID.StartsWith("TCO")) strData = extractGenreFromID3v2Code(strData);
if (isGenreField(Frame.ID, m_tagVersion)) strData = extractGenreFromID3v2Code(strData);
// Parse Involved People frame for ID3v2.2-2.3 (IPL/IPLS) where value separator is a \0
else if (Frame.ID.StartsWith("IPL"))
{
Expand Down Expand Up @@ -1933,7 +1933,7 @@ private void writeTextFrame(
}
else if (value.Contains(Settings.DisplayValueSeparator + ""))
{
if (frameCode.StartsWith("TCO")) // Genre
if (isGenreField(frameCode, Settings.ID3v2_tagSubVersion)) // Genre
{
// Separating values with \0 is actually specific to ID3v2.4 but seems to have become the de facto standard
// If something ever goes wrong with multiples values in ID3v2.3, remember their spec separates values with ()'s
Expand Down Expand Up @@ -2428,5 +2428,11 @@ private static bool isUpperAlpha(string str)
}
return true;
}

private static bool isGenreField(string field, int tagVersion)
{
if (2 == tagVersion) return field.Equals("TCO", StringComparison.OrdinalIgnoreCase);
else return field.Equals("TCON", StringComparison.OrdinalIgnoreCase);
}
}
}

0 comments on commit 02e37d8

Please sign in to comment.