Ticket #5820: musicbrainz_compilation.patch
File musicbrainz_compilation.patch, 5.0 KB (added by , 16 years ago) |
---|
-
mythmusic/metaiotaglib.cpp
31 31 return false; 32 32 33 33 File *taglib = new TagLib::MPEG::File(mdata->Filename().local8Bit()); 34 35 34 Tag *tag = taglib->tag(); 36 35 37 36 if (!tag) … … 48 47 UserTextIdentificationFrame *musicbrainz = NULL; 49 48 musicbrainz = find(taglib->ID3v2Tag(), "MusicBrainz Album Artist Id"); 50 49 51 // Compilation Artist (TPE 4)50 // Compilation Artist (TPE2) 52 51 TextIdentificationFrame *tpeframe = NULL; 53 TagLib::ID3v2::FrameList tpelist = taglib->ID3v2Tag()->frameListMap()["TPE 4"];52 TagLib::ID3v2::FrameList tpelist = taglib->ID3v2Tag()->frameListMap()["TPE2"]; 54 53 if (!tpelist.isEmpty()) 55 54 tpeframe = (TextIdentificationFrame *)tpelist.front(); 56 55 … … 69 68 if (!mdata->CompilationArtist().isEmpty()) 70 69 { 71 70 if (!tpeframe) { 72 tpeframe = new TextIdentificationFrame(TagLib::ByteVector("TPE 4"), TagLib::String::UTF8);71 tpeframe = new TextIdentificationFrame(TagLib::ByteVector("TPE2"), TagLib::String::UTF8); 73 72 taglib->ID3v2Tag()->addFrame(tpeframe); 74 73 } 75 74 … … 155 154 // ID3V2 Only Tags 156 155 if (taglib->ID3v2Tag()) 157 156 { 158 // Compilation Artist (TPE 4)159 if(!taglib->ID3v2Tag()->frameListMap()["TPE 4"].isEmpty())157 // Compilation Artist (TPE2) 158 if(!taglib->ID3v2Tag()->frameListMap()["TPE2"].isEmpty()) 160 159 { 161 160 compilation_artist = TStringToQString( 162 taglib->ID3v2Tag()->frameListMap()["TPE 4"].front()->toString())161 taglib->ID3v2Tag()->frameListMap()["TPE2"].front()->toString()) 163 162 .stripWhiteSpace(); 164 163 } 165 164 166 165 // Look for MusicBrainz Album+Artist ID in TXXX Frame 167 166 UserTextIdentificationFrame *musicbrainz = find(taglib->ID3v2Tag(), 168 167 "MusicBrainz Album Artist Id"); 169 168 UserTextIdentificationFrame *musicbrainzalbumtype = find(taglib->ID3v2Tag(), 169 "MusicBrainz Album Type"); 170 170 171 if (musicbrainz) 171 172 { 172 173 // If the MusicBrainz ID is the special "Various Artists" ID … … 176 177 == TStringToQString(musicbrainz->fieldList().front())); 177 178 } 178 179 180 if (!compilation && musicbrainzalbumtype) 181 { 182 // If the MusicBrainz Album Type is 'compilation', then compilation is TRUE 183 QString albumtype; 184 if (! musicbrainzalbumtype->fieldList().isEmpty()) 185 albumtype = TStringToQString(musicbrainzalbumtype->fieldList().front()); 186 compilation = (albumtype.contains(QString("compilation")) || albumtype.contains(QString("soundtrack"))); 187 } 188 179 189 // Length 180 190 if(!taglib->ID3v2Tag()->frameListMap()["TLEN"].isEmpty()) 181 191 length = taglib->ID3v2Tag()->frameListMap()["TLEN"].front()->toString().toInt(); -
mythmusic/metaiooggvorbiscomment.cpp
13 13 // MythTV headers 14 14 #include <mythtv/compat.h> 15 15 #include <mythtv/util.h> 16 #include <mythtv/mythcontext.h> 16 17 17 18 // MythMusic headers 18 19 #include "metaiooggvorbiscomment.h" … … 306 307 genre = getComment(comment, MYTH_VORBISCOMMENT_GENRE); 307 308 tracknum = atoi(getComment(comment, MYTH_VORBISCOMMENT_TRACK).ascii()); 308 309 year = atoi(getComment(comment, MYTH_VORBISCOMMENT_DATE).ascii()); 310 311 QString album_artist_id = getComment(comment, MYTH_VORBISCOMMENT_MUSICBRAINZ_ALBUMARTISTID); 312 QString album_type = getComment(comment, MYTH_VORBISCOMMENT_MUSICBRAINZ_ALBUMTYPE); 313 compilation = (MYTH_MUSICBRAINZ_ALBUMARTIST_UUID == album_artist_id || 314 album_type.contains(QString("compilation")) || album_type.contains(QString("soundtrack"))); 315 316 309 317 310 QString tmp = getComment(comment, MYTH_VORBISCOMMENT_MUSICBRAINZ_ALBUMARTISTID);311 compilation = (MYTH_MUSICBRAINZ_ALBUMARTIST_UUID == tmp);312 313 318 length = getTrackLength(&vf); 314 319 315 320 // Do not call fclose as ov_clear takes care of things for us. -
mythmusic/metaiovorbiscomment.h
9 9 #define MYTH_VORBISCOMMENT_GENRE "GENRE" 10 10 #define MYTH_VORBISCOMMENT_DATE "DATE" 11 11 #define MYTH_VORBISCOMMENT_TRACK "TRACKNUMBER" 12 #define MYTH_VORBISCOMMENT_COMPILATIONARTIST " COMPILATION_ARTIST"12 #define MYTH_VORBISCOMMENT_COMPILATIONARTIST "ALBUMARTIST" 13 13 #define MYTH_VORBISCOMMENT_MUSICBRAINZ_ALBUMARTISTID "MUSICBRAINZ_ALBUMARTISTID" 14 #define MYTH_VORBISCOMMENT_MUSICBRAINZ_ALBUMTYPE "RELEASETYPE" 14 15 15 16 #endif