summaryrefslogtreecommitdiffstats
path: root/player/configfiles.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-07-07 11:09:36 -0500
committerDudemanguy <random342@airmail.cc>2023-07-08 14:33:47 +0000
commit6a365b258ac77d7e4759e0ae14ccc9e882c4c86f (patch)
treec8a536b8a343d5bc453970ed4d6430a623167baf /player/configfiles.c
parentf5eb7ea1a9a655ba2e1775341554bf239cfe65a8 (diff)
downloadmpv-6a365b258ac77d7e4759e0ae14ccc9e882c4c86f.tar.bz2
mpv-6a365b258ac77d7e4759e0ae14ccc9e882c4c86f.tar.xz
player: delete watch_later file after successful load
Currently, mpv immediately deletes the watch_later file after an attempt at playing the file is made. This is not really ideal because the file may fail to load for a variety of reasons (including not even existing), but the state is cleared anyway unconditionally. Instead, just wait until after playback is successfully initialized before deleting it. This way silly mistakes like forgetting to mount the drive doesn't result in deleting your watch_later data. Fixes #3427.
Diffstat (limited to 'player/configfiles.c')
-rw-r--r--player/configfiles.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/player/configfiles.c b/player/configfiles.c
index f98495d1ac..d3df836eea 100644
--- a/player/configfiles.c
+++ b/player/configfiles.c
@@ -396,17 +396,18 @@ void mp_delete_watch_later_conf(struct MPContext *mpctx, const char *file)
talloc_free(fname);
}
-void mp_load_playback_resume(struct MPContext *mpctx, const char *file)
+bool mp_load_playback_resume(struct MPContext *mpctx, const char *file)
{
+ bool resume = false;
if (!mpctx->opts->position_resume)
- return;
+ return resume;
char *fname = mp_get_playback_resume_config_filename(mpctx, file);
if (fname && mp_path_exists(fname)) {
if (mpctx->opts->position_check_mtime &&
!mp_is_url(bstr0(file)) && !check_mtime(file, fname))
{
talloc_free(fname);
- return;
+ return resume;
}
// Never apply the saved start position to following files
@@ -414,9 +415,10 @@ void mp_load_playback_resume(struct MPContext *mpctx, const char *file)
MP_INFO(mpctx, "Resuming playback. This behavior can "
"be disabled with --no-resume-playback.\n");
try_load_config(mpctx, fname, M_SETOPT_PRESERVE_CMDLINE, MSGL_V);
- unlink(fname);
+ resume = true;
}
talloc_free(fname);
+ return resume;
}
// Returns the first file that has a resume config.