1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-01 15:43:44 +02:00

When libid3tag encounters the "TYER" tag, it converts it to a

"ZOBS" (obsolete) tag and adds a "TDRC" tag at the end of the
list of tags using the first 4 characters of the "TYER" tag.
Since we write both the "TDRC" and "TYER" tags, the "TDRC" tag
will always be encountered first in the list.  We want use it
since the converted "TYER" tag may have been truncated.
This commit is contained in:
lllucius 2011-03-02 08:47:45 +00:00
parent 60af76d2b3
commit 8d4fb73452
2 changed files with 22 additions and 6 deletions

View File

@ -304,6 +304,7 @@ void MP3ImportFileHandle::ImportID3(Tags *tags)
tags->Clear();
// Loop through all frames
bool have_year = false;
for (int i = 0; i < (int) tp->nframes; i++) {
struct id3_frame *frame = tp->frames[i];
@ -333,11 +334,18 @@ void MP3ImportFileHandle::ImportID3(Tags *tags)
else if (strcmp(frame->id, ID3_FRAME_TRACK) == 0) {
n = TAG_TRACK;
}
else if (strcmp(frame->id, "TYER") == 0) {
n = TAG_YEAR;
}
else if (strcmp(frame->id, ID3_FRAME_YEAR) == 0) {
// LLL: When libid3tag encounters the "TYER" tag, it converts it to a
// "ZOBS" (obsolete) tag and adds a "TDRC" tag at the end of the
// list of tags using the first 4 characters of the "TYER" tag.
// Since we write both the "TDRC" and "TYER" tags, the "TDRC" tag
// will always be encountered first in the list. We want use it
// since the converted "TYER" tag may have been truncated.
if (have_year) {
continue;
}
n = TAG_YEAR;
have_year = true;
}
else if (strcmp(frame->id, ID3_FRAME_COMMENT) == 0) {
n = TAG_COMMENTS;

View File

@ -415,6 +415,7 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
}
// Loop through all frames
bool have_year = false;
for (int i = 0; i < (int) tp->nframes; i++) {
struct id3_frame *frame = tp->frames[i];
@ -444,11 +445,18 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
else if (strcmp(frame->id, ID3_FRAME_TRACK) == 0) {
n = TAG_TRACK;
}
else if (strcmp(frame->id, "TYER") == 0) {
n = TAG_YEAR;
}
else if (strcmp(frame->id, ID3_FRAME_YEAR) == 0) {
// LLL: When libid3tag encounters the "TYER" tag, it converts it to a
// "ZOBS" (obsolete) tag and adds a "TDRC" tag at the end of the
// list of tags using the first 4 characters of the "TYER" tag.
// Since we write both the "TDRC" and "TYER" tags, the "TDRC" tag
// will always be encountered first in the list. We want use it
// since the converted "TYER" tag may have been truncated.
if (have_year) {
continue;
}
n = TAG_YEAR;
have_year = true;
}
else if (strcmp(frame->id, ID3_FRAME_COMMENT) == 0) {
n = TAG_COMMENTS;