summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/tree.c22
1 files 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];
114#endif /* HAVE_RECORDER_KEYPAD */ 114#endif /* HAVE_RECORDER_KEYPAD */
115 115
116#define TREE_ATTR_M3U 0x80 /* unused by FAT attributes */ 116#define TREE_ATTR_M3U 0x80 /* unused by FAT attributes */
117#define TREE_ATTR_MP3 0x40 /* unused by FAT attributes */ 117#define TREE_ATTR_MPA 0x40 /* unused by FAT attributes */
118 118
119static int build_playlist(int start_index) 119static int build_playlist(int start_index)
120{ 120{
@@ -125,7 +125,7 @@ static int build_playlist(int start_index)
125 125
126 for(i = 0;i < filesindir;i++) 126 for(i = 0;i < filesindir;i++)
127 { 127 {
128 if(dircache[i].attr & TREE_ATTR_MP3) 128 if(dircache[i].attr & TREE_ATTR_MPA)
129 { 129 {
130 DEBUGF("Adding %s\n", dircache[i].name); 130 DEBUGF("Adding %s\n", dircache[i].name);
131 playlist_add(dircache[i].name); 131 playlist_add(dircache[i].name);
@@ -213,10 +213,12 @@ static int showdir(char *path, int start)
213 213
214 dptr->attr = entry->attribute; 214 dptr->attr = entry->attribute;
215 215
216 /* mark mp3 and m3u files as such */ 216 /* mark mp? and m3u files as such */
217 if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) ) { 217 if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) ) {
218 if (!strcasecmp(&entry->d_name[len-4], ".mp3")) 218 if (!strcasecmp(&entry->d_name[len-4], ".mp3") ||
219 dptr->attr |= TREE_ATTR_MP3; 219 (!strcasecmp(&entry->d_name[len-4], ".mp2") ||
220 (!strcasecmp(&entry->d_name[len-4], ".mpa"))
221 dptr->attr |= TREE_ATTR_MPA;
220 else 222 else
221 if (!strcasecmp(&entry->d_name[len-4], ".m3u")) 223 if (!strcasecmp(&entry->d_name[len-4], ".m3u"))
222 dptr->attr |= TREE_ATTR_M3U; 224 dptr->attr |= TREE_ATTR_M3U;
@@ -225,7 +227,7 @@ static int showdir(char *path, int start)
225 /* filter non-mp3 or m3u files */ 227 /* filter non-mp3 or m3u files */
226 if ( global_settings.mp3filter && 228 if ( global_settings.mp3filter &&
227 (!(dptr->attr & 229 (!(dptr->attr &
228 (ATTR_DIRECTORY|TREE_ATTR_MP3|TREE_ATTR_M3U))) ) { 230 (ATTR_DIRECTORY|TREE_ATTR_MPA|TREE_ATTR_M3U))) ) {
229 i--; 231 i--;
230 continue; 232 continue;
231 } 233 }
@@ -281,7 +283,7 @@ static int showdir(char *path, int start)
281 icon_type = Folder; 283 icon_type = Folder;
282 else if ( dircache[i].attr & TREE_ATTR_M3U ) 284 else if ( dircache[i].attr & TREE_ATTR_M3U )
283 icon_type = Playlist; 285 icon_type = Playlist;
284 else if ( dircache[i].attr & TREE_ATTR_MP3 ) 286 else if ( dircache[i].attr & TREE_ATTR_MPA )
285 icon_type = File; 287 icon_type = File;
286 else 288 else
287 icon_type = 0; 289 icon_type = 0;
@@ -294,7 +296,7 @@ static int showdir(char *path, int start)
294 296
295 /* if MP3 filter is on, cut off the extension */ 297 /* if MP3 filter is on, cut off the extension */
296 if (global_settings.mp3filter && 298 if (global_settings.mp3filter &&
297 (dircache[i].attr & (TREE_ATTR_M3U|TREE_ATTR_MP3))) 299 (dircache[i].attr & (TREE_ATTR_M3U|TREE_ATTR_MPA)))
298 { 300 {
299 char temp = dircache[i].name[len-4]; 301 char temp = dircache[i].name[len-4];
300 dircache[i].name[len-4] = 0; 302 dircache[i].name[len-4] = 0;
@@ -529,7 +531,7 @@ bool dirbrowse(char *root)
529 0, seed ); 531 0, seed );
530 start_index = 0; 532 start_index = 0;
531 } 533 }
532 else if (dircache[dircursor+start].attr & TREE_ATTR_MP3 ) { 534 else if (dircache[dircursor+start].attr & TREE_ATTR_MPA ) {
533 if ( global_settings.resume ) 535 if ( global_settings.resume )
534 strncpy(global_settings.resume_file, 536 strncpy(global_settings.resume_file,
535 currdir, MAX_PATH); 537 currdir, MAX_PATH);
@@ -743,7 +745,7 @@ bool dirbrowse(char *root)
743 lcd_stop_scroll(); 745 lcd_stop_scroll();
744 if (global_settings.mp3filter && 746 if (global_settings.mp3filter &&
745 (dircache[i].attr & 747 (dircache[i].attr &
746 (TREE_ATTR_M3U|TREE_ATTR_MP3))) 748 (TREE_ATTR_M3U|TREE_ATTR_MPA)))
747 { 749 {
748 int len = strlen(dircache[i].name); 750 int len = strlen(dircache[i].name);
749 char temp = dircache[i].name[len-4]; 751 char temp = dircache[i].name[len-4];