diff options
| -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 |
