mirror of
https://github.com/mpv-player/mpv
synced 2025-02-28 19:30:44 +00:00
command: fix loadlist command
A simple inverted condition prevented it from working properly. Also, make sure that playlist is played from beginning when the playlist is replaced.
This commit is contained in:
parent
593aa1834b
commit
889cbc21b1
@ -1945,14 +1945,16 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||||||
char *filename = cmd->args[0].v.s;
|
char *filename = cmd->args[0].v.s;
|
||||||
bool append = cmd->args[1].v.i;
|
bool append = cmd->args[1].v.i;
|
||||||
struct playlist *pl = playlist_parse_file(filename);
|
struct playlist *pl = playlist_parse_file(filename);
|
||||||
if (!pl) {
|
if (pl) {
|
||||||
if (!append)
|
if (!append)
|
||||||
playlist_clear(mpctx->playlist);
|
playlist_clear(mpctx->playlist);
|
||||||
playlist_transfer_entries(mpctx->playlist, pl);
|
playlist_transfer_entries(mpctx->playlist, pl);
|
||||||
talloc_free(pl);
|
talloc_free(pl);
|
||||||
|
|
||||||
if (!append)
|
if (!append) {
|
||||||
mpctx->stop_play = PT_NEXT_ENTRY;
|
mpctx->playlist->current = mpctx->playlist->first;
|
||||||
|
mpctx->stop_play = PT_CURRENT_ENTRY;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mp_tmsg(MSGT_CPLAYER, MSGL_ERR,
|
mp_tmsg(MSGT_CPLAYER, MSGL_ERR,
|
||||||
"\nUnable to load playlist %s.\n", filename);
|
"\nUnable to load playlist %s.\n", filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user