watch.shs improved (with support for disabled likes and comments)

18l-fix
sech1p 2021-03-14 15:58:30 +01:00
parent ac879ac79d
commit 9219c23481
2 changed files with 18 additions and 3 deletions

View File

@ -7,7 +7,7 @@
</div>
<div>
<b>{{.view_count}}</b> views<br>
<b>{{.like_count}}</b> likes, <b>{{.dislike_count}}</b> dislikes.<br>
{{.like_dislike_count}}<br>
{{.fav}}
{{.sub}}
<br><br>

View File

@ -55,8 +55,15 @@ if [[ "${get_data[v]}" ]]; then
strings[upload_date]=$(date -d "$(echo $video | jq -r '.upload_date' | sed -E 's/..../&-/;s/....-../&-/')" "+%d %B %Y")
strings[view_count]=$(echo $video | jq -r '.view_count')
strings[like_count]=$(echo $video | jq -r '.like_count')
strings[dislike_count]=$(echo $video | jq -r '.dislike_count')
like_count=$(echo $video | jq -r '.like_count')
dislike_count=$(echo $video | jq -r '.dislike_count')
if [[ ${cfg[template]} == 'default' ]]; then
if [[ $like_count == 'null' && $dislike_count == 'null' ]]; then
strings[like_dislike_count]="Likes are turned off"
else
strings[like_dislike_count]="<b>$like_count</b> likes, <b>$dislike_count</b> dislikes."
fi
fi
strings[sub]=''
#<video id='player' src='$url' controls></video>
@ -140,6 +147,14 @@ if [[ "${get_data[v]}" ]]; then
done
fi
if [[ ! ${strings[recommended]} ]]; then
strings[recommended]='An error occurred during fetching Recommended Videos'
fi
if [[ ! ${strings[comments_list]} ]]; then
strings[comments_list]='Comments are turned off<br>or an error occured during fetching their'
fi
source "${cfg[namespace]}/templates/header.shs"
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/watch.t"
else