zunzuncito

If you are like me then you have a basically never-ending backlog of videos to watch. Perhaps sometimes you even watch videos so long that they’re basically impossible to finish in one sitting. Or you have about an hour left on a video, but you should really go to sleep.

All of these require some way to remember the timestamp where you left off. I use mpv(1) to watch my videos and thankfully there is a built-in way to do this. By default, hitting Q will quit the video and remember the timestamp (among other settings) for next time you open the file. This works regardless of whether the video exists on your filesystem or is streamed from a URL.

After a while of using this you might amass more than a couple of unfinished videos that mpv(1) knows about, but what it sadly does not provide is an easy way to show you which videos those are…

Whilst you can set write-filename-in-watch-later-config and have mpv(1) save filenames and URLs in its watch later entries, quickly finding them is another story.

This is where a shared effort between my partner nortti and me comes in: later(1). It is a small Python script that parses mpv(1)’s watch later entries and displays them in a human-readable and pretty manner:

albatross ~$ later
Sep 19 19:50	https://www.youtube.com/watch?v=VKGtMK4CGV4	# The 2 Hour Hunt for Light Arrows - OoT Randomizer
Sep 19 22:30	/home/wolf/Mall Grab - Understand feat. Brendan Yates.webm

From here it is easy to open up the video you want to continue watching: simply paste the path or URL printed by later(1) into mpv(1).

You might notice that the YouTube video is commented with its title. This is not information that mpv(1) saves, but later(1) can help here too. Using the -u or --update-titles flag, it will extract video titles using yt-dlp(1) and save them in its cache for subsequent retrieval. This should work for any site that yt-dlp(1) itself supports.

If you have a Python available, setting up and using later(1) is trivial: simply copy the script into a directory in your $PATH (and the manual into $MANPATH) or use the Makefile:

$ PREFIX=~/.local make install

Do note that for later(1) to work correctly, the aforementioned write-filename-in-watch-later-config setting needs to be set.