diff --git a/lib/yt-playlist b/lib/yt-playlist index 244c9aa..3496456 100755 --- a/lib/yt-playlist +++ b/lib/yt-playlist @@ -48,9 +48,15 @@ function get_input() { exit fi - test $n -ge 0 &> /dev/null - - if [ $? -gt 1 ] + if [ "$n" == "*" ] + then + 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 echo "Bad input, mate. Type in a valid number or 'exit'." get_input diff --git a/shelltube b/shelltube index ca9950c..6ec960b 100755 --- a/shelltube +++ b/shelltube @@ -13,7 +13,7 @@ # [X] Channel support # [ ] Audio dl/stream # [ ] Show related videos -# [ ] Channel & Playlist search +# [|] Channel & Playlist search # [ ] Search filters # [ ] Search & Channel sort-by # [X] Config video player, etc @@ -51,7 +51,7 @@ search() { playlist() { output="$(mktemp -u /tmp/yt_XXXXXX)" yt-playlist -i "$1" "$output" - selected_video="$(cat "$output")" + selected_video="$(sed -n ${1}p "$output")" yt-meta "$selected_video" } @@ -144,6 +144,28 @@ parse() { selected_video="${argument:-$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 ;;