Added support for oldstyle id3 genres.

parent 4815c251
/* id3genres.h: list of genres for id3 genre tags, found at
* http://www.id3.org/id3v2.4.0-frames.txt
*/
#define NUM_GENRES 80
static char *ppsz_genres[] = {
N_("Blues"),
N_("Classic Rock"),
N_("Country"),
N_("Dance"),
N_("Disco"),
N_("Funk"),
N_("Grunge"),
N_("Hip-Hop"),
N_("Jazz"),
N_("Metal"),
N_("New Age"),
N_("Oldies"),
N_("Other"),
N_("Pop"),
N_("R&B"),
N_("Rap"),
N_("Reggae"),
N_("Rock"),
N_("Techno"),
N_("Industrial"),
N_("Alternative"),
N_("Ska"),
N_("Death Metal"),
N_("Pranks"),
N_("Soundtrack"),
N_("Euro-Techno"),
N_("Ambient"),
N_("Trip-Hop"),
N_("Vocal"),
N_("Jazz+Funk"),
N_("Fusion"),
N_("Trance"),
N_("Classical"),
N_("Instrumental"),
N_("Acid"),
N_("House"),
N_("Game"),
N_("Sound Clip"),
N_("Gospel"),
N_("Noise"),
N_("AlternRock"),
N_("Bass"),
N_("Soul"),
N_("Punk"),
N_("Space"),
N_("Meditative"),
N_("Instrumental Pop"),
N_("Instrumental Rock"),
N_("Ethnic"),
N_("Gothic"),
N_("Darkwave"),
N_("Techno-Industrial"),
N_("Electronic"),
N_("Pop-Folk"),
N_("Eurodance"),
N_("Dream"),
N_("Southern Rock"),
N_("Comedy"),
N_("Cult"),
N_("Gangsta"),
N_("Top 40"),
N_("Christian Rap"),
N_("Pop/Funk"),
N_("Jungle"),
N_("Native American"),
N_("Cabaret"),
N_("New Wave"),
N_("Psychadelic"),
N_("Rave"),
N_("Showtunes"),
N_("Trailer"),
N_("Lo-Fi"),
N_("Tribal"),
N_("Acid Punk"),
N_("Acid Jazz"),
N_("Polka"),
N_("Retro"),
N_("Musical"),
N_("Rock & Roll"),
N_("Hard Rock")
};
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* id3tag.c: id3 tag parser/skipper based on libid3tag * id3tag.c: id3 tag parser/skipper based on libid3tag
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: id3tag.c,v 1.4 2003/02/22 14:11:38 sigmunau Exp $ * $Id: id3tag.c,v 1.5 2003/03/13 22:35:51 sigmunau Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <id3tag.h> #include <id3tag.h>
#include "id3genres.h"
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
...@@ -72,8 +73,25 @@ static void ParseID3Tag( input_thread_t *p_input, u8 *p_data, int i_size ) ...@@ -72,8 +73,25 @@ static void ParseID3Tag( input_thread_t *p_input, u8 *p_data, int i_size )
i_strings = id3_field_getnstrings( &p_frame->fields[1] ); i_strings = id3_field_getnstrings( &p_frame->fields[1] );
while ( i_strings > 0 ) while ( i_strings > 0 )
{ {
psz_temp = id3_ucs4_latin1duplicate( id3_field_getstrings ( &p_frame->fields[1], --i_strings ) ); psz_temp = id3_ucs4_latin1duplicate( id3_field_getstrings( &p_frame->fields[1], --i_strings ) );
input_AddInfo( p_category, (char *)p_frame->description, psz_temp ); if ( !strcmp(p_frame->id, ID3_FRAME_GENRE ) )
{
int i_genre;
char *psz_endptr;
i_genre = strtol( psz_temp, &psz_endptr, 10 );
if( psz_temp != psz_endptr && i_genre >= 0 && i_genre < NUM_GENRES )
{
input_AddInfo( p_category, (char *)p_frame->description, ppsz_genres[atoi(psz_temp)]);
}
else
{
input_AddInfo( p_category, (char *)p_frame->description, psz_temp );
}
}
else
{
input_AddInfo( p_category, (char *)p_frame->description, psz_temp );
}
free( psz_temp ); free( psz_temp );
} }
i++; i++;
......
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