From d50be0a2a61a247faa10e18d9881c7837d72b3cd Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Thu, 24 Jul 2014 19:30:24 +0200 Subject: command: append entries to the end of the playlist with loadlist append Currently entries are added after the current playlist element. This is kinda confusing, more so given that "loadfile append" appends at the end of the playlist. --- common/playlist.c | 9 +++++++++ common/playlist.h | 1 + player/command.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/common/playlist.c b/common/playlist.c index e33fbd36c8..4df3396b04 100644 --- a/common/playlist.c +++ b/common/playlist.c @@ -215,6 +215,15 @@ void playlist_transfer_entries(struct playlist *pl, struct playlist *source_pl) } } +void playlist_append_entries(struct playlist *pl, struct playlist *source_pl) +{ + while (source_pl->first) { + struct playlist_entry *e = source_pl->first; + playlist_unlink(source_pl, e); + playlist_add(pl, e); + } +} + // Return number of entries between list start and e. // Return -1 if e is not on the list, or if e is NULL. int playlist_entry_to_index(struct playlist *pl, struct playlist_entry *e) diff --git a/common/playlist.h b/common/playlist.h index c55a3a21c8..73227f071c 100644 --- a/common/playlist.h +++ b/common/playlist.h @@ -74,6 +74,7 @@ void playlist_shuffle(struct playlist *pl); struct playlist_entry *playlist_get_next(struct playlist *pl, int direction); void playlist_add_base_path(struct playlist *pl, bstr base_path); void playlist_transfer_entries(struct playlist *pl, struct playlist *source_pl); +void playlist_append_entries(struct playlist *pl, struct playlist *source_pl); int playlist_entry_to_index(struct playlist *pl, struct playlist_entry *e); int playlist_entry_count(struct playlist *pl); diff --git a/player/command.c b/player/command.c index 7282eb30fd..1c061c4d14 100644 --- a/player/command.c +++ b/player/command.c @@ -3577,7 +3577,7 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) if (pl) { if (!append) playlist_clear(mpctx->playlist); - playlist_transfer_entries(mpctx->playlist, pl); + playlist_append_entries(mpctx->playlist, pl); talloc_free(pl); if (!append && mpctx->playlist->first) { -- cgit v1.2.3