More support for the unified dictionary interface.

Addded fromDict() function to ID3v2Tag. Added fromDict() and
toDict() functions to the TagUnion class (uses the first non-empty tag).
Added fromDict() and toDict() functions for the generic Tag class, only
handling common tags without duplicates. Addded preliminary mp3 test
case. Python3 bindings now available on my github site.
This commit is contained in:
Michael Helmling
2011-08-27 01:18:21 +02:00
parent b262180857
commit 58db919e43
11 changed files with 312 additions and 21 deletions

BIN
tests/data/rare_frames.mp3 Normal file

Binary file not shown.

View File

@ -554,7 +554,7 @@ public:
string newname = copy.fileName();
MPEG::File f(newname.c_str());
TagDict dict = f.ID3v2Tag(false)->toDict();
CPPUNIT_ASSERT_EQUAL(uint(7), dict.size());
CPPUNIT_ASSERT_EQUAL(uint(6), dict.size());
CPPUNIT_ASSERT_EQUAL(String("userTextData1"), dict["USERTEXTDESCRIPTION1"][0]);
CPPUNIT_ASSERT_EQUAL(String("userTextData2"), dict["USERTEXTDESCRIPTION1"][1]);
CPPUNIT_ASSERT_EQUAL(String("userTextData1"), dict["USERTEXTDESCRIPTION2"][0]);
@ -566,8 +566,6 @@ public:
CPPUNIT_ASSERT_EQUAL(String("http://a.user.url"), dict["USERURL"][0]);
CPPUNIT_ASSERT_EQUAL(String("http://a.user.url/with/empty/description"), dict["URL"][0]);
CPPUNIT_ASSERT_EQUAL(String("12345678 [supermihi@web.de]"), dict["UNIQUEIDENTIFIER"][0]);
CPPUNIT_ASSERT_EQUAL(String("A COMMENT"), dict["COMMENT"][0]);
}