aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukáš Lalinský <lalinsky@gmail.com>2011-03-16 22:54:58 +0100
committerLukáš Lalinský <lalinsky@gmail.com>2011-03-16 22:54:58 +0100
commitd3df66f196fe3580de6d1a78f779d4a4309a65b0 (patch)
tree70461f2440167ee1a0d5c3253f5070de167528f6
parent1453a7b157fc88bc6eb28742f67e0ecc70d6dd64 (diff)
Convert TDRC to TYER+TDAT+TIME
-rw-r--r--taglib/mpeg/id3v2/id3v2tag.cpp12
-rw-r--r--tests/test_id3v2.cpp2
2 files changed, 13 insertions, 1 deletions
diff --git a/taglib/mpeg/id3v2/id3v2tag.cpp b/taglib/mpeg/id3v2/id3v2tag.cpp
index 6908c1b0..7286d3c1 100644
--- a/taglib/mpeg/id3v2/id3v2tag.cpp
+++ b/taglib/mpeg/id3v2/id3v2tag.cpp
@@ -383,6 +383,18 @@ void ID3v2::Tag::downgradeFrames(FrameList *frames, FrameList *newFrames) const
frameTYER->setText(content.substr(0, 4));
frames->append(frameTYER);
newFrames->append(frameTYER);
+ if(content.size() >= 10 && content[4] == '-' && content[7] == '-') {
+ ID3v2::TextIdentificationFrame *frameTDAT = new ID3v2::TextIdentificationFrame("TDAT", String::Latin1);
+ frameTDAT->setText(content.substr(8, 2) + content.substr(5, 2));
+ frames->append(frameTDAT);
+ newFrames->append(frameTDAT);
+ if(content.size() >= 16 && content[10] == 'T' && content[13] == ':') {
+ ID3v2::TextIdentificationFrame *frameTIME = new ID3v2::TextIdentificationFrame("TIME", String::Latin1);
+ frameTIME->setText(content.substr(11, 2) + content.substr(14, 2));
+ frames->append(frameTIME);
+ newFrames->append(frameTIME);
+ }
+ }
}
}
// FIXME migrate TIPL and TMCL to IPLS
diff --git a/tests/test_id3v2.cpp b/tests/test_id3v2.cpp
index 84074585..d3adc632 100644
--- a/tests/test_id3v2.cpp
+++ b/tests/test_id3v2.cpp
@@ -486,7 +486,7 @@ public:
tf->setText("2011-03-16");
foo.ID3v2Tag()->addFrame(tf);
tf = new ID3v2::TextIdentificationFrame("TDRC", String::Latin1);
- tf->setText("2012-04-17");
+ tf->setText("2012-04-17T12:01");
foo.ID3v2Tag()->addFrame(tf);
foo.ID3v2Tag()->addFrame(new ID3v2::TextIdentificationFrame("TDRL", String::Latin1));
foo.ID3v2Tag()->addFrame(new ID3v2::TextIdentificationFrame("TDTG", String::Latin1));