From 8d12946d03a76cdaad956d6a0c9bbd4cee6d5f52 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Wed, 28 Aug 2002 13:58:19 +0000 Subject: allow mp2 and mpa as valid file extensions and rename TREE_ATTR_MP3 to TREE_ATTR_MPA git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2035 a1c6a512-1295-4272-9138-f99709370657 --- apps/tree.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/apps/tree.c b/apps/tree.c index e47452fe54..ee23520fcd 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -114,7 +114,7 @@ extern unsigned char bitmap_icons_6x8[LastIcon][6]; #endif /* HAVE_RECORDER_KEYPAD */ #define TREE_ATTR_M3U 0x80 /* unused by FAT attributes */ -#define TREE_ATTR_MP3 0x40 /* unused by FAT attributes */ +#define TREE_ATTR_MPA 0x40 /* unused by FAT attributes */ static int build_playlist(int start_index) { @@ -125,7 +125,7 @@ static int build_playlist(int start_index) for(i = 0;i < filesindir;i++) { - if(dircache[i].attr & TREE_ATTR_MP3) + if(dircache[i].attr & TREE_ATTR_MPA) { DEBUGF("Adding %s\n", dircache[i].name); playlist_add(dircache[i].name); @@ -213,10 +213,12 @@ static int showdir(char *path, int start) dptr->attr = entry->attribute; - /* mark mp3 and m3u files as such */ + /* mark mp? and m3u files as such */ if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) ) { - if (!strcasecmp(&entry->d_name[len-4], ".mp3")) - dptr->attr |= TREE_ATTR_MP3; + if (!strcasecmp(&entry->d_name[len-4], ".mp3") || + (!strcasecmp(&entry->d_name[len-4], ".mp2") || + (!strcasecmp(&entry->d_name[len-4], ".mpa")) + dptr->attr |= TREE_ATTR_MPA; else if (!strcasecmp(&entry->d_name[len-4], ".m3u")) dptr->attr |= TREE_ATTR_M3U; @@ -225,7 +227,7 @@ static int showdir(char *path, int start) /* filter non-mp3 or m3u files */ if ( global_settings.mp3filter && (!(dptr->attr & - (ATTR_DIRECTORY|TREE_ATTR_MP3|TREE_ATTR_M3U))) ) { + (ATTR_DIRECTORY|TREE_ATTR_MPA|TREE_ATTR_M3U))) ) { i--; continue; } @@ -281,7 +283,7 @@ static int showdir(char *path, int start) icon_type = Folder; else if ( dircache[i].attr & TREE_ATTR_M3U ) icon_type = Playlist; - else if ( dircache[i].attr & TREE_ATTR_MP3 ) + else if ( dircache[i].attr & TREE_ATTR_MPA ) icon_type = File; else icon_type = 0; @@ -294,7 +296,7 @@ static int showdir(char *path, int start) /* if MP3 filter is on, cut off the extension */ if (global_settings.mp3filter && - (dircache[i].attr & (TREE_ATTR_M3U|TREE_ATTR_MP3))) + (dircache[i].attr & (TREE_ATTR_M3U|TREE_ATTR_MPA))) { char temp = dircache[i].name[len-4]; dircache[i].name[len-4] = 0; @@ -529,7 +531,7 @@ bool dirbrowse(char *root) 0, seed ); start_index = 0; } - else if (dircache[dircursor+start].attr & TREE_ATTR_MP3 ) { + else if (dircache[dircursor+start].attr & TREE_ATTR_MPA ) { if ( global_settings.resume ) strncpy(global_settings.resume_file, currdir, MAX_PATH); @@ -743,7 +745,7 @@ bool dirbrowse(char *root) lcd_stop_scroll(); if (global_settings.mp3filter && (dircache[i].attr & - (TREE_ATTR_M3U|TREE_ATTR_MP3))) + (TREE_ATTR_M3U|TREE_ATTR_MPA))) { int len = strlen(dircache[i].name); char temp = dircache[i].name[len-4]; -- cgit v1.2.3