Fix problem with genres greater than 148

This commit is contained in:
Ron Pedde 2004-02-09 17:42:57 +00:00
parent cd24d0c5d1
commit d58c2c6ede

View File

@ -59,157 +59,159 @@ int scan_br_table[] = {
}; };
char *scan_winamp_genre[] = { char *scan_winamp_genre[] = {
"Blues", "Blues", // 0
"Classic Rock", "Classic Rock",
"Country", "Country",
"Dance", "Dance",
"Disco", "Disco",
"Funk", "Funk", // 5
"Grunge", "Grunge",
"Hip-Hop", "Hip-Hop",
"Jazz", "Jazz",
"Metal", "Metal",
"New Age", "New Age", // 10
"Oldies", "Oldies",
"Other", "Other",
"Pop", "Pop",
"R&B", "R&B",
"Rap", "Rap", // 15
"Reggae", "Reggae",
"Rock", "Rock",
"Techno", "Techno",
"Industrial", "Industrial",
"Alternative", "Alternative", // 20
"Ska", "Ska",
"Death Metal", "Death Metal",
"Pranks", "Pranks",
"Soundtrack", "Soundtrack",
"Euro-Techno", "Euro-Techno", // 25
"Ambient", "Ambient",
"Trip-Hop", "Trip-Hop",
"Vocal", "Vocal",
"Jazz+Funk", "Jazz+Funk",
"Fusion", "Fusion", // 30
"Trance", "Trance",
"Classical", "Classical",
"Instrumental", "Instrumental",
"Acid", "Acid",
"House", "House", // 35
"Game", "Game",
"Sound Clip", "Sound Clip",
"Gospel", "Gospel",
"Noise", "Noise",
"AlternRock", "AlternRock", // 40
"Bass", "Bass",
"Soul", "Soul",
"Punk", "Punk",
"Space", "Space",
"Meditative", "Meditative", // 45
"Instrumental Pop", "Instrumental Pop",
"Instrumental Rock", "Instrumental Rock",
"Ethnic", "Ethnic",
"Gothic", "Gothic",
"Darkwave", "Darkwave", // 50
"Techno-Industrial", "Techno-Industrial",
"Electronic", "Electronic",
"Pop-Folk", "Pop-Folk",
"Eurodance", "Eurodance",
"Dream", "Dream", // 55
"Southern Rock", "Southern Rock",
"Comedy", "Comedy",
"Cult", "Cult",
"Gangsta", "Gangsta",
"Top 40", "Top 40", // 60
"Christian Rap", "Christian Rap",
"Pop/Funk", "Pop/Funk",
"Jungle", "Jungle",
"Native American", "Native American",
"Cabaret", "Cabaret", // 65
"New Wave", "New Wave",
"Psychadelic", "Psychadelic",
"Rave", "Rave",
"Showtunes", "Showtunes",
"Trailer", "Trailer", // 70
"Lo-Fi", "Lo-Fi",
"Tribal", "Tribal",
"Acid Punk", "Acid Punk",
"Acid Jazz", "Acid Jazz",
"Polka", "Polka", // 75
"Retro", "Retro",
"Musical", "Musical",
"Rock & Roll", "Rock & Roll",
"Hard Rock", "Hard Rock",
"Folk", "Folk", // 80
"Folk/Rock", "Folk/Rock",
"National folk", "National folk",
"Swing", "Swing",
"Fast-fusion", "Fast-fusion",
"Bebob", "Bebob", // 85
"Latin", "Latin",
"Revival", "Revival",
"Celtic", "Celtic",
"Bluegrass", "Bluegrass",
"Avantgarde", "Avantgarde", // 90
"Gothic Rock", "Gothic Rock",
"Progressive Rock", "Progressive Rock",
"Psychedelic Rock", "Psychedelic Rock",
"Symphonic Rock", "Symphonic Rock",
"Slow Rock", "Slow Rock", // 95
"Big Band", "Big Band",
"Chorus", "Chorus",
"Easy Listening", "Easy Listening",
"Acoustic", "Acoustic",
"Humour", "Humour", // 100
"Speech", "Speech",
"Chanson", "Chanson",
"Opera", "Opera",
"Chamber Music", "Chamber Music",
"Sonata", "Sonata", // 105
"Symphony", "Symphony",
"Booty Bass", "Booty Bass",
"Primus", "Primus",
"Porn Groove", "Porn Groove",
"Satire", "Satire", // 110
"Slow Jam", "Slow Jam",
"Club", "Club",
"Tango", "Tango",
"Samba", "Samba",
"Folklore", "Folklore", // 115
"Ballad", "Ballad",
"Powder Ballad", "Powder Ballad",
"Rhythmic Soul", "Rhythmic Soul",
"Freestyle", "Freestyle",
"Duet", "Duet", // 120
"Punk Rock", "Punk Rock",
"Drum Solo", "Drum Solo",
"A Capella", "A Capella",
"Euro-House", "Euro-House",
"Dance Hall", "Dance Hall", // 125
"Goa", "Goa",
"Drum & Bass", "Drum & Bass",
"Club House", "Club House",
"Hardcore", "Hardcore",
"Terror", "Terror", // 130
"Indie", "Indie",
"BritPop", "BritPop",
"NegerPunk", "NegerPunk",
"Polsk Punk", "Polsk Punk",
"Beat", "Beat", // 135
"Christian Gangsta", "Christian Gangsta",
"Heavy Metal", "Heavy Metal",
"Black Metal", "Black Metal",
"Crossover", "Crossover",
"Contemporary C", "Contemporary C", // 140
"Christian Rock", "Christian Rock",
"Merengue", "Merengue",
"Salsa", "Salsa",
"Thrash Metal", "Thrash Metal",
"Anime", "Anime", // 145
"JPop", "JPop",
"SynthPop", "SynthPop",
"Unknown" "Unknown"
}; };
#define WINAMP_GENRE_UNKNOWN 148
/* /*
* Forwards * Forwards
@ -455,8 +457,17 @@ int scan_gettags(char *file, MP3FILE *pmp3) {
used=1; used=1;
pmp3->genre = utf8_text; pmp3->genre = utf8_text;
DPRINTF(ERR_DEBUG," Genre: %s\n",utf8_text); DPRINTF(ERR_DEBUG," Genre: %s\n",utf8_text);
if((pmp3->genre) && (isdigit(pmp3->genre[0]))) { if(pmp3->genre) {
if(!strlen(pmp3->genre)) {
genre=WINAMP_GENRE_UNKNOWN;
} else if (isdigit(pmp3->genre[0])) {
genre=atoi(pmp3->genre); genre=atoi(pmp3->genre);
} else if ((pmp3->genre[0] == '(') && (isdigit(pmp3->genre[1]))) {
genre=atoi((char*)&pmp3->genre[1]);
}
if((genre < 0) || (genre > WINAMP_GENRE_UNKNOWN))
genre=WINAMP_GENRE_UNKNOWN;
free(pmp3->genre); free(pmp3->genre);
pmp3->genre=strdup(scan_winamp_genre[genre]); pmp3->genre=strdup(scan_winamp_genre[genre]);
} }