summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/interface-changes.rst2
-rw-r--r--DOCS/man/input.rst7
-rw-r--r--player/command.c13
-rw-r--r--player/configfiles.c17
-rw-r--r--player/core.h1
5 files changed, 40 insertions, 0 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index 0089f4425b..2a7120b10c 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -145,6 +145,8 @@ Interface changes
- change the default of --hwdec to "no" on RPI. The default used to be "mmal"
specifically if 'Raspberry Pi support' was enabled at configure time
(equivalent to --enable-rpi). Use --hwdec=mmal to get the old behavior.
+ - add `delete-watch-later-config` command to complement
+ `write-watch-later-config`
--- mpv 0.30.0 ---
- add `--d3d11-output-format` to enable explicit selection of a D3D11
swap chain format.
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 6167da776e..d548110c93 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -724,6 +724,13 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
Write the resume config file that the ``quit-watch-later`` command writes,
but continue playback normally.
+``delete-watch-later-config [<filename>]``
+ Delete any existing resume config file that was written by
+ ``quit-watch-later`` or ``write-watch-later-config``. If a filename is
+ specified, then the deleted config is for that file; otherwise, it is the
+ same one as would be written by ``quit-watch-later`` or
+ ``write-watch-later-config`` in the current circumstance.
+
``stop [<flags>]``
Stop playback and clear playlist. With default settings, this is
essentially like ``quit``. Useful for the client API: playback can be
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);