diff --git a/templates/themes/default/channel.t b/templates/themes/default/channel.t new file mode 100644 index 0000000..e7519e8 --- /dev/null +++ b/templates/themes/default/channel.t @@ -0,0 +1,2 @@ +{{.subscribe}} +{{.videos}} diff --git a/webroot/channel.shs b/webroot/channel.shs index cce4e3b..d7f7cbe 100644 --- a/webroot/channel.shs +++ b/webroot/channel.shs @@ -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 "

$title

Subscribe!
" +strings[subscribe]="

$title

Subscribe!
" for (( i=0; i<${#video_id[@]}; i++ )); do - echo "
${video_title[$i]}

" + strings[videos]+="
${video_title[$i]}

" done + +render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/channel.t"