File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 11#include < mtp/metadata/Metadata.h>
2+ #include < mtp/log.h>
23
34#ifdef HAVE_TAGLIB
45# include < fileref.h>
@@ -34,6 +35,28 @@ namespace mtp
3435 meta->Genre = tag->genre ().to8Bit (true );
3536 meta->Year = tag->year ();
3637 meta->Track = tag->track ();
38+
39+ for (auto & props : tag->complexProperties (" PICTURE" ))
40+ {
41+ auto &picture = meta->Picture ;
42+ for (auto &kv : props)
43+ {
44+ auto &name = kv.first ;
45+ auto &value = kv.second ;
46+ if (name == " data" ) {
47+ auto data = value.toByteVector ();
48+ picture.Data .assign (data.begin (), data.end ());
49+ } else if (name == " pictureType" ) {
50+ picture.Type = value.toString ().to8Bit (true );
51+ } else if (name == " mimeType" ) {
52+ picture.MimeType = value.toString ().to8Bit (true );
53+ } else if (name == " description" ) {
54+ picture.Description = value.toString ().to8Bit (true );
55+ } else {
56+ mtp::debug (" unhandled PICTURE property " , name.toCString (true ));
57+ }
58+ }
59+ }
3760 return meta;
3861 }
3962
Original file line number Diff line number Diff line change 22#define AFTL_MTP_METADATA_METADATA_H
33
44#include < mtp/types.h>
5+ #include < mtp/ByteArray.h>
56#include < memory>
67#include < string>
78
@@ -10,6 +11,14 @@ namespace mtp
1011 struct Metadata ;
1112 DECLARE_PTR (Metadata);
1213
14+ struct MetadataPicture
15+ {
16+ std::string Type;
17+ std::string MimeType;
18+ std::string Description;
19+ mtp::ByteArray Data;
20+ };
21+
1322 struct Metadata
1423 {
1524 std::string Title;
@@ -18,6 +27,7 @@ namespace mtp
1827 std::string Genre;
1928 unsigned Year;
2029 unsigned Track;
30+ MetadataPicture Picture;
2131
2232 static MetadataPtr Read (const std::string & path);
2333 };
You can’t perform that action at this time.
0 commit comments