diff options
| author | Miika Pekkarinen <miipekk@ihme.org> | 2006-08-10 09:50:45 +0000 |
|---|---|---|
| committer | Miika Pekkarinen <miipekk@ihme.org> | 2006-08-10 09:50:45 +0000 |
| commit | 887cfeb9f55344db5c8df1f22d5c6a02467764f3 (patch) | |
| tree | e7efd8bc2bc4eabd365fccd0d7787f1bf633fda1 /apps | |
| parent | 19fe37de6fb63c8d6a8891e095f8b1fde18514eb (diff) | |
| download | rockbox-887cfeb9f55344db5c8df1f22d5c6a02467764f3.zip rockbox-887cfeb9f55344db5c8df1f22d5c6a02467764f3.tar.gz rockbox-887cfeb9f55344db5c8df1f22d5c6a02467764f3.tar.bz2 rockbox-887cfeb9f55344db5c8df1f22d5c6a02467764f3.tar.xz | |
Only sync playlist once when adding bunch of files from tagcache.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10508 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/filetree.c | 5 | ||||
| -rw-r--r-- | apps/onplay.c | 2 | ||||
| -rw-r--r-- | apps/playlist.c | 33 | ||||
| -rw-r--r-- | apps/playlist.h | 3 | ||||
| -rw-r--r-- | apps/tagtree.c | 7 |
5 files changed, 32 insertions, 18 deletions
diff --git a/apps/filetree.c b/apps/filetree.c index acceb0b..d3ef1e0 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -409,9 +409,10 @@ int ft_enter(struct tree_context* c) break; } - if (global_settings.party_mode) { + if (global_settings.party_mode) + { playlist_insert_track(NULL, buf, - PLAYLIST_INSERT_LAST, true); + PLAYLIST_INSERT_LAST, true, true); gui_syncsplash(HZ, true, str(LANG_QUEUE_LAST)); } else if (playlist_create(c->currdir, NULL) != -1) diff --git a/apps/onplay.c b/apps/onplay.c index 4558da7..a5fb3fe 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -182,7 +182,7 @@ static bool add_to_playlist(int position, bool queue) else { if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) - playlist_insert_track(NULL, selected_file, position, queue); + playlist_insert_track(NULL, selected_file, position, queue, true); else if (selected_file_attr & ATTR_DIRECTORY) { bool recurse = false; diff --git a/apps/playlist.c b/apps/playlist.c index a08ecdf..6b35bb6 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -2700,12 +2700,26 @@ void playlist_close(struct playlist_info* playlist) remove(playlist->control_filename); } +void playlist_sync(struct playlist_info* playlist) +{ + if (!playlist) + playlist = ¤t_playlist; + + sync_control(playlist, false); + if ((audio_status() & AUDIO_STATUS_PLAY) && playlist->started) + audio_flush_and_reload_tracks(); + +#ifdef HAVE_DIRCACHE + queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0); +#endif +} + /* * Insert track into playlist at specified position (or one of the special * positions). Returns position where track was inserted or -1 if error. */ -int playlist_insert_track(struct playlist_info* playlist, - const char *filename, int position, bool queue) +int playlist_insert_track(struct playlist_info* playlist, const char *filename, + int position, bool queue, bool sync) { int result; @@ -2720,16 +2734,11 @@ int playlist_insert_track(struct playlist_info* playlist, result = add_track_to_playlist(playlist, filename, position, queue, -1); - if (result != -1) - { - sync_control(playlist, false); - if ((audio_status() & AUDIO_STATUS_PLAY) && playlist->started) - audio_flush_and_reload_tracks(); - } - -#ifdef HAVE_DIRCACHE - queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0); -#endif + /* Check if we want manually sync later. For example when adding + * bunch of files from tagcache, syncing after every file wouldn't be + * a good thing to do. */ + if (sync && result >= 0) + playlist_sync(playlist); return result; } diff --git a/apps/playlist.h b/apps/playlist.h index c5449a2..4ad7587 100644 --- a/apps/playlist.h +++ b/apps/playlist.h @@ -134,8 +134,9 @@ int playlist_create_ex(struct playlist_info* playlist, void* temp_buffer, int temp_buffer_size); int playlist_set_current(struct playlist_info* playlist); void playlist_close(struct playlist_info* playlist); +void playlist_sync(struct playlist_info* playlist); int playlist_insert_track(struct playlist_info* playlist, const char *filename, - int position, bool queue); + int position, bool queue, bool sync); int playlist_insert_directory(struct playlist_info* playlist, const char *dirname, int position, bool queue, bool recurse); diff --git a/apps/tagtree.c b/apps/tagtree.c index bf1b6a1..aede719 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c @@ -975,8 +975,10 @@ bool insert_all_playlist(struct tree_context *c, int position, bool queue) continue; } - playlist_insert_track(NULL, buf, position, queue); + if (playlist_insert_track(NULL, buf, position, queue, false) < 0) + break; } + playlist_sync(NULL); tagcache_search_finish(&tcs); cpu_boost(false); @@ -999,12 +1001,13 @@ bool tagtree_insert_selection_playlist(int position, bool queue) logf("tagtree_get_filename failed"); return false; } - playlist_insert_track(NULL, buf, position, queue); + playlist_insert_track(NULL, buf, position, queue, true); return true; } /* We need to set the table to allsubentries. */ + show_search_progress(true, 0); if (dptr->newtable == navibrowse) { tagtree_enter(tc); |