Commit c55da911 authored by Francois Cartegnie's avatar Francois Cartegnie

taglib: ID3v2: save TrackTotal

parent b74a7b1a
......@@ -715,6 +715,34 @@ static void WriteMetaToId3v2( ID3v2::Tag* tag, input_item_t* p_item )
WRITE( Publisher, "TPUB" );
#undef WRITE
/* Track Total as Custom Field */
psz_meta = input_item_GetTrackTotal( p_item );
if ( psz_meta )
{
ID3v2::FrameList list = tag->frameListMap()["TXXX"];
ID3v2::UserTextIdentificationFrame *p_txxx;
for( ID3v2::FrameList::Iterator iter = list.begin(); iter != list.end(); iter++ )
{
p_txxx = dynamic_cast<ID3v2::UserTextIdentificationFrame*>(*iter);
if( !p_txxx )
continue;
if( !strcmp( p_txxx->description().toCString( true ), "TRACKTOTAL" ) )
{
p_txxx->setText( psz_meta );
FREENULL( psz_meta );
break;
}
}
if( psz_meta ) /* not found in existing custom fields */
{
ByteVector p_byte( "TXXX", 4 );
p_txxx = new ID3v2::UserTextIdentificationFrame( p_byte );
p_txxx->setDescription( "TRACKTOTAL" );
p_txxx->setText( psz_meta );
free( psz_meta );
tag->addFrame( p_txxx );
}
}
/* Write album art */
char *psz_url = input_item_GetArtworkURL( p_item );
......
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