Commit 45d50c43 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Taglib: use an extradata to store MB releases

parent ccca9bec
......@@ -160,5 +160,6 @@ VLC_API int input_item_WriteMeta(vlc_object_t *, input_item_t *);
#define VLC_META_SHOW_NAME vlc_meta_TypeToLocalizedString( vlc_meta_ShowName )
#define VLC_META_ACTORS vlc_meta_TypeToLocalizedString( vlc_meta_Actors )
#define VLC_META_EXTRA_MB_ALBUMID "MB_ALBUMID"
#endif
......@@ -167,7 +167,11 @@ static void ReadMetaFromAPE( APE::Tag* tag, demux_meta_t* p_demux_meta, vlc_meta
#define SET( keyName, metaName ) \
item = tag->itemListMap()[keyName]; \
if( !item.isEmpty() ) vlc_meta_Set##metaName( p_meta, item.toString().toCString( true ) ); \
if( !item.isEmpty() ) vlc_meta_Set##metaName( p_meta, item.toString().toCString( true ) );
#define SET_EXTRA( keyName, metaName ) \
item = tag->itemListMap()[keyName]; \
if( !item.isEmpty() ) vlc_meta_AddExtra( p_meta, metaName, item.toString().toCString( true ) );
SET( "ALBUM", Album );
SET( "ARTIST", Artist );
......@@ -179,7 +183,10 @@ static void ReadMetaFromAPE( APE::Tag* tag, demux_meta_t* p_demux_meta, vlc_meta
SET( "PUBLISHER", Publisher );
SET( "MUSICBRAINZ_TRACKID", TrackID );
SET_EXTRA( "MUSICBRAINZ_ALBUMID", VLC_META_EXTRA_MB_ALBUMID );
#undef SET
#undef SET_EXTRA
/* */
item = tag->itemListMap()["TRACK"];
......@@ -207,9 +214,18 @@ static void ReadMetaFromASF( ASF::Tag* tag, demux_meta_t* p_demux_meta, vlc_meta
vlc_meta_Set##metaName( p_meta, list.front().toString().toCString( true ) ); \
}
#define SET_EXTRA( keyName, metaName ) \
if( tag->attributeListMap().contains(keyName) ) \
{ \
list = tag->attributeListMap()[keyName]; \
vlc_meta_AddExtra( p_meta, metaName, list.front().toString().toCString( true ) ); \
}
SET("MusicBrainz/Track Id", TrackID );
SET_EXTRA("MusicBrainz/Album Id", VLC_META_EXTRA_MB_ALBUMID );
#undef SET
#undef SET_EXTRA
#ifdef TAGLIB_HAVE_ASFPICTURE_H
// List the pictures
......@@ -299,6 +315,11 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_meta_t* p_demux_meta, vlc_
vlc_meta_Set( p_meta, vlc_meta_TrackTotal, p_txxx->fieldList().back().toCString( true ) );
continue;
}
if( !strcmp( p_txxx->description().toCString( true ), "MusicBrainz Album Id" ) )
{
vlc_meta_AddExtra( p_meta, VLC_META_EXTRA_MB_ALBUMID, p_txxx->fieldList().back().toCString( true ) );
continue;
}
vlc_meta_AddExtra( p_meta, p_txxx->description().toCString( true ),
p_txxx->fieldList().back().toCString( true ) );
}
......@@ -449,6 +470,11 @@ static void ReadMetaFromXiph( Ogg::XiphComment* tag, demux_meta_t* p_demux_meta,
if( !list.isEmpty() ) \
vlc_meta_Set##metaName( p_meta, (*list.begin()).toCString( true ) );
#define SET_EXTRA( keyName, metaName ) \
list = tag->fieldListMap()[keyName]; \
if( !list.isEmpty() ) \
vlc_meta_AddExtra( p_meta, keyName, (*list.begin()).toCString( true ) );
SET( "COPYRIGHT", Copyright );
SET( "ORGANIZATION", Publisher );
SET( "DATE", Date );
......@@ -456,7 +482,10 @@ static void ReadMetaFromXiph( Ogg::XiphComment* tag, demux_meta_t* p_demux_meta,
SET( "RATING", Rating );
SET( "LANGUAGE", Language );
SET( "MUSICBRAINZ_TRACKID", TrackID );
SET_EXTRA( "MUSICBRAINZ_ALBUMID", VLC_META_EXTRA_MB_ALBUMID );
#undef SET
#undef SET_EXTRA
list = tag->fieldListMap()["TRACKNUMBER"];
if( !list.isEmpty() )
......@@ -560,10 +589,18 @@ static void ReadMetaFromMP4( MP4::Tag* tag, demux_meta_t *p_demux_meta, vlc_meta
list = tag->itemListMap()[keyName]; \
vlc_meta_Set##metaName( p_meta, list.toStringList().front().toCString( true ) ); \
}
#define SET_EXTRA( keyName, metaName ) \
if( tag->itemListMap().contains(keyName) ) \
{ \
list = tag->itemListMap()[keyName]; \
vlc_meta_AddExtra( p_meta, metaName, list.toStringList().front().toCString( true ) ); \
}
SET("----:com.apple.iTunes:MusicBrainz Track Id", TrackID );
SET_EXTRA("----:com.apple.iTunes:MusicBrainz Album Id", VLC_META_EXTRA_MB_ALBUMID );
#undef SET
#undef SET_EXTRA
if( tag->itemListMap().contains("covr") )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment