diff options
author | Mustapha Senhaji <moos@rockbox.org> | 2010-12-28 14:34:38 +0000 |
---|---|---|
committer | Mustapha Senhaji <moos@rockbox.org> | 2010-12-28 14:34:38 +0000 |
commit | c53069c41c9d96ad004b18fe6a1526b36473d07c (patch) | |
tree | 6ee5c8051f88f13f08374641cafcafa24af3bb01 /apps/plugins | |
parent | 3e3684032eb99f82dac2983f6c3b789b05ee9481 (diff) | |
download | rockbox-c53069c41c9d96ad004b18fe6a1526b36473d07c.tar.gz rockbox-c53069c41c9d96ad004b18fe6a1526b36473d07c.zip |
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
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/stats.c | 25 |
1 files 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; | |||
114 | #error No keymap defined! | 114 | #error No keymap defined! |
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | /* TODO: Better get the exts from the filetypes var in tree.c */ | ||
118 | const char *music_exts[] = {"mp3","mp2","mp1","mpa","ogg","oga", | ||
119 | "wav","flac","ac3","a52","mpc","wv","m4a","m4b","mp4", | ||
120 | "shn","aif","aiff","wma","wmv","asf","spx","ape","mac", | ||
121 | "sid","mod","nsf","nsfe","spc","adx","sap","rm","at3", | ||
122 | "ra","rmvb","oma","aa3","dmc","dlt","mpt","mpd","rmt", | ||
123 | "tmc","tm8","tm2","cm3","cmc","cmr","cms","mmf","au", | ||
124 | "snd","vox","w64"}; | ||
125 | |||
126 | void prn(const char *str, int y) | 117 | void prn(const char *str, int y) |
127 | { | 118 | { |
128 | rb->lcd_puts(0,y,str); | 119 | rb->lcd_puts(0,y,str); |
@@ -186,17 +177,12 @@ void traversedir(char* location, char* name) | |||
186 | dirs++; | 177 | dirs++; |
187 | } | 178 | } |
188 | else { | 179 | else { |
189 | char *ptr = rb->strrchr(entry->d_name,'.'); | 180 | int attr = rb->filetype_get_attr(entry->d_name); |
181 | if ((attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) | ||
182 | { | ||
183 | musicfiles++; | ||
184 | } | ||
190 | files++; files_in_dir++; | 185 | files++; files_in_dir++; |
191 | /* Might want to only count .mp3, .ogg etc. */ | ||
192 | if(ptr){ | ||
193 | unsigned i; | ||
194 | ptr++; | ||
195 | for(i=0;i<sizeof(music_exts)/sizeof(char*);i++) | ||
196 | if(!rb->strcasecmp(ptr,music_exts[i])){ | ||
197 | musicfiles++; break; | ||
198 | } | ||
199 | |||
200 | } | 186 | } |
201 | } | 187 | } |
202 | } | 188 | } |
@@ -222,6 +208,7 @@ void traversedir(char* location, char* name) | |||
222 | largestdir = files_in_dir; | 208 | largestdir = files_in_dir; |
223 | } | 209 | } |
224 | 210 | ||
211 | /* this is the plugin entry point */ | ||
225 | enum plugin_status plugin_start(const void* parameter) | 212 | enum plugin_status plugin_start(const void* parameter) |
226 | { | 213 | { |
227 | int button; | 214 | int button; |