* fixes playlist behaviour :^)
This commit is contained in:
parent
8a19626886
commit
3f0df75398
|
@ -100,35 +100,37 @@ if [[ "${get_data[v]}" ]]; then
|
||||||
</div><hr>"
|
</div><hr>"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ${get_data[playlist]} ]]; then
|
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]})
|
playlist=$(haruhi-dl $([[ ${cfg[_cookies]} != "" ]] && echo -n -- "-c ${cfg[_cookies]}") -j --flat-playlist "https://www.youtube.com/playlist?list=${get_data[playlist]}")
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
video_title=($(jq -r '.title' <<< $playlist))
|
video_title=($(jq -r '.title' <<< $playlist))
|
||||||
video_id=($(jq -r '.id' <<< $playlist))
|
video_id=($(jq -r '.id' <<< $playlist))
|
||||||
|
|
||||||
next='dQw4w9WgXcQ'
|
|
||||||
|
|
||||||
for (( i=0; i<${#video_id[@]}; i++ )); do
|
for (( i=0; i<${#video_id[@]}; i++ )); do
|
||||||
if [[ ${video_id[$i]} == ${get_data[v]} ]]; then
|
if [[ "${video_id[$i]}" == "${get_data[v]}" ]]; then
|
||||||
next=${video_id[$((i+1))]}
|
next="${video_id[$((i+1))]}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
[[ "$next" == '' ]] && next='dQw4w9WgXcQ'
|
||||||
|
|
||||||
|
echo "$next"
|
||||||
|
|
||||||
echo "<script type='text/javascript'>
|
echo "<script type='text/javascript'>
|
||||||
window.addEventListener('DOMContentLoaded', (event) => {
|
window.addEventListener('DOMContentLoaded', (event) => {
|
||||||
var video = document.getElementById('player');
|
var video = document.getElementById('player');
|
||||||
// video.play();
|
// video.play();
|
||||||
video.addEventListener('ended',function(){
|
video.addEventListener('ended',function(){
|
||||||
window.location = 'watch.shs?v=$next&playlist=${get_data[playlist]}';
|
window.location = 'watch.shs?v=$next&playlist=$(html_encode ${get_data[playlist]})';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>"
|
</script>"
|
||||||
echo "<h1>Playlist</h1>"
|
echo "<h1>Playlist</h1>"
|
||||||
|
|
||||||
for (( i=0; i<${#video_id[@]}; i++ )); do
|
for (( i=0; i<${#video_id[@]}; i++ )); do
|
||||||
echo "<a href='watch.shs?v=${video_id[$i]}&playlist=${get_data[playlist]}'><img src='http://i.ytimg.com/vi/${video_id[$i]}/mqdefault.jpg'><br>${video_title[$i]}</a><br>"
|
echo "<a href='watch.shs?v=${video_id[$i]}&playlist=$(html_encode ${get_data[playlist]})'><img src='http://i.ytimg.com/vi/${video_id[$i]}/mqdefault.jpg'><br>${video_title[$i]}</a><br>"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue