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
|
||||
|
||||
declare -A strings
|
||||
|
||||
if [[ "${params[id]}" ]]; then
|
||||
data=$(haruhi-dl -J --flat-playlist "https://www.youtube.com/channel/${params[id]}")
|
||||
elif [[ "${params[user]}" ]]; then
|
||||
|
@ -14,15 +16,19 @@ else
|
|||
fi
|
||||
title=$(jq -r '.title' <<< $data)
|
||||
|
||||
meta[title]="$title"
|
||||
source templates/head.sh
|
||||
if [[ ${cfg[template]} == 'default' ]]; then
|
||||
meta[title]="$title"
|
||||
source templates/head.sh
|
||||
fi
|
||||
|
||||
IFS=$'\n'
|
||||
video_title=($(jq -r '.entries[].title' <<< $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
|
||||
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
|
||||
|
||||
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/channel.t"
|
||||
|
|
Loading…
Reference in a new issue