forked from len0rd/rockbox
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
This commit is contained in:
parent
19fe37de6f
commit
887cfeb9f5
5 changed files with 32 additions and 18 deletions
|
|
@ -409,9 +409,10 @@ int ft_enter(struct tree_context* c)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (global_settings.party_mode) {
|
if (global_settings.party_mode)
|
||||||
|
{
|
||||||
playlist_insert_track(NULL, buf,
|
playlist_insert_track(NULL, buf,
|
||||||
PLAYLIST_INSERT_LAST, true);
|
PLAYLIST_INSERT_LAST, true, true);
|
||||||
gui_syncsplash(HZ, true, str(LANG_QUEUE_LAST));
|
gui_syncsplash(HZ, true, str(LANG_QUEUE_LAST));
|
||||||
}
|
}
|
||||||
else if (playlist_create(c->currdir, NULL) != -1)
|
else if (playlist_create(c->currdir, NULL) != -1)
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ static bool add_to_playlist(int position, bool queue)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_MPA)
|
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)
|
else if (selected_file_attr & ATTR_DIRECTORY)
|
||||||
{
|
{
|
||||||
bool recurse = false;
|
bool recurse = false;
|
||||||
|
|
|
||||||
|
|
@ -2700,12 +2700,26 @@ void playlist_close(struct playlist_info* playlist)
|
||||||
remove(playlist->control_filename);
|
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
|
* Insert track into playlist at specified position (or one of the special
|
||||||
* positions). Returns position where track was inserted or -1 if error.
|
* positions). Returns position where track was inserted or -1 if error.
|
||||||
*/
|
*/
|
||||||
int playlist_insert_track(struct playlist_info* playlist,
|
int playlist_insert_track(struct playlist_info* playlist, const char *filename,
|
||||||
const char *filename, int position, bool queue)
|
int position, bool queue, bool sync)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
|
@ -2720,16 +2734,11 @@ int playlist_insert_track(struct playlist_info* playlist,
|
||||||
|
|
||||||
result = add_track_to_playlist(playlist, filename, position, queue, -1);
|
result = add_track_to_playlist(playlist, filename, position, queue, -1);
|
||||||
|
|
||||||
if (result != -1)
|
/* Check if we want manually sync later. For example when adding
|
||||||
{
|
* bunch of files from tagcache, syncing after every file wouldn't be
|
||||||
sync_control(playlist, false);
|
* a good thing to do. */
|
||||||
if ((audio_status() & AUDIO_STATUS_PLAY) && playlist->started)
|
if (sync && result >= 0)
|
||||||
audio_flush_and_reload_tracks();
|
playlist_sync(playlist);
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,8 +134,9 @@ int playlist_create_ex(struct playlist_info* playlist,
|
||||||
void* temp_buffer, int temp_buffer_size);
|
void* temp_buffer, int temp_buffer_size);
|
||||||
int playlist_set_current(struct playlist_info* playlist);
|
int playlist_set_current(struct playlist_info* playlist);
|
||||||
void playlist_close(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 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,
|
int playlist_insert_directory(struct playlist_info* playlist,
|
||||||
const char *dirname, int position, bool queue,
|
const char *dirname, int position, bool queue,
|
||||||
bool recurse);
|
bool recurse);
|
||||||
|
|
|
||||||
|
|
@ -975,8 +975,10 @@ bool insert_all_playlist(struct tree_context *c, int position, bool queue)
|
||||||
continue;
|
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);
|
tagcache_search_finish(&tcs);
|
||||||
cpu_boost(false);
|
cpu_boost(false);
|
||||||
|
|
||||||
|
|
@ -999,12 +1001,13 @@ bool tagtree_insert_selection_playlist(int position, bool queue)
|
||||||
logf("tagtree_get_filename failed");
|
logf("tagtree_get_filename failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
playlist_insert_track(NULL, buf, position, queue);
|
playlist_insert_track(NULL, buf, position, queue, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need to set the table to allsubentries. */
|
/* We need to set the table to allsubentries. */
|
||||||
|
show_search_progress(true, 0);
|
||||||
if (dptr->newtable == navibrowse)
|
if (dptr->newtable == navibrowse)
|
||||||
{
|
{
|
||||||
tagtree_enter(tc);
|
tagtree_enter(tc);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue