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 | |
parent | 19fe37de6fb63c8d6a8891e095f8b1fde18514eb (diff) | |
download | rockbox-887cfeb9f55344db5c8df1f22d5c6a02467764f3.tar.gz rockbox-887cfeb9f55344db5c8df1f22d5c6a02467764f3.zip |
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
-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 acceb0b93b..d3ef1e067d 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -409,9 +409,10 @@ int ft_enter(struct tree_context* c) | |||
409 | break; | 409 | break; |
410 | } | 410 | } |
411 | 411 | ||
412 | if (global_settings.party_mode) { | 412 | if (global_settings.party_mode) |
413 | { | ||
413 | playlist_insert_track(NULL, buf, | 414 | playlist_insert_track(NULL, buf, |
414 | PLAYLIST_INSERT_LAST, true); | 415 | PLAYLIST_INSERT_LAST, true, true); |
415 | gui_syncsplash(HZ, true, str(LANG_QUEUE_LAST)); | 416 | gui_syncsplash(HZ, true, str(LANG_QUEUE_LAST)); |
416 | } | 417 | } |
417 | else if (playlist_create(c->currdir, NULL) != -1) | 418 | else if (playlist_create(c->currdir, NULL) != -1) |
diff --git a/apps/onplay.c b/apps/onplay.c index 4558da72fe..a5fb3fe41f 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -182,7 +182,7 @@ static bool add_to_playlist(int position, bool queue) | |||
182 | else | 182 | else |
183 | { | 183 | { |
184 | if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) | 184 | if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) |
185 | playlist_insert_track(NULL, selected_file, position, queue); | 185 | playlist_insert_track(NULL, selected_file, position, queue, true); |
186 | else if (selected_file_attr & ATTR_DIRECTORY) | 186 | else if (selected_file_attr & ATTR_DIRECTORY) |
187 | { | 187 | { |
188 | bool recurse = false; | 188 | bool recurse = false; |
diff --git a/apps/playlist.c b/apps/playlist.c index a08ecdfe34..6b35bb6c3f 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -2700,12 +2700,26 @@ void playlist_close(struct playlist_info* playlist) | |||
2700 | remove(playlist->control_filename); | 2700 | remove(playlist->control_filename); |
2701 | } | 2701 | } |
2702 | 2702 | ||
2703 | void playlist_sync(struct playlist_info* playlist) | ||
2704 | { | ||
2705 | if (!playlist) | ||
2706 | playlist = ¤t_playlist; | ||
2707 | |||
2708 | sync_control(playlist, false); | ||
2709 | if ((audio_status() & AUDIO_STATUS_PLAY) && playlist->started) | ||
2710 | audio_flush_and_reload_tracks(); | ||
2711 | |||
2712 | #ifdef HAVE_DIRCACHE | ||
2713 | queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0); | ||
2714 | #endif | ||
2715 | } | ||
2716 | |||
2703 | /* | 2717 | /* |
2704 | * Insert track into playlist at specified position (or one of the special | 2718 | * Insert track into playlist at specified position (or one of the special |
2705 | * positions). Returns position where track was inserted or -1 if error. | 2719 | * positions). Returns position where track was inserted or -1 if error. |
2706 | */ | 2720 | */ |
2707 | int playlist_insert_track(struct playlist_info* playlist, | 2721 | int playlist_insert_track(struct playlist_info* playlist, const char *filename, |
2708 | const char *filename, int position, bool queue) | 2722 | int position, bool queue, bool sync) |
2709 | { | 2723 | { |
2710 | int result; | 2724 | int result; |
2711 | 2725 | ||
@@ -2720,16 +2734,11 @@ int playlist_insert_track(struct playlist_info* playlist, | |||
2720 | 2734 | ||
2721 | result = add_track_to_playlist(playlist, filename, position, queue, -1); | 2735 | result = add_track_to_playlist(playlist, filename, position, queue, -1); |
2722 | 2736 | ||
2723 | if (result != -1) | 2737 | /* Check if we want manually sync later. For example when adding |
2724 | { | 2738 | * bunch of files from tagcache, syncing after every file wouldn't be |
2725 | sync_control(playlist, false); | 2739 | * a good thing to do. */ |
2726 | if ((audio_status() & AUDIO_STATUS_PLAY) && playlist->started) | 2740 | if (sync && result >= 0) |
2727 | audio_flush_and_reload_tracks(); | 2741 | playlist_sync(playlist); |
2728 | } | ||
2729 | |||
2730 | #ifdef HAVE_DIRCACHE | ||
2731 | queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0); | ||
2732 | #endif | ||
2733 | 2742 | ||
2734 | return result; | 2743 | return result; |
2735 | } | 2744 | } |
diff --git a/apps/playlist.h b/apps/playlist.h index c5449a219e..4ad7587722 100644 --- a/apps/playlist.h +++ b/apps/playlist.h | |||
@@ -134,8 +134,9 @@ int playlist_create_ex(struct playlist_info* playlist, | |||
134 | void* temp_buffer, int temp_buffer_size); | 134 | void* temp_buffer, int temp_buffer_size); |
135 | int playlist_set_current(struct playlist_info* playlist); | 135 | int playlist_set_current(struct playlist_info* playlist); |
136 | void playlist_close(struct playlist_info* playlist); | 136 | void playlist_close(struct playlist_info* playlist); |
137 | void playlist_sync(struct playlist_info* playlist); | ||
137 | int playlist_insert_track(struct playlist_info* playlist, const char *filename, | 138 | int playlist_insert_track(struct playlist_info* playlist, const char *filename, |
138 | int position, bool queue); | 139 | int position, bool queue, bool sync); |
139 | int playlist_insert_directory(struct playlist_info* playlist, | 140 | int playlist_insert_directory(struct playlist_info* playlist, |
140 | const char *dirname, int position, bool queue, | 141 | const char *dirname, int position, bool queue, |
141 | bool recurse); | 142 | bool recurse); |
diff --git a/apps/tagtree.c b/apps/tagtree.c index bf1b6a1f0b..aede719ddb 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) | |||
975 | continue; | 975 | continue; |
976 | } | 976 | } |
977 | 977 | ||
978 | playlist_insert_track(NULL, buf, position, queue); | 978 | if (playlist_insert_track(NULL, buf, position, queue, false) < 0) |
979 | break; | ||
979 | } | 980 | } |
981 | playlist_sync(NULL); | ||
980 | tagcache_search_finish(&tcs); | 982 | tagcache_search_finish(&tcs); |
981 | cpu_boost(false); | 983 | cpu_boost(false); |
982 | 984 | ||
@@ -999,12 +1001,13 @@ bool tagtree_insert_selection_playlist(int position, bool queue) | |||
999 | logf("tagtree_get_filename failed"); | 1001 | logf("tagtree_get_filename failed"); |
1000 | return false; | 1002 | return false; |
1001 | } | 1003 | } |
1002 | playlist_insert_track(NULL, buf, position, queue); | 1004 | playlist_insert_track(NULL, buf, position, queue, true); |
1003 | 1005 | ||
1004 | return true; | 1006 | return true; |
1005 | } | 1007 | } |
1006 | 1008 | ||
1007 | /* We need to set the table to allsubentries. */ | 1009 | /* We need to set the table to allsubentries. */ |
1010 | show_search_progress(true, 0); | ||
1008 | if (dptr->newtable == navibrowse) | 1011 | if (dptr->newtable == navibrowse) |
1009 | { | 1012 | { |
1010 | tagtree_enter(tc); | 1013 | tagtree_enter(tc); |