mpv/player
Vladimir Panteleev a92466c289 command: add delete-watch-later-config
This introduces the delete-watch-later-config command, to complement
write-watch-later-config. This is an alternative to #8141.

The general problem that this change is attempting to help solve has
been described in #336, #3169 and #6574. Though persistent playback
position of a single file is generally a solved problem, this is not
the case for playlists, as described in #8138.

The motivation is facilitating intermittent playback of very large
playlists, consisting of hundreds of entries each many hours
long. Though the current "watch later" mechanism works well - provided
that the files each occur only once in that playlist, and are played
only via that playlist - the biggest issue is that the position is
lost completely should mpv exit uncleanly (e.g. due to a power
failure).  Existing workarounds (in the form of Lua scripts which call
write-watch-later-config periodically) fail in the playlist case, due
to the mechanism used by mpv to determine where within a playlist to
resume playback from.

The missing puzzle piece needed to allow scripts to implement a
complete solution to this problem is simply a way to clean up the
watch-later configuration that the script asked mpv to write using
write-watch-later-config. With that in place, scripts can then
register an end-file event listener, check the stop playback reason,
and in the "eof" and "stop" case, invoke delete-watch-later-config to
delete any saved positions written by write-watch-later-config. The
script can then proceed to immediately write a new one when the next
file is loaded, which altogether allows mpv to resume from the correct
playlist and file position upon next startup.

Because events are delivered and executed asynchronously,
delete-watch-later-config takes an optional filename argument, to
allow scripts to clear watch-later configuration for files after mpv
had already moved on from playing them and proceeded to another file.

A Lua script which makes use of this change can be found here:
https://gist.github.com/CyberShadow/2f71a97fb85ed42146f6d9f522bc34ef
(A modification of the one written by @Hakkin, in that this one takes
advantage of the new command, and also saves the state immediately
when a new file is loaded.)
2020-10-22 19:53:35 +00:00
..
javascript js: hooks: allow deferred continuation (match d0ab562b) 2020-08-07 15:12:20 +03:00
lua stats: display hw pixel format too 2020-10-16 17:48:05 +02:00
audio.c player: fix another nightmarish corner case 2020-10-08 00:36:41 +02:00
client.c client API: inactivate the opengl_cb API 2020-09-03 14:52:11 +02:00
client.h
command.c command: add delete-watch-later-config 2020-10-22 19:53:35 +00:00
command.h command: add read-only focused property 2020-09-08 20:09:17 +02:00
configfiles.c command: add delete-watch-later-config 2020-10-22 19:53:35 +00:00
core.h command: add delete-watch-later-config 2020-10-22 19:53:35 +00:00
external_files.c player: add automatic loading of external cover art files 2020-09-28 00:12:52 +02:00
external_files.h player: add automatic loading of external cover art files 2020-09-28 00:12:52 +02:00
javascript.c win32: scripting utils.get_env_list(): use UTF-8 2020-08-16 12:24:19 +03:00
loadfile.c player: cosmetically change around some code 2020-09-28 00:14:54 +02:00
lua.c win32: scripting utils.get_env_list(): use UTF-8 2020-08-16 12:24:19 +03:00
main.c build: change filenames of generated files 2020-06-04 16:59:05 +02:00
misc.c audio: refactor how data is passed to AO 2020-08-29 13:12:32 +02:00
osd.c player: add --term-title option 2020-05-25 20:39:37 +02:00
playloop.c player: add pause state to playback start message 2020-09-21 19:36:25 +02:00
screenshot.c screenshot: add --screenshot-sw option 2020-10-05 00:16:46 +02:00
screenshot.h
scripting.c auto_profiles: add this script 2020-08-05 22:37:47 +02:00
sub.c command: add property to return text subtitles in ASS 2020-05-14 22:14:49 +02:00
video.c player: let frontend decide whether to use cover-art mode 2020-09-28 00:04:21 +02:00