diff options
Diffstat (limited to 'apps/playlist.c')
-rw-r--r-- | apps/playlist.c | 33 |
1 files changed, 21 insertions, 12 deletions
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 | } |