summaryrefslogtreecommitdiff
path: root/apps/playlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 8f800f616b..53becb9fc1 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -179,7 +179,7 @@ static int get_filename(struct playlist_info* playlist, int index, int seek,
179static int get_next_directory(char *dir); 179static int get_next_directory(char *dir);
180static int get_next_dir(char *dir, bool is_forward, bool recursion); 180static int get_next_dir(char *dir, bool is_forward, bool recursion);
181static int get_previous_directory(char *dir); 181static int get_previous_directory(char *dir);
182static int check_subdir_for_music(char *dir, char *subdir); 182static int check_subdir_for_music(char *dir, char *subdir, bool recurse);
183static int format_track_path(char *dest, char *src, int buf_length, int max, 183static int format_track_path(char *dest, char *src, int buf_length, int max,
184 const char *dir); 184 const char *dir);
185static void display_playlist_count(int count, const unsigned char *fmt, 185static void display_playlist_count(int count, const unsigned char *fmt,
@@ -1475,7 +1475,6 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion)
1475 bool exit = false; 1475 bool exit = false;
1476 struct tree_context* tc = tree_get_context(); 1476 struct tree_context* tc = tree_get_context();
1477 int dirfilter = *(tc->dirfilter); 1477 int dirfilter = *(tc->dirfilter);
1478
1479 if (global_settings.next_folder == FOLDER_ADVANCE_RANDOM) 1478 if (global_settings.next_folder == FOLDER_ADVANCE_RANDOM)
1480 { 1479 {
1481 int fd = open(ROCKBOX_DIR "/folder_advance_list.dat",O_RDONLY); 1480 int fd = open(ROCKBOX_DIR "/folder_advance_list.dat",O_RDONLY);
@@ -1493,7 +1492,7 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion)
1493 i = rand()%folder_count; 1492 i = rand()%folder_count;
1494 lseek(fd,sizeof(int) + (MAX_PATH*i),SEEK_SET); 1493 lseek(fd,sizeof(int) + (MAX_PATH*i),SEEK_SET);
1495 read(fd,buffer,MAX_PATH); 1494 read(fd,buffer,MAX_PATH);
1496 if (check_subdir_for_music(buffer,"") ==0) 1495 if (check_subdir_for_music(buffer, "", false) ==0)
1497 exit = true; 1496 exit = true;
1498 } 1497 }
1499 if (folder_count) 1498 if (folder_count)
@@ -1561,7 +1560,7 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion)
1561 { 1560 {
1562 if (!start_dir) 1561 if (!start_dir)
1563 { 1562 {
1564 result = check_subdir_for_music(dir, files[i].name); 1563 result = check_subdir_for_music(dir, files[i].name, true);
1565 if (result != -1) 1564 if (result != -1)
1566 { 1565 {
1567 exit = true; 1566 exit = true;
@@ -1604,7 +1603,7 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion)
1604 * Checks if there are any music files in the dir or any of its 1603 * Checks if there are any music files in the dir or any of its
1605 * subdirectories. May be called recursively. 1604 * subdirectories. May be called recursively.
1606 */ 1605 */
1607static int check_subdir_for_music(char *dir, char *subdir) 1606static int check_subdir_for_music(char *dir, char *subdir, bool recurse)
1608{ 1607{
1609 int result = -1; 1608 int result = -1;
1610 int dirlen = strlen(dir); 1609 int dirlen = strlen(dir);
@@ -1639,8 +1638,8 @@ static int check_subdir_for_music(char *dir, char *subdir)
1639 1638
1640 if (has_music) 1639 if (has_music)
1641 return 0; 1640 return 0;
1642 1641
1643 if (has_subdir) 1642 if (has_subdir && recurse)
1644 { 1643 {
1645 for (i=0; i<num_files; i++) 1644 for (i=0; i<num_files; i++)
1646 { 1645 {
@@ -1652,7 +1651,7 @@ static int check_subdir_for_music(char *dir, char *subdir)
1652 1651
1653 if (files[i].attr & ATTR_DIRECTORY) 1652 if (files[i].attr & ATTR_DIRECTORY)
1654 { 1653 {
1655 result = check_subdir_for_music(dir, files[i].name); 1654 result = check_subdir_for_music(dir, files[i].name, true);
1656 if (!result) 1655 if (!result)
1657 break; 1656 break;
1658 } 1657 }
@@ -1675,7 +1674,6 @@ static int check_subdir_for_music(char *dir, char *subdir)
1675 gui_syncsplash(HZ*2, 1674 gui_syncsplash(HZ*2,
1676 ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); 1675 ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
1677 } 1676 }
1678
1679 return result; 1677 return result;
1680} 1678}
1681 1679