Skip to content
This repository has been archived by the owner on Feb 9, 2018. It is now read-only.

Commit

Permalink
Use PropertyMap in tagreader
Browse files Browse the repository at this point in the history
  • Loading branch information
lalinsky committed Nov 21, 2012
1 parent 45317ef commit 15b601f
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion examples/tagreader.cpp
Expand Up @@ -23,10 +23,12 @@
*/

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <fileref.h>
#include <tag.h>
#include <tpropertymap.h>

using namespace std;

Expand All @@ -49,14 +51,31 @@ int main(int argc, char *argv[])

TagLib::Tag *tag = f.tag();

cout << "-- TAG --" << endl;
cout << "-- TAG (basic) --" << endl;
cout << "title - \"" << tag->title() << "\"" << endl;
cout << "artist - \"" << tag->artist() << "\"" << endl;
cout << "album - \"" << tag->album() << "\"" << endl;
cout << "year - \"" << tag->year() << "\"" << endl;
cout << "comment - \"" << tag->comment() << "\"" << endl;
cout << "track - \"" << tag->track() << "\"" << endl;
cout << "genre - \"" << tag->genre() << "\"" << endl;

TagLib::PropertyMap tags = f.file()->properties();

unsigned int longest = 0;
for(TagLib::PropertyMap::ConstIterator i = tags.begin(); i != tags.end(); ++i) {
if (i->first.size() > longest) {
longest = i->first.size();
}
}

cout << "-- TAG (properties) --" << endl;
for(TagLib::PropertyMap::ConstIterator i = tags.begin(); i != tags.end(); ++i) {
for(TagLib::StringList::ConstIterator j = i->second.begin(); j != i->second.end(); ++j) {
cout << left << std::setw(longest) << i->first << " - " << '"' << *j << '"' << endl;
}
}

}

if(!f.isNull() && f.audioProperties()) {
Expand Down

0 comments on commit 15b601f

Please sign in to comment.