summaryrefslogblamecommitdiffstatshomepage
path: root/content/20/index.md
blob: ac90ad122b9c463ce8e80b82ecf497069aa17cfb (plain) (tree)

























































                                                                                                                   
+++
date = 2024-09-19T22:45:36+02:00
title = "List mpv(1)'s watch_later entries with later(1)"

[taxonomies]
tags = ["projects", "later(1)"]

[extra]
related = []
+++

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)`](https://mpv.io/) 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](https://mpv.io/manual/stable/#resuming-playback)) 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...

This is where a shared effort between my partner
[nortti](https://ahti.space/~nortti/) and me comes in:
[`later(1)`](https://git.oriole.systems/later/about/). It is a small Python
script that parses `mpv(1)`'s [watch
later](https://mpv.io/manual/stable/#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)`](https://github.com/yt-dlp/yt-dlp) 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
```