summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/tree.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/tree.c b/apps/tree.c
index c1859a66ae..e09492946b 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -109,7 +109,7 @@ extern unsigned char bitmap_icons_6x8[LastIcon][6];
109#define TREE_ATTR_M3U 0x80 /* unused by FAT attributes */ 109#define TREE_ATTR_M3U 0x80 /* unused by FAT attributes */
110#define TREE_ATTR_MP3 0x40 /* unused by FAT attributes */ 110#define TREE_ATTR_MP3 0x40 /* unused by FAT attributes */
111 111
112static void build_playlist(void) 112static int build_playlist(int start_index)
113{ 113{
114 int i; 114 int i;
115 115
@@ -122,7 +122,15 @@ static void build_playlist(void)
122 DEBUGF("Adding %s\n", dircacheptr[i]->name); 122 DEBUGF("Adding %s\n", dircacheptr[i]->name);
123 playlist_add(dircacheptr[i]->name); 123 playlist_add(dircacheptr[i]->name);
124 } 124 }
125 else
126 {
127 /* Adjust the start index when se skip non-MP3 entries */
128 if(i < start_index)
129 start_index--;
130 }
125 } 131 }
132
133 return start_index;
126} 134}
127 135
128static int compare(const void* p1, const void* p2) 136static int compare(const void* p1, const void* p2)
@@ -267,7 +275,7 @@ bool dirbrowse(char *root)
267 int lasti=-1; 275 int lasti=-1;
268 int rc; 276 int rc;
269 int button; 277 int button;
270 278 int start_index;
271 279
272 memcpy(currdir,root,sizeof(currdir)); 280 memcpy(currdir,root,sizeof(currdir));
273 numentries = showdir(root, start); 281 numentries = showdir(root, start);
@@ -342,8 +350,8 @@ bool dirbrowse(char *root)
342 dircacheptr[dircursor+start]->name, 0); 350 dircacheptr[dircursor+start]->name, 0);
343 } 351 }
344 else { 352 else {
345 build_playlist(); 353 start_index = build_playlist(dircursor+start);
346 play_list(currdir, NULL, dircursor+start); 354 play_list(currdir, NULL, start_index);
347 } 355 }
348 status_set_playmode(STATUS_PLAY); 356 status_set_playmode(STATUS_PLAY);
349 status_draw(); 357 status_draw();