summaryrefslogtreecommitdiffstats
path: root/player/loadfile.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/loadfile.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/loadfile.c')
-rw-r--r--player/loadfile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index f11bb5bad1..2fadbb4fc1 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -1590,7 +1590,7 @@ static void play_current_file(struct MPContext *mpctx)
mp_load_auto_profiles(mpctx);
- mp_load_playback_resume(mpctx, mpctx->filename);
+ bool watch_later = mp_load_playback_resume(mpctx, mpctx->filename);
load_per_file_options(mpctx->mconfig, mpctx->playing->params,
mpctx->playing->num_params);
@@ -1737,6 +1737,9 @@ static void play_current_file(struct MPContext *mpctx)
mp_notify(mpctx, MPV_EVENT_FILE_LOADED, NULL);
update_screensaver_state(mpctx);
+ if (watch_later)
+ mp_delete_watch_later_conf(mpctx, mpctx->filename);
+
if (mpctx->max_frames == 0) {
if (!mpctx->stop_play)
mpctx->stop_play = PT_NEXT_ENTRY;