From 3f0df75398a812d8ac047134ddc7c6d8b3c3cdef Mon Sep 17 00:00:00 2001 From: Dominika Liberda Date: Thu, 18 Feb 2021 01:18:37 +0100 Subject: [PATCH] * fixes playlist behaviour :^) --- webroot/watch.shs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/webroot/watch.shs b/webroot/watch.shs index ad67f01..c8b84a4 100755 --- a/webroot/watch.shs +++ b/webroot/watch.shs @@ -100,35 +100,37 @@ if [[ "${get_data[v]}" ]]; then
" done - if [[ ${get_data[playlist]} ]]; then - playlist=$(haruhi-dl $([[ ${cfg[_cookies]} != "" ]] && echo -n -- "-c ${cfg[_cookies]}") -j --flat-playlist https://www.youtube.com/playlist?list=${get_data[playlist]}) + if [[ "${get_data[playlist]}" ]]; then + playlist=$(haruhi-dl $([[ ${cfg[_cookies]} != "" ]] && echo -n -- "-c ${cfg[_cookies]}") -j --flat-playlist "https://www.youtube.com/playlist?list=${get_data[playlist]}") IFS=$'\n' video_title=($(jq -r '.title' <<< $playlist)) video_id=($(jq -r '.id' <<< $playlist)) - - next='dQw4w9WgXcQ' for (( i=0; i<${#video_id[@]}; i++ )); do - if [[ ${video_id[$i]} == ${get_data[v]} ]]; then - next=${video_id[$((i+1))]} + if [[ "${video_id[$i]}" == "${get_data[v]}" ]]; then + next="${video_id[$((i+1))]}" break fi done + [[ "$next" == '' ]] && next='dQw4w9WgXcQ' + + echo "$next" + echo "" echo "

Playlist

" for (( i=0; i<${#video_id[@]}; i++ )); do - echo "
${video_title[$i]}

" + echo "
${video_title[$i]}

" done fi