* fixes playlist behaviour :^)
This commit is contained in:
parent
8a19626886
commit
3f0df75398
|
@ -100,35 +100,37 @@ if [[ "${get_data[v]}" ]]; then
|
|||
</div><hr>"
|
||||
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 "<script type='text/javascript'>
|
||||
window.addEventListener('DOMContentLoaded', (event) => {
|
||||
var video = document.getElementById('player');
|
||||
// video.play();
|
||||
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>"
|
||||
echo "<h1>Playlist</h1>"
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue