yt: increases speed

This commit is contained in:
Emma Tebibyte 2025-07-01 13:31:08 -06:00
parent bde3e58618
commit af5dc3b865
Signed by: emma
GPG Key ID: 427287A2F16F44FA

11
yt
View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2023 Emma Tebibyte <emma@tebibyte.media>
# Copyright (c) 2023, 2025 Emma Tebibyte <emma@tebibyte.media>
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# This program is free software: you can redistribute it and/or modify it under
@ -230,7 +230,7 @@ queue() {
search() {
test -z "$1" && usage 'search term [count]'
results="$(yt-dlp "ytsearch$2:$1" --print "$FMT")"
results="$(yt-dlp -isq --flat-playlist --print "$FMT" "ytsearch$2:$1")"
cache "$(printf '%s\n' "$results" | sed -e 's/.*\[//g' -e 's/\]/ /g' \
| tr -d '\n')" &
@ -247,9 +247,6 @@ search() {
"copy")
wl-copy "$selection"
;;
"music")
music "$selection"
;;
"play")
play "$selection"
;;
@ -301,7 +298,7 @@ verify() { # replaces videos with archived versions if they are not available
printf "%s: %s: Verifying playlist.\n" "$argv0" "$1" 1>&2
for video in $(lines "$1"); do
for video in $(lines "$1"); do {
if test -n "$(yt-dlp -s "$video" 2>&1 \
| grep -i -e 'video unavailable' -e 'private video' -e 'been removed')"
then
@ -334,7 +331,7 @@ verify() { # replaces videos with archived versions if they are not available
cache "$video" &
archive "$video" &
fi
done
} & done
shift
done