Add channel template (+ fix /issues/8 i guess)
This commit is contained in:
parent
89feca7ae8
commit
16cbc44a5a
2
templates/themes/default/channel.t
Normal file
2
templates/themes/default/channel.t
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
{{.subscribe}}
|
||||||
|
{{.videos}}
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
declare -A strings
|
||||||
|
|
||||||
if [[ "${params[id]}" ]]; then
|
if [[ "${params[id]}" ]]; then
|
||||||
data=$(haruhi-dl -J --flat-playlist "https://www.youtube.com/channel/${params[id]}")
|
data=$(haruhi-dl -J --flat-playlist "https://www.youtube.com/channel/${params[id]}")
|
||||||
elif [[ "${params[user]}" ]]; then
|
elif [[ "${params[user]}" ]]; then
|
||||||
|
@ -14,15 +16,19 @@ else
|
||||||
fi
|
fi
|
||||||
title=$(jq -r '.title' <<< $data)
|
title=$(jq -r '.title' <<< $data)
|
||||||
|
|
||||||
meta[title]="$title"
|
if [[ ${cfg[template]} == 'default' ]]; then
|
||||||
source templates/head.sh
|
meta[title]="$title"
|
||||||
|
source templates/head.sh
|
||||||
|
fi
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
video_title=($(jq -r '.entries[].title' <<< $data))
|
video_title=($(jq -r '.entries[].title' <<< $data))
|
||||||
video_id=($(jq -r '.entries[].id' <<< $data))
|
video_id=($(jq -r '.entries[].id' <<< $data))
|
||||||
|
|
||||||
echo "<h1>$title</h1><a href='subscribe.shs?id=$(html_encode "${get_data[id]}")'>Subscribe!</a><br>"
|
strings[subscribe]="<h1>$title</h1><a href='subscribe.shs?id=$(html_encode "${get_data[id]}")'>Subscribe!</a><br>"
|
||||||
|
|
||||||
for (( i=0; i<${#video_id[@]}; i++ )); do
|
for (( i=0; i<${#video_id[@]}; i++ )); do
|
||||||
echo "<a href='watch?v=${video_id[$i]}'><img src='http://i.ytimg.com/vi/${video_id[$i]}/mqdefault.jpg'><br>${video_title[$i]}</a><br>"
|
strings[videos]+="<a href='/watch?v=${video_id[$i]}'><img src='http://i.ytimg.com/vi/${video_id[$i]}/mqdefault.jpg'><br>${video_title[$i]}</a><br>"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/channel.t"
|
||||||
|
|
Loading…
Reference in a new issue