There’s no mpv community to share this to, so I figured the next best place was here.
I wrote a script that does two things:
- Saves the watch_later file for the currently playing file every X seconds, if the file is not currently paused.
- Saves a “watched” dummy file when the currently playing file exceeds a certain percentage of watch time.
Normally mpv saves the watch_later file for the currently playing file only if you gracefully quit. This isn’t reliable enough for my tastes, so this timer makes better sure my last position is saved.
The second addition is purely for the benefit of additional scripting, inside or outside of mpv. The mpv-created watch_later files are intended to be impermanent, and I believe depending on settings are automatically removed once a file is played to 100%. I personally still want to keep track that I watched a specific video, even when the watch_later file is reset.
It probably goes without saying, but this script has only been tested in Linux.
I like your description of yt-dlp