added queue subcommand

This commit is contained in:
Emma Tebibyte 2023-11-03 00:49:06 -06:00
parent c7ec1f9998
commit e0d5a9c8a9
Signed by: emma
GPG Key ID: 6D661C738815E7DD
2 changed files with 12 additions and 3 deletions

3
README
View File

@ -29,6 +29,9 @@ pick file...
play uri... play uri...
- Plays a video, caching its title first - Plays a video, caching its title first
queue file...
- Queues a playlist
verify file... verify file...
- Verifies that all the videos in a playlist are existent on YouTube, and if - Verifies that all the videos in a playlist are existent on YouTube, and if
they arent, attempts to replace the URI with one from the Wayback Machine. If they arent, attempts to replace the URI with one from the Wayback Machine. If

12
yt
View File

@ -92,10 +92,13 @@ pick() { # Pick a video to play from a list of videos
} }
play() { # play a video after caching its title play() { # play a video after caching its title
cache $@
mpv $@
}
queue() {
while test -n "$1"; do while test -n "$1"; do
cache "$1" mpv "$(tr '\n' ' ' <"$1")"
mpv "$1"
shift
done done
} }
@ -188,6 +191,9 @@ case "$com" in
shift 2>/dev/null || usage 'uri...' shift 2>/dev/null || usage 'uri...'
play "$@" play "$@"
;; ;;
queue)
shift 2>/dev/null || usage 'file...'
queue "$@"
verify) verify)
shift 2>/dev/null || usage 'file...' shift 2>/dev/null || usage 'file...'
verify "$@" verify "$@"