From aa110fc17a39229b6c15bb6dfcd2ac91995b3650 Mon Sep 17 00:00:00 2001 From: dyknon Date: Tue, 1 Sep 2026 00:35:53 +0900 Subject: yt-dlp-and-sleep.sh --- yt-dlp-and-sleep.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 yt-dlp-and-sleep.sh 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 -- cgit v1.2.3