Skip to main content


Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Bug in tags: Date/Year (Read 5453 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Bug in tags: Date/Year

Hi. I've found a bug in the way foobar handles the DATE tag, and it's totally reproducible. (So maybe it's a design feature and not a bug, hm.) I find it very annoying.

(1) When you add a tag called YEAR to an audio file (using the infobox or special infobox, doesn't matter), (2) write changes to file, (3) and then click "refresh", (4) the YEAR tag has disappeared. Instead, the value that you wrote into YEAR is now shown in the DATE tag (and the value that was in the DATE tag before has been erased).

It's reproducible on two computers with different installations of foobar. The components involved (I think) are foobar 0.8.3, MPEG 4-AAC decoder 2.1 (foo_input_std). My preferences setting on the page of Playback/Input/Standard Inputs are write APEv2 and ID3v1.

Additional information: step (2) above modifies the sound file. steps (3) and (4) don't. So maybe it's a database issue rather than a file tagging issue.

My question/problem: Is it "safe" to use the DATE and YEAR tags, when the DATE info is unexpectedly discarded and replaced by the YEAR tag's value?

Bug in tags: Date/Year

Reply #1
I've just tried this on an MPC and had strange behaviour but not quite what you describe; I add a 'YEAR' tag to a file which already has a 'DATE' tag and press 'Reload info from file' only to see the YEAR tag disappear. However, unlike your problem my DATE tag hasn't changed from its previous settings.

I'm only using APEv2 tags.


Bug in tags: Date/Year

Reply #2
APEv2 uses the YEAR tag for the same purposes as Vorbis Comments do with DATE: storing the release date of a ercording. It uses the name YEAR for compatiblity with the APEv1 tags. The APEv2 handling code in foo_input_std translates between the YEAR and DATE names when reading and writing metadata. So it's not a bug, but a feature.

If you have both a YEAR and a DATE tag, I think it depends on their relative order which one will be preserved.

Bug in tags: Date/Year

Reply #3
fb2k's APEv2 tag writer maps DATE to APEv2's Year field. There is no reason why you'd want to use both of them, use 'Record Date' if you need something more specific.
"To understand me, you'll have to swallow a world." Or maybe your words.

Bug in tags: Date/Year

Reply #4
OK. So it's by design. That means, if I want to use APEv2 tags, I cannot use both DATE and YEAR tag in the same file, right? Can I switch that conversion YEAR->DATE off somewhere?

As a fix, I'll copy all the YEAR tags to the DATE tag, and delete YEAR then. (Or will this delete DATE as well?)

Are there any other tag names that I cannot use? So far I was under the impression that the tag names don't change in such obscure ways as above.

Thanks for your helpful replies. Whose idea was it to believe that a tag that's meant to store YEAR should be equivalent to a tag that stores DATE?

Bug in tags: Date/Year

Reply #5
Different tagging formats use different standard field names, so they are mapped to common names for fb2k.
The tag you'd want to use is called 'Record Date' as defined by the APEv2 standard.
"To understand me, you'll have to swallow a world." Or maybe your words.

Bug in tags: Date/Year

Reply #6
OK, I guess I'll have to live with that. Thanks for the in-depth replies you all gave me :-)

I originally wanted to put the exact date of recording/release/publication into DATE, and when I only know the year of it I wanted to put the year into YEAR. That's why I find it so confusing that YEAR and DATE are identified.

I think I'll just stick the YEAR into DATE now, maybe like 2004xxxx when I don't know the rest of the date.

Bug in tags: Date/Year

Reply #7
The problem is that different tagging standards define different solutions for such situations:
Vorbis Comment only defines one field for dates named DATE. When you use DATE in fb2k it will be written in the Vorbis comment DATE field.
APEv2 defines 'Year' and 'Record Date' fields. DATE will be mapped to 'Year' by fb2k. You can create another field named 'Record Date' if you need the redundant/additional information.
ID3v2.3 defines TDAT and TYER frames. If DATE is only 4 digits long it will be written to TYER otherwise it will be written to TDAT.

So actually fb2k's behaviour makes a lot of sense and the user's life a lot easier.
"To understand me, you'll have to swallow a world." Or maybe your words.


Bug in tags: Date/Year

Reply #8
Elaborating on the ID3v2 date tag handling, it writes TYER if DATE is only a single span of digits. Otherwise, it writes the largest span of digits, value-wise, to TYER and writes the whole thing to TDAT.

Although, according to the standard, I should be writing exactly four digits to each, yyyy to TYER, mmdd to TDAT, but it's kind of hard to do that when supplied a date or year as a freeform string which can be in any format. I suppose a standardized tag format in this style is easier to read from in the end, if you expect every tag to follow the spec to the letter.

Bug in tags: Date/Year

Reply #9
kode54, I know you're the expert on foobar and (I imagine so) audio file formats in general, and I trust your judgement completely.

I also see that, if different tag-writing standards have defined different names for fields to record the same information, then you somehow want to represent the information in the "file info" dialogues, and not the whims of tag definition committees etc.

Your solution, that of representing by the DATE input field tag fields such as date and year and TYER and who knows what else, is certainly an acceptable one.

However, you are making the assumptions that certain tags are identifiable from one standard to another - like, YEAR in APEv2 and DATE in ID3. So in a way you are defining your own standard. It is not that your way of doing it is in any way more generally valid than the way any one particular standard of tagging is. That's why I think it's necessary that you define the standard tags that you are using.

As a hypothetical extension to this discussion, let's suppose that some new and widely popular tagging style comes along, call it the EXIT5 tag, and in it you store the GENRE value in a tag called Compilation. (Because the authors of this tagging standard thought that people would like to make music compilations in their mp3 players that probably are sorted by genre.)

If you wanted to add support for this hypothetical tagging standard into foobar, would you want to save to the GENRE tag everything that people enter into a tag called COMPILATION? It's the same issue with YEAR... maybe my formatting strings expect YEAR to be four-digit because ID3v2 says so, and then they won't work if somebody has saved a date to a tag called TYER in an APEv2 tag.

The moral of this example is, you can't just simply rename tag names because one tagging format does this and another does that, UNLESS the definitions for the tags are the same and there are no conflicting issues about the tag names. I would strongly suggest to add an option to foobar that allows one to switch off the automatic tag name conversion.

Alternatively, you should restrict the input in the tagging infobox tool so that invalid tags are either rejected or do not appear. For example, by your logic, if I wanted to write "1492-10-11" to a tag called YEAR, this should be rejected. And in the least, if I did add a YEAR tag to a file, there should never be a YEAR tag displayed in the "other fields" section of the infobox because the information that I just entered has already been gobbled up by the DATE tag, which has its own display area.

I'm sorry for sounding so harsh on these suggestions, but I find formal oddities like these very annoying. It's impressive that you can get handling of all these different tagging formats under one roof in foobar, but the issue of tag names has to be improved.

Bug in tags: Date/Year

Reply #10
I'm sorry for sounding so harsh on these suggestions, but I find formal oddities like these very annoying. It's impressive that you can get handling of all these different tagging formats under one roof in foobar, but the issue of tag names has to be improved.[a href="index.php?act=findpost&pid=281012"][{POST_SNAPBACK}][/a]

Hardly. Stop using ID3v2. It sucks. Problem solved. Okay, so you've got interoperability issues. Bug the coder of the other program to switch, or provide some other mechanism for switching over. Hell, with some Tagz hacking, you could get fb2k to output information in CSV format. Get the coder of your other program to support alternatives.

@kode54: this might be a bit much, but having a user-configurable table of the mappings from APEv2 to ID3v2 would eliminate a lot of user annoyance like this. Let them deal with ID3v2 lunacy. I'm thinking two columns, one with the ID3v2 tag field, and one with a Tagz string that'll be stored in that field?