Compare commits

...

2 Commits

Author SHA1 Message Date
f67691e8d7
fixed duplicates showing up in pick 2023-11-24 19:51:18 -07:00
4fa1cc7fde
removed mpv dependency 2023-11-21 22:44:12 -07:00

21
yt
View File

@ -158,7 +158,7 @@ pick() { # Pick a video to play from a playlist of videos
if test -z "$list"; then if test -z "$list"; then
list="$(grep "$line" "$cachefile")" list="$(grep "$line" "$cachefile")"
else else
list="$(printf '%s\n%s' "$list" "$(grep "$line" "$cachefile")")" list="$(printf '%s\n%s' "$list" "$(grep "$line" "$cachefile" | uniq)")"
fi fi
done done
@ -167,18 +167,30 @@ pick() { # Pick a video to play from a playlist of videos
test -z "$chosen" \ test -z "$chosen" \
|| printf "%s: %s: Playing stream.\n" "$argv0" "$chosen" 1>&2 \ || printf "%s: %s: Playing stream.\n" "$argv0" "$chosen" 1>&2 \
&& mpv "$chosen" && play "$chosen"
fi fi
} }
play() { # play a video after caching its title play() { # play a video after caching its title
if test -z "$PLAYER"; then
printf "%s: Please set \$PLAYER to your preferred video player." \
"$argv0" 1>&2
exit 78 # sysexits.h(3) EX_CONFIG
fi
cache "$@" cache "$@"
mpv "$@" "$PLAYER" "$@"
} }
queue() { queue() {
if test -z "$PLAYER"; then
printf "%s: Please set \$PLAYER to your preferred video player." \
"$argv0" 1>&2
exit 78 # sysexits.h(3) EX_CONFIG
fi
while test -f "$YT_PL_DIR/$1.m3u"; do while test -f "$YT_PL_DIR/$1.m3u"; do
mpv "$YT_PL_DIR/$1.m3u" "$PLAYER" "$YT_PL_DIR/$1.m3u"
shift shift
done done
} }
@ -268,7 +280,6 @@ verify() { # replaces videos with archived versions if they are not available
for dep in \ for dep in \
curl \ curl \
jq \ jq \
mpv \
yt-dlp yt-dlp
do do
if ! command -v "$dep" >/dev/null if ! command -v "$dep" >/dev/null