diff options
| author | dyknon dyknonr5fjp | 2026-09-01 00:35:53 +0900 |
|---|---|---|
| committer | dyknon dyknonr5fjp | 2026-09-01 00:35:53 +0900 |
| commit | aa110fc17a39229b6c15bb6dfcd2ac91995b3650 (patch) | |
| tree | 722a05570119fa0ea0c7b9e8c8f1fdb3e26074fc | |
| parent | 0361ae52af5eb2c61db4fc3f3696277d2ea7f230 (diff) | |
yt-dlp-and-sleep.sh
| -rwxr-xr-x | yt-dlp-and-sleep.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/yt-dlp-and-sleep.sh b/yt-dlp-and-sleep.sh new file mode 100755 index 0000000..73af1c5 --- /dev/null +++ b/yt-dlp-and-sleep.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# pass this in the command-line +#--script-opts ytdl_hook-ytdl_path=/path/to/this-file/yt-dlp-and-sleep.sh +# or, in configuration ~/.config/mpv/mpv.conf +#script-opts=ytdl_hook-ytdl_path=/path/to/this-file/yt-dlp-and-sleep.sh + +( + yt-dlp "$@" \ + | tee /dev/fd/3 \ + | jq '[.formats|.[]|.available_at|select(. != null)|(. - now)]|max' \ + | (read t && sleep $t) +) 3>&1 |
