From c53069c41c9d96ad004b18fe6a1526b36473d07c Mon Sep 17 00:00:00 2001 From: Mustapha Senhaji Date: Tue, 28 Dec 2010 14:34:38 +0000 Subject: [PATCH] Use the filetype_get_attr function just added, to replace a const to count for audio files. (We have filetype attribute for it) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28920 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/stats.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/apps/plugins/stats.c b/apps/plugins/stats.c index 388a617b14..11962043c4 100644 --- a/apps/plugins/stats.c +++ b/apps/plugins/stats.c @@ -114,15 +114,6 @@ static bool cancel; #error No keymap defined! #endif -/* TODO: Better get the exts from the filetypes var in tree.c */ -const char *music_exts[] = {"mp3","mp2","mp1","mpa","ogg","oga", - "wav","flac","ac3","a52","mpc","wv","m4a","m4b","mp4", - "shn","aif","aiff","wma","wmv","asf","spx","ape","mac", - "sid","mod","nsf","nsfe","spc","adx","sap","rm","at3", - "ra","rmvb","oma","aa3","dmc","dlt","mpt","mpd","rmt", - "tmc","tm8","tm2","cm3","cmc","cmr","cms","mmf","au", - "snd","vox","w64"}; - void prn(const char *str, int y) { rb->lcd_puts(0,y,str); @@ -186,17 +177,12 @@ void traversedir(char* location, char* name) dirs++; } else { - char *ptr = rb->strrchr(entry->d_name,'.'); + int attr = rb->filetype_get_attr(entry->d_name); + if ((attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) + { + musicfiles++; + } files++; files_in_dir++; - /* Might want to only count .mp3, .ogg etc. */ - if(ptr){ - unsigned i; - ptr++; - for(i=0;istrcasecmp(ptr,music_exts[i])){ - musicfiles++; break; - } - } } } @@ -222,6 +208,7 @@ void traversedir(char* location, char* name) largestdir = files_in_dir; } +/* this is the plugin entry point */ enum plugin_status plugin_start(const void* parameter) { int button;