Easy way to detect multiple (same) tag fields?

I recently found that one of the programs in my tagging chain must be messing up something—more and more files appear that have more than one YEAR or GENRE field, when they should have only one.

I need to diagnose and find the fault quickly, otherwise I’ll probably mess up even more files when correcting.

My first idea was to use a new column containing something like

$if($strstr($meta_sep(%_tag%,||),||),Multiple Tags!,Okay)

(using || as a separator since this will not exist in my normal files)

but apparently

  1. $meta_sep() uses tag names without the % (Why?)
  2. names like %_tag% or _TAG cannot be used
Is there any way to easily detect if any of the tag fields in the file exist more than once?
(…without building an endless chain of all known tags in the world?)

EDIT: I wonder. Just cross-checked using metamp3 and the file seems not to have a second TYER tag. Could it be a bug in Mp3tag (v2.42b)?

 ID3v2.3 tags:

   TALB: Kein Blick zurück (disc 2)
   TPE1: Blind
   TBPM: 162
   COMM: []{eng}: Release Date: 2006-12-08
   TCON: Gothic Rock
   TCMP: 1
   TORY: 2006
   TIT2: Ave Maria
   TRCK: 1/8
   UFID: , 36 bytes
   TYER: 2006
   TXXX: [MusicIP PUID]: 7f327602-51f0-d906-0fc9-6eeef409db10
   TXXX: [MusicBrainz Artist Id]: 06ef4a03-46b1-4e06-91da-1ace6dd0f59f
   TXXX: [MusicBrainz Album Artist]: Various Artists
   TXXX: [MusicBrainz Album Artist Id]: 89ad4ac3-39f7-470e-963a-56509c546377
   TXXX: [MusicBrainz Album Id]: 2c0b576a-f129-478f-bf18-9a3ae69d7aa8
   TXXX: [MusicBrainz Album Status]: official
   TXXX: [MusicBrainz Album Type]: compilation
   TXXX: [MusicBrainz Non-Album]: 0
   TXXX: [ALBUMARTISTSORT]: Various Artists
   TXXX: [MusicMagic Data]: AQEBepwkyIqWEbgVgxrVYmwdgAGCB4euzq+U9Wqc0tEbfqSTheTYSapaGK6zIJZ+gF+AAVXUhkhJxfSJ
   TXXX: [MusicMagic Fingerprint]: ASurSlg2zSaIGpEd2RNNDLMN5QoND7wKrwgXCuwG+wpCBmUKCgUACScPfwvJCcsK5wg8BcYG/QZ4BxQH0wYFBaIFiwUQBCEDowMiAuwCqAKjpA71bQS2MCtCb/9pAg7/VxQhCfoH9fUt/9MJnQJpB9UFLPovAB8GNAV+Ar8DTv6mA2sCPgAgAi4AwgC+AvQCNgHRAmICIgGQAbYBoAF5AOcY/L3M/JwOOQzIXOoGjfOJ+10CRyiqBw78/fUO/isCj/4A9Nb8xPrZ/jL8xv41A5AEBf9Q/Yz9kv1QBukDfQCBADkBDgGCAI4AbwBlAQMAztBZSSDoFeCp54QwKO5Q+lfrZvnNJ7vy3/gw8Nz6UQIB/JfmjPve8o7z+vKw+Vf9BP0C/RP55PqN+EQAdf9M/Zv8vP2v/yP/QP7e/sf+5f9VJ+IV38uR5f9OtAI7AMf5jSXKAzjtTPUV+jv+U/sJ47b5bPHE+sfxneps62/1PQNCAyr7g/nl/Tv26/lM+wP5pfiO+gf8mf29/pX+eP9K/zf40/nOT2sC6wIc/hgVp/Wk9Fn2seoe+5L+2vOv9YXjxvvJ3AT5v+anx7fedvAY+Nb4dPiL+aH3IvIQ9KD1v/au9AL2nPrb/f39zf58/pv/NAv68Z4xWMXXJjzgGcuQ7Lf96QR3NNrs/vYH+nYCeBvoA+z4MP01AnQNxAcb/7T/ywXuAg392QFsAPwHlQWPAywFOANbAaoAev/Q/67/lf9iQx8bEA==
   TXXX: [XFade]: &bmp=161,99
   APIC: []{0=Other}: image/jpeg, 4807 bytes
   XSOP: (unknown frame)
   XDOR: (unknown frame)
   TXXX: [replaygain_track_gain]: -10.81 dB
   TXXX: [replaygain_track_peak]: 1.139400
   TXXX: [replaygain_album_gain]: -10.80 dB
   TXXX: [replaygain_album_peak]: 1.210151

(Track #1 of In Extremo’s »Kein Blick zurück« disc 2)

With this file, Mp3tag shows a YEAR of 2006\\2006 in the tag panel. (Which of course led me to the conclusion that I have two YEAR fields. Extended tag view also shows two times YEAR.)

For copyright reasons, I cannot include the original file for testing, but I succeeded reproducing the effect by copying the tag (CTRL+C, CTRL+V) onto a test file containing 5s of pink noise, which I attach.

(For those who wonder: XSOP and XDOR are the TSOP and TDOR equivalents MusicBrainz’ Picard currently uses when writing to ID3v2.3.)

Test___Pink_Noise.mp3 (70.9 KB)

Field names beginning with an underscore _ denote information fields (not tag fields). So you can use %genre% or GENRE with $meta_sep().

To give a definite answer, I'd need to have a look at this file by myself.

Edit: The file you've provided has one TYER frame containing two values (2006).

Wow. High-speed support on Silvester day—thanks, Florian, and »Ein gutes und erfolgreiches Neues!«

You’re right. TYER contains »2006« twice, neatly separated by a NUL. (I could have checked that myself, dummy me …) [Just checked the original file as well, same here.]

So the question still is »whodunnit?« and how to easily detect multiple (same) tags or tags with multiple values. Any ideas?

(I’ve seen that lately with YEAR, ARTIST and GENRE in my collection, and didn’t really change my workflow during the last months, except for installing Mp3tag 2.42b over 2.42, and installing Picard 0.11 over 0.10. Unfortunately, I don’t yet find a sure way to reproduce it—could be MP3tag, MixMeister BPM Analyzer, Rapid Evolution 2, metamp3, or Picard. Can’t nail it down…)

Is one of your tools writing ID3v2.4 tags with a year in TYER and one in TDRC?

I'm asking, because ID3v2.4 only has TDRC and Mp3tag reads this as YEAR (but it also reads TYER frames from ID3v2.4). But if you save the files using ID3v2.3, Mp3tag will convert the TDRC from ID3v2.4 to TYER (since TDRC is not available in ID3v2.3).

Just guessing... :slight_smile:

Hm … good guess (and, hee hee, nice to know that you read TSOP and TDRC in ID3v2.3!). At least RE2, Picard and metamp3 are capable of reading/writing ID3v2.4, and all know of TDRC. Still (I checked) they all write to ID3v2.3 here. But maybe I should check if one or the other actually writes ID3v2.4 tag frames into ID3v2.3 as well …

Guess I’ll set up a test case for that and come back with my findings. May take a few days, though …

I’ve got the feeling in my guts that I should suspect Picard 0.11, I guess they work in ID3v2.4/UTF-8 internally and then convert it into ID3v2.3/ISO if so requested. Gotta get out the sources and grep a little, I guess … or run a diff against v0.10.

(I must really remember now, if ever I switch to ID3v2.4, to put TYER+TDAT into TDRL instead, since most applications/users store the release, not the recording date into TYER+TDAT. And I even use TORY for the year of the first release which then must go into TDOR. Phew.)

Just tried (using 2.42b) a column in column view:
works, but

Just FYI.

For quick-fixing the »most suspect« tags, I’m now using a column called »Multiple Tag Fields?«


until someone comes up with a more general approach (it would just be too nice if one could use _tag for that :rolleyes: )

EDIT: Lucky me. »Only« 195 files out of ~25,000 messed up. Warning: A construct like the above in column view takes an endless time if you sort on this column in a larger collection!

EDIT 2: I found some in which most ID3v2.3 tags seem duplicated. Unfortunately, it’s impossible to just copy the tags over into the test file. It seems that any one application that wrote to that file was unable to see the tags that were there before, and wrote a complete second set of tags (the YEAR is different even). I wonder who’s to blame. [Florian: Sent you a mail with test data.]

Hi Moonbase,
It looks like the culprit is MusicIP

All "year" tags are doubled after analysis if ID3v2.4 UTF-8 - once MUSICMAGIC DATA and MUSICMAGIC FINGERPRINT tags are saved.
I do not have any duplication when using ID3v2.3 ISO-8859-1 or UTF-16 with or without APE tags

In the duplication cases, year contains string (4) "2000" whilst recording_time contains string (9) "2000 2000" - only data field of TDRC