blob: fbc99c1b4c7f5a490f7c6d218a58687f0918a2ab (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
+++
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...
Whilst you can set
[`write-filename-in-watch-later-config`](https://mpv.io/manual/stable/#options-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](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
```
Do note that for `later(1)` to work correctly, the aforementioned
`write-filename-in-watch-later-config` setting needs to be set.
|