Added a 'queue'

This commit is contained in:
Jaidyn Ann 2017-01-07 12:09:38 -06:00
parent 277432053d
commit 4399e9bb55
2 changed files with 33 additions and 5 deletions

View File

@ -48,9 +48,15 @@ function get_input() {
exit exit
fi fi
test $n -ge 0 &> /dev/null if [ "$n" == "*" ]
then
if [ $? -gt 1 ] cat $temp_file | while IFS='' read -r CUR_LINE
do
echo $CUR_LINE | sed 's/.*data-video-id="//' | sed 's/".*//' >> $output
cp $output /tmp/yt-queue
done
# test $n -ge 0 &> /dev/null
elif [ $? -gt 1 ]
then then
echo "Bad input, mate. Type in a valid number or 'exit'." echo "Bad input, mate. Type in a valid number or 'exit'."
get_input get_input

View File

@ -13,7 +13,7 @@
# [X] Channel support # [X] Channel support
# [ ] Audio dl/stream # [ ] Audio dl/stream
# [ ] Show related videos # [ ] Show related videos
# [ ] Channel & Playlist search # [|] Channel & Playlist search
# [ ] Search filters # [ ] Search filters
# [ ] Search & Channel sort-by # [ ] Search & Channel sort-by
# [X] Config video player, etc # [X] Config video player, etc
@ -51,7 +51,7 @@ search() {
playlist() { playlist() {
output="$(mktemp -u /tmp/yt_XXXXXX)" output="$(mktemp -u /tmp/yt_XXXXXX)"
yt-playlist -i "$1" "$output" yt-playlist -i "$1" "$output"
selected_video="$(cat "$output")" selected_video="$(sed -n ${1}p "$output")"
yt-meta "$selected_video" yt-meta "$selected_video"
} }
@ -144,6 +144,28 @@ parse() {
selected_video="${argument:-$selected_video}" selected_video="${argument:-$selected_video}"
yt-down -s "$selected_video" yt-down -s "$selected_video"
;; ;;
queue | lq )
cat /tmp/yt-queue | while IFS='' read -r CUR_LINE
do
yt-meta "$CUR_LINE"
done
;;
cqueue | cq )
rm /tmp/yt-queue
touch /tmp/yt-queue
;;
dqueue | dq )
for LINE in $(cat /tmp/yt-queue)
do
yt-down "$LINE"
done
;;
squeue | sq )
for LINE in $(cat /tmp/yt-queue)
do
yt-down -s "$LINE"
done
;;
about | ! ) about | ! )
about about
;; ;;