fixed pick + formatting
This commit is contained in:
parent
b18ff53a8e
commit
f237ab7e1e
15
yt
15
yt
@ -38,8 +38,8 @@ add() { # adds a video to a playlist file
|
||||
while test -f "$YT_PL_DIR/$2.m3u"; do
|
||||
file="$YT_PL_DIR/$2.m3u"
|
||||
video="$(printf '%s\n' "$1" \
|
||||
| sed -e 's/youtu\.be\//www.youtube\.com\/watch?v=/g' -e 's/\?[^v].*$//g')"
|
||||
printf '%s\n' "$video"
|
||||
| sed -e 's/youtu\.be\//www.youtube\.com\/watch?v=/g' \
|
||||
-e 's/\?[^v].*$//g')"
|
||||
|
||||
if test -n "$(grep -e "$video" "$file")"
|
||||
then
|
||||
@ -161,11 +161,14 @@ pick() { # Pick a video to play from a playlist of videos
|
||||
list="$(printf '%s\n%s' "$list" "$(grep "$line" "$cachefile")")"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
chosen="$(printf '%s\n' "$list" | $YTPICK | sed -e 's/.*\[//g' -e 's/\]//g')"
|
||||
printf "%s: %s: Playing stream.\n" "$argv0" "$chosen" 1>&2
|
||||
test -n "$chosen" && mpv "$chosen"
|
||||
chosen="$(printf '%s\n' "$list" \
|
||||
| $YTPICK | sed -e 's/.*\[//g' -e 's/\]//g')"
|
||||
|
||||
test -z "$chosen" \
|
||||
|| printf "%s: %s: Playing stream.\n" "$argv0" "$chosen" 1>&2 \
|
||||
&& mpv "$chosen"
|
||||
fi
|
||||
}
|
||||
|
||||
play() { # play a video after caching its title
|
||||
|
Loading…
Reference in New Issue
Block a user