diff options
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 13 | ||||
-rw-r--r-- | player/configfiles.c | 17 | ||||
-rw-r--r-- | player/core.h | 1 |
3 files changed, 31 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c index e55e6e46d9..b098c645a3 100644 --- a/player/command.c +++ b/player/command.c @@ -5690,6 +5690,17 @@ static void cmd_write_watch_later_config(void *p) mp_write_watch_later_conf(mpctx); } +static void cmd_delete_watch_later_config(void *p) +{ + struct mp_cmd_ctx *cmd = p; + struct MPContext *mpctx = cmd->mpctx; + + char *filename = cmd->args[0].v.s; + if (filename && !*filename) + filename = NULL; + mp_delete_watch_later_conf(mpctx, filename); +} + static void cmd_mouse(void *p) { struct mp_cmd_ctx *cmd = p; @@ -6240,6 +6251,8 @@ const struct mp_cmd_def mp_cmds[] = { }, { "write-watch-later-config", cmd_write_watch_later_config }, + { "delete-watch-later-config", cmd_delete_watch_later_config, + {{"filename", OPT_STRING(v.s), .flags = MP_CMD_OPT_ARG} }}, { "mouse", cmd_mouse, { {"x", OPT_INT(v.i)}, {"y", OPT_INT(v.i)}, diff --git a/player/configfiles.c b/player/configfiles.c index 0150133dbd..3930cf2139 100644 --- a/player/configfiles.c +++ b/player/configfiles.c @@ -433,6 +433,23 @@ exit: talloc_free(conffile); } +void mp_delete_watch_later_conf(struct MPContext *mpctx, const char *file) +{ + if (!file) { + struct playlist_entry *cur = mpctx->playing; + if (!cur) + return; + file = cur->filename; + if (!file) + return; + } + + char *fname = mp_get_playback_resume_config_filename(mpctx, file); + if (fname) + unlink(fname); + talloc_free(fname); +} + void mp_load_playback_resume(struct MPContext *mpctx, const char *file) { if (!mpctx->opts->position_resume) diff --git a/player/core.h b/player/core.h index aab408e92c..ec154dedd0 100644 --- a/player/core.h +++ b/player/core.h @@ -514,6 +514,7 @@ void mp_load_auto_profiles(struct MPContext *mpctx); void mp_get_resume_defaults(struct MPContext *mpctx); void mp_load_playback_resume(struct MPContext *mpctx, const char *file); void mp_write_watch_later_conf(struct MPContext *mpctx); +void mp_delete_watch_later_conf(struct MPContext *mpctx, const char *file); struct playlist_entry *mp_check_playlist_resume(struct MPContext *mpctx, struct playlist *playlist); |