@@ -6,6 +6,9 @@ using namespace std;
66/* TagLib */
77#include < aifffile.h>
88#include < id3v2header.h>
9+ #include < id3v2tag.h>
10+ #include < id3v2frame.h>
11+ #include < textidentificationframe.h>
912#include < tag.h>
1013#include < fileref.h>
1114#include < tbytevector.h>
@@ -84,41 +87,66 @@ int main(int argc, char **argv)
8487 if (i.key () == " tags" ) {
8588 json::Object tags_obj = dynamic_cast <const json::Object &>(i.value ());
8689 for (json::Object::const_iterator j = tags_obj.begin (); j != tags_obj.end (); ++j) {
90+ string tag_name = j.key ();
8791 if (j->type () == json::TYPE_STRING) {
8892 string tag_value = dynamic_cast <const json::String &>(*j).value ();
89- cout << j. key () << endl;
90- if (j. key () == " COM " ) {
91- f.tag ()->setAlbum (tag_value);
93+ cout << tag_name << endl;
94+ if (tag_name == " COMM " ) {
95+ f.tag ()->setComment (tag_value);
9296 cout << " Setting Comment(COM): " << tag_value << endl;
9397 }
94- if (j. key () == " GENRE " ) {
95- f.tag ()->setAlbum (tag_value);
98+ if (tag_name == " GENR " ) {
99+ f.tag ()->setGenre (tag_value);
96100 cout << " Setting GENRE: " << tag_value << endl;
97101 }
98- if (j. key () == " TALB" ) {
102+ if (tag_name == " TALB" ) {
99103 f.tag ()->setAlbum (tag_value);
100104 cout << " Setting Album(TALB): " << tag_value << endl;
101105 }
102- if (j. key () == " TPE1" ) {
106+ if (tag_name == " TPE1" ) {
103107 f.tag ()->setArtist (tag_value);
104108 cout << " Setting Artist(TPE1): " << tag_value << endl;
105109 }
110+ if (tag_name == " TPE4" ) {
111+ TagLib::ID3v2::Tag* id3v2Tag;
112+ TagLib::ByteVector remixer;
113+ remixer.setData (tag_name.c_str ());
114+ cout << remixer << endl;
115+ TagLib::ID3v2::TextIdentificationFrame frame (remixer, TagLib::String::Latin1);
116+ id3v2Tag->addFrame (&frame);
117+ cout << " Setting Artist(TPE1): " << tag_value << endl;
118+ }
119+ if (tag_name == " TIT2" ) {
120+ f.tag ()->setTitle (tag_value);
121+ cout << " Setting TITLE(TIT2): " << tag_value << endl;
122+ }
123+ if (tag_name == " TPUB" ) {
124+ cout << " Setting Publisher(TPUB): " << tag_value << endl;
125+ }
126+ if (tag_name == " TKEY" ) {
127+ cout << " Setting Key(TKEY): " << tag_value << endl;
128+ }
129+ if (tag_name == " TFLT" ) {
130+ cout << " Setting Filetype(TFLT): " << tag_value << endl;
131+ }
132+ if (tag_name == " TCON" ) {
133+ cout << " Setting Content TYpe(TCON): " << tag_value << endl;
134+ }
106135 }
107136 if (j->type () == json::TYPE_INTEGER) {
108137 int tag_value = dynamic_cast <const json::Integer &>(*j).value ;
109- cout << j.key () << endl;
110- if (j.key () == " ryear" ) {
111- f.tag ()->setYear (tag_value);
112- cout << " Setting year: " << tag_value << endl;
138+ cout << tag_name << endl;
139+ if (tag_name == " TDOR" ) {
140+ cout << " Setting release year(TDOR): " << tag_value << endl;
113141 }
114- if (j. key () == " year " ) {
142+ if (tag_name == " TDRC " ) {
115143 f.tag ()->setYear (tag_value);
116- cout << " Setting year: " << tag_value << endl;
144+ cout << " Setting year(TDRC) : " << tag_value << endl;
117145 }
118- if (j. key () == " TBPM" ) {
146+ if (tag_name == " TBPM" ) {
119147 cout << " Setting bpm(TBPM): " << tag_value << endl;
120148 }
121- if (j. key () == " TRCK" ) {
149+ if (tag_name == " TRCK" ) {
122150 f.tag ()->setTrack (tag_value);
123151 cout << " Setting track (TRCK): " << tag_value << endl;
124152 }
0 commit comments