diff --git a/taglib/mpeg/id3v2/frames/commentsframe.cpp b/taglib/mpeg/id3v2/frames/commentsframe.cpp index 2b59db4d..2c6c49f9 100644 --- a/taglib/mpeg/id3v2/frames/commentsframe.cpp +++ b/taglib/mpeg/id3v2/frames/commentsframe.cpp @@ -114,9 +114,9 @@ PropertyMap CommentsFrame::asProperties() const { String key = PropertyMap::prepareKey(description()); PropertyMap map; - if(key.isEmpty()) - key = "COMMENT"; - if(key.isNull()) + if(key.isEmpty() || key == "COMMENT") + map.insert("COMMENT", text()); + else if(key.isNull()) map.unsupportedData().append(L"COMM/" + description()); else map.insert("COMMENT:" + key, text()); diff --git a/taglib/mpeg/id3v2/frames/urllinkframe.cpp b/taglib/mpeg/id3v2/frames/urllinkframe.cpp index f06a04dd..5e4f2db7 100644 --- a/taglib/mpeg/id3v2/frames/urllinkframe.cpp +++ b/taglib/mpeg/id3v2/frames/urllinkframe.cpp @@ -156,12 +156,10 @@ void UserUrlLinkFrame::setDescription(const String &s) PropertyMap UserUrlLinkFrame::asProperties() const { PropertyMap map; - String key; - if(description().isEmpty()) - key = "URL"; - else - key = PropertyMap::prepareKey(description()); - if(key.isNull()) + String key = PropertyMap::prepareKey(description()); + if(key.isEmpty() || key.upper() == "URL") + map.insert("URL", url()); + else if(key.isNull()) map.unsupportedData().append(L"WXXX/" + description()); else map.insert("URL:" + key, url()); diff --git a/taglib/mpeg/id3v2/id3v2tag.cpp b/taglib/mpeg/id3v2/id3v2tag.cpp index e6be1f91..4085daae 100644 --- a/taglib/mpeg/id3v2/id3v2tag.cpp +++ b/taglib/mpeg/id3v2/id3v2tag.cpp @@ -337,10 +337,8 @@ void ID3v2::Tag::removeFrames(const ByteVector &id) PropertyMap ID3v2::Tag::properties() const { PropertyMap properties; - for(FrameList::ConstIterator it = frameList().begin(); it != frameList().end(); ++it) { PropertyMap props = (*it)->asProperties(); - debug(props); properties.merge(props); } return properties; diff --git a/taglib/toolkit/tpropertymap.cpp b/taglib/toolkit/tpropertymap.cpp index 8dab7756..40bcaba7 100644 --- a/taglib/toolkit/tpropertymap.cpp +++ b/taglib/toolkit/tpropertymap.cpp @@ -161,6 +161,14 @@ bool PropertyMap::operator!=(const PropertyMap &other) const return !(*this == other); } +String PropertyMap::toString() const +{ + String ret = ""; + for(ConstIterator it = begin(); it != end(); ++it) + ret += it->first+"="+it->second.toString(", ") + "\n"; + return ret; +} + void PropertyMap::removeEmpty() { StringList emptyKeys; diff --git a/taglib/toolkit/tpropertymap.h b/taglib/toolkit/tpropertymap.h index 0d2c76af..b955739b 100644 --- a/taglib/toolkit/tpropertymap.h +++ b/taglib/toolkit/tpropertymap.h @@ -166,6 +166,8 @@ namespace TagLib { */ void removeEmpty(); + String toString() const; + /*! * Converts \a proposed into another String suitable to be used as * a key, or returns String::null if this is not possible. diff --git a/tests/test_id3v2.cpp b/tests/test_id3v2.cpp index ee304fbb..8de91707 100644 --- a/tests/test_id3v2.cpp +++ b/tests/test_id3v2.cpp @@ -561,12 +561,15 @@ public: CPPUNIT_ASSERT_EQUAL(String("userTextData1"), dict["USERTEXTDESCRIPTION2"][0]); CPPUNIT_ASSERT_EQUAL(String("userTextData2"), dict["USERTEXTDESCRIPTION2"][1]); - CPPUNIT_ASSERT_EQUAL(String("Pop"), dict["GENRE"][0]); + CPPUNIT_ASSERT_EQUAL(String("Pop"), dict["GENRE"].front()); - CPPUNIT_ASSERT_EQUAL(String("http://a.user.url"), dict["URL:USERURL"][0]); - CPPUNIT_ASSERT_EQUAL(String("http://a.user.url/with/empty/description"), dict["URL"][0]); + CPPUNIT_ASSERT_EQUAL(String("http://a.user.url"), dict["URL:USERURL"].front()); + + CPPUNIT_ASSERT_EQUAL(String("http://a.user.url/with/empty/description"), dict["URL"].front()); + debug(dict.toString()); + CPPUNIT_ASSERT_EQUAL(String("A COMMENT"), dict["COMMENT"].front()); + debug("565"); - CPPUNIT_ASSERT_EQUAL(String("A COMMENT"), dict["COMMENT"][0]); CPPUNIT_ASSERT_EQUAL(1u, dict.unsupportedData().size()); CPPUNIT_ASSERT_EQUAL(String("UFID"), dict.unsupportedData().front()); }