summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xyt-dlp-and-sleep.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/yt-dlp-and-sleep.sh b/yt-dlp-and-sleep.sh
index 73af1c5..9d0ca49 100755
--- a/yt-dlp-and-sleep.sh
+++ b/yt-dlp-and-sleep.sh
@@ -8,6 +8,11 @@
(
yt-dlp "$@" \
| tee /dev/fd/3 \
- | jq '[.formats|.[]|.available_at|select(. != null)|(. - now)]|max' \
- | (read t && sleep $t)
+ | jq '[
+ .formats | .[] | .available_at
+ | select(. != null)
+ | (. - now)
+ | select(. > 0)
+ ]|max + 0' \
+ | (read t && sleep $t; :)
) 3>&1