From baca93b8230363823c4cc2aa3c231bb99ffb552f Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Sun, 29 May 2005 06:43:03 +0000 Subject: [PATCH] Fix problem of numeric genres --- src/mp3-scanner.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mp3-scanner.c b/src/mp3-scanner.c index a82111d5..bb563b84 100644 --- a/src/mp3-scanner.c +++ b/src/mp3-scanner.c @@ -923,6 +923,22 @@ int scan_gettags(char *file, MP3FILE *pmp3) { return 0; } +/** + * decide if a string is numeric or not... + * + * @param str string to evaluate + * @returns 1 if number, 0 otherwise + */ +int scan_is_numeric(char *str) { + char *ptr=str; + + while(*ptr) { + if(!isdigit(*ptr)) + return 0; + ptr++; + } + return 1; +} int scan_get_mp3tags(char *file, MP3FILE *pmp3) { struct id3_file *pid3file; @@ -1021,7 +1037,7 @@ int scan_get_mp3tags(char *file, MP3FILE *pmp3) { if(!strlen(pmp3->genre)) { genre=WINAMP_GENRE_UNKNOWN; got_numeric_genre=1; - } else if (isdigit(pmp3->genre[0])) { + } else if (scan_is_numeric(pmp3->genre)) { genre=atoi(pmp3->genre); got_numeric_genre=1; } else if ((pmp3->genre[0] == '(') && (isdigit(pmp3->genre[1]))) {