diff options
Diffstat (limited to 'apps/filetree.c')
-rw-r--r-- | apps/filetree.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/apps/filetree.c b/apps/filetree.c index 7e6ba4eb8d..3e20c89924 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -72,29 +72,46 @@ static int strnatcasecmp_n(const char *a, const char *b, size_t n) | |||
72 | int ft_build_playlist(struct tree_context* c, int start_index) | 72 | int ft_build_playlist(struct tree_context* c, int start_index) |
73 | { | 73 | { |
74 | int i; | 74 | int i; |
75 | int res = 0; | ||
76 | int start=start_index; | 75 | int start=start_index; |
76 | int res; | ||
77 | struct playlist_info *playlist = playlist_get_current(); | 77 | struct playlist_info *playlist = playlist_get_current(); |
78 | 78 | ||
79 | tree_lock_cache(c); | 79 | tree_lock_cache(c); |
80 | struct entry *entries = tree_get_entries(c); | 80 | struct entry *entries = tree_get_entries(c); |
81 | 81 | ||
82 | for(i = 0;i < c->filesindir;i++) | 82 | struct playlist_insert_context pl_context; |
83 | |||
84 | res = playlist_insert_context_create(playlist, &pl_context, | ||
85 | PLAYLIST_REPLACE, false, false); | ||
86 | if (res >= 0) | ||
83 | { | 87 | { |
84 | if((entries[i].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) | 88 | cpu_boost(true); |
89 | for(i = 0;i < c->filesindir;i++) | ||
85 | { | 90 | { |
86 | res = playlist_insert_track(playlist, entries[i].name, | 91 | #if 0 /*only needed if displaying progress */ |
87 | PLAYLIST_INSERT_LAST, false, false); | 92 | /* user abort */ |
88 | if (res < 0) | 93 | if (action_userabort(TIMEOUT_NOBLOCK)) |
94 | { | ||
89 | break; | 95 | break; |
96 | } | ||
97 | #endif | ||
98 | if((entries[i].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) | ||
99 | { | ||
100 | res = playlist_insert_context_add(&pl_context, entries[i].name); | ||
101 | if (res < 0) | ||
102 | break; | ||
103 | } | ||
104 | else | ||
105 | { | ||
106 | /* Adjust the start index when se skip non-MP3 entries */ | ||
107 | if(i < start) | ||
108 | start_index--; | ||
109 | } | ||
90 | } | 110 | } |
91 | else | 111 | cpu_boost(false); |
92 | { | ||
93 | /* Adjust the start index when se skip non-MP3 entries */ | ||
94 | if(i < start) | ||
95 | start_index--; | ||
96 | } | ||
97 | } | 112 | } |
113 | |||
114 | playlist_insert_context_release(&pl_context); | ||
98 | 115 | ||
99 | tree_unlock_cache(c); | 116 | tree_unlock_cache(c); |
100 | return start_index; | 117 | return start_index; |