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