]> granicus.if.org Git - taglib/commitdiff
Append TIME to TDRC, adjusted test_id3v2.cpp as appropriate.
authorFestus Hagen <festushagen2002@yahoo.com>
Sat, 16 May 2015 20:06:14 +0000 (16:06 -0400)
committerFestus Hagen <festushagen2002@yahoo.com>
Fri, 27 Nov 2015 22:54:20 +0000 (17:54 -0500)
taglib/mpeg/id3v2/id3v2framefactory.cpp
tests/test_id3v2.cpp

index 1282d228cf1f0888e3612f0afe839bf70b78f667..a462e21b4fad9bfadd83d83bbaac870480f625d5 100644 (file)
@@ -336,18 +336,27 @@ void FrameFactory::rebuildAggregateFrames(ID3v2::Tag *tag) const
      tag->frameList("TDRC").size() == 1 &&
      tag->frameList("TDAT").size() == 1)
   {
-    TextIdentificationFrame *trdc =
+    TextIdentificationFrame *tdrc =
       static_cast<TextIdentificationFrame *>(tag->frameList("TDRC").front());
-    UnknownFrame *tdat =
-      static_cast<UnknownFrame *>(tag->frameList("TDAT").front());
+    UnknownFrame *tdat = static_cast<UnknownFrame *>(tag->frameList("TDAT").front());
 
-    if(trdc->fieldList().size() == 1 &&
-       trdc->fieldList().front().size() == 4 &&
+    if(tdrc->fieldList().size() == 1 &&
+       tdrc->fieldList().front().size() == 4 &&
        tdat->data().size() >= 5)
     {
       String date(tdat->data().mid(1), String::Type(tdat->data()[0]));
-      if(date.length() == 4)
-        trdc->setText(trdc->toString() + '-' + date.substr(2, 2) + '-' + date.substr(0, 2));
+      if(date.length() == 4) {
+        tdrc->setText(tdrc->toString() + '-' + date.substr(2, 2) + '-' + date.substr(0, 2));
+        if(tag->frameList("TIME").size() == 1) {
+          UnknownFrame *timeframe = static_cast<UnknownFrame *>(tag->frameList("TIME").front());
+          if(timeframe->data().size() >= 5) {
+            String time(timeframe->data().mid(1), String::Type(timeframe->data()[0]));
+            if(time.length() == 4) {
+              tdrc->setText(tdrc->toString() + 'T' + time.substr(0, 2) + ':' + time.substr(2, 2));
+            }
+          }
+        }
+      }
     }
   }
 }
@@ -533,3 +542,4 @@ bool FrameFactory::updateFrame(Frame::Header *header) const
 
   return true;
 }
+
index c6592bbea3bb7de2986698183aa7c665ed760502..cf2e854bc354a8b8c17d82ca632b7f01febece73 100644 (file)
@@ -690,7 +690,7 @@ public:
       tf = static_cast<ID3v2::TextIdentificationFrame *>(bar.ID3v2Tag()->frameList("TDRC").front());
       CPPUNIT_ASSERT(tf);
       CPPUNIT_ASSERT_EQUAL(TagLib::uint(1), tf->fieldList().size());
-      CPPUNIT_ASSERT_EQUAL(String("2012-04-17"), tf->fieldList().front());
+      CPPUNIT_ASSERT_EQUAL(String("2012-04-17T12:01"), tf->fieldList().front());
       tf = dynamic_cast<ID3v2::TextIdentificationFrame *>(bar.ID3v2Tag()->frameList("TIPL").front());
       CPPUNIT_ASSERT(tf);
       CPPUNIT_ASSERT_EQUAL(TagLib::uint(8), tf->fieldList().size());