diff --git a/webroot/channel.shs b/webroot/channel.shs index b9181bb..aac1569 100644 --- a/webroot/channel.shs +++ b/webroot/channel.shs @@ -14,6 +14,7 @@ else echo "Please specify either id or name" return fi + title=$(jq -r '.title' <<< $data) if [[ ${cfg[template]} == 'default' ]]; then @@ -27,9 +28,13 @@ video_id=($(jq -r '.entries[].id' <<< $data)) strings[subscribe]="

$title

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

" done +if [[ ! ${strings[videos]} ]]; then + strings[videos]="Failed to fetch videos or channel does not have videos" +fi + source "${cfg[namespace]}/templates/header.shs" render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/channel.t" diff --git a/webroot/fav.shs b/webroot/fav.shs index c48b6a0..d5c4307 100644 --- a/webroot/fav.shs +++ b/webroot/fav.shs @@ -23,5 +23,9 @@ for i in $(tac storage/faves | grep -P "^$(session_get_username ${cookies[sh_ses strings[fav]+="

${array[@]:2:999}

"; done +if [[ ! ${strings[fav]} ]]; then + strings[fav]="You are not logged in or you do not have any favorites" +fi + source "${cfg[namespace]}/templates/header.shs" render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/fav.t" diff --git a/webroot/index.shs b/webroot/index.shs index 1980ee5..0d1be18 100755 --- a/webroot/index.shs +++ b/webroot/index.shs @@ -4,6 +4,8 @@ source ${cfg[namespace]}/templates/header.shs declare -A strings +strings[favourites]="No favorite videos found,
you can do it first! ^w^" + IFS=$'\n' for i in $(tac storage/faves); do IFS=':' diff --git a/webroot/playlist.shs b/webroot/playlist.shs index 456b132..6fbb802 100644 --- a/webroot/playlist.shs +++ b/webroot/playlist.shs @@ -22,5 +22,9 @@ for (( i=0; i<${#video_id[@]}; i++ )); do strings[playlist]+="
${video_title[$i]}

" done +if [[ ! ${strings[playlist]} ]]; then + strings[playlist]="Invalid playlist or playlist does not have videos" +fi + source "${cfg[namespace]}/templates/header.shs" render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/playlist.t" diff --git a/webroot/register.shs b/webroot/register.shs index c767b4a..768f4d9 100755 --- a/webroot/register.shs +++ b/webroot/register.shs @@ -14,6 +14,8 @@ source templates/head.sh if [[ $status == 1 && $reason != '' ]]; then strings[reason]="$reason" +else + strings[reason]="" fi render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/register.t" diff --git a/webroot/search.shs b/webroot/search.shs index 098d06e..d6e2619 100755 --- a/webroot/search.shs +++ b/webroot/search.shs @@ -29,7 +29,11 @@ if [[ "${get_data[q]}" ]]; then strings[results]+="
${title[$i]}
| ${runtime[$i]} seconds | ${views[$i]} views
Uploaded by ${channel[$i]}
" done else - echo "search for something will 'ya?" + strings[results]="search for something will 'ya?" +fi + +if [[ ! $(which haruhi-dl) || $? != "0" ]]; then + strings[results]="Could not fetch search results" fi source "${cfg[namespace]}/templates/header.shs" diff --git a/webroot/subscribe.shs b/webroot/subscribe.shs index 5dee1fb..bb79347 100644 --- a/webroot/subscribe.shs +++ b/webroot/subscribe.shs @@ -27,5 +27,9 @@ done unset IFS +if [[ ! ${strings[subscribe]} ]]; then + strings[subscribe]="You are not logged in or you do not have any subscribed channels" +fi + source "${cfg[namespace]}/templates/header.shs" render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/subscribe.t" diff --git a/webroot/watch.shs b/webroot/watch.shs index c3c5e29..182d1f0 100755 --- a/webroot/watch.shs +++ b/webroot/watch.shs @@ -2,6 +2,10 @@ declare -A strings +if [[ ! $(which haruhi-dl) ]]; then + echo "Could not load video" +fi + if [[ "${get_data[v]}" ]]; then if [[ "${get_data[v]}" == '18l' || "${get_data[v]}" == '5eFdt6Y_34E' ]]; then strings[uploader]='MyMusicGroup'