summaryrefslogtreecommitdiffstats
path: root/apps/plugins/stats.c
diff options
context:
space:
mode:
authorMustapha Senhaji <moos@rockbox.org>2010-12-28 14:34:38 +0000
committerMustapha Senhaji <moos@rockbox.org>2010-12-28 14:34:38 +0000
commitc53069c41c9d96ad004b18fe6a1526b36473d07c (patch)
tree6ee5c8051f88f13f08374641cafcafa24af3bb01 /apps/plugins/stats.c
parent3e3684032eb99f82dac2983f6c3b789b05ee9481 (diff)
downloadrockbox-c53069c41c9d96ad004b18fe6a1526b36473d07c.tar.gz
rockbox-c53069c41c9d96ad004b18fe6a1526b36473d07c.tar.bz2
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/stats.c')
-rw-r--r--apps/plugins/stats.c25
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;
#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;i<sizeof(music_exts)/sizeof(char*);i++)
- if(!rb->strcasecmp(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;