* channel: move to the new templating engine
This commit is contained in:
parent
7e4e26f0f2
commit
dda217195d
|
@ -1,2 +1,5 @@
|
||||||
{{.subscribe}}
|
<h1>{{.subscribe}}</h1>
|
||||||
{{.videos}}
|
{{.err}}
|
||||||
|
{{start _videos}}
|
||||||
|
<a href='/watch?v={{.id}}'><img src='http://i.ytimg.com/vi/{{.id}}/mqdefault.jpg'><br>{{.title}}</a><br>
|
||||||
|
{{end _videos}}
|
||||||
|
|
|
@ -28,16 +28,23 @@ 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))
|
||||||
|
|
||||||
#strings[subscribe]="<h1>$title</h1><a href='subscribe.shs?id=$(html_encode "${get_data[id]}")'>Subscribe!</a><br>"
|
strings[subscribe]="$(html_encode "$title")"
|
||||||
strings[subscribe]='<h1>'"$(html_encode "$title")'s channel"'</h1>'
|
|
||||||
echo uwu > /dev/stderr
|
|
||||||
for (( i=0; i<${#video_id[@]}; i++ )); do
|
|
||||||
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
|
|
||||||
|
|
||||||
if [[ ! ${strings[videos]} ]]; then
|
nested_declare meow
|
||||||
strings[videos]="Failed to fetch videos or channel does not have videos"
|
declare -A nyaa
|
||||||
|
for (( i=0; i<${#video_id[@]}; i++ )); do
|
||||||
|
nyaa[id]="${video_id[$i]}"
|
||||||
|
nyaa[title]="${video_title[$i]}"
|
||||||
|
|
||||||
|
nested_add meow nyaa
|
||||||
|
done
|
||||||
|
strings[_videos]+="meow"
|
||||||
|
|
||||||
|
nested_get meow 0
|
||||||
|
strings[err]=''
|
||||||
|
if [[ "${res[id]}" == '' ]]; then
|
||||||
|
strings[err]="Failed to fetch videos?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source "${cfg[namespace]}/templates/header.shs"
|
source "${cfg[namespace]}/templates/header.shs"
|
||||||
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/channel.t"
|
render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/channel.t"
|
||||||
|
|
Loading…
Reference in a new issue