commit
1358afe467
|
@ -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>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<div><br>
|
||||
{{.error}}
|
|
@ -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]="<h1>$title</h1><a href='subscribe.shs?id=$(html_encode "${get_data[id]}")'>Subscribe!</a><br>"
|
||||
|
||||
for (( i=0; i<${#video_id[@]}; i++ )); do
|
||||
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
|
||||
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"
|
||||
|
|
|
@ -23,5 +23,9 @@ for i in $(tac storage/faves | grep -P "^$(session_get_username ${cookies[sh_ses
|
|||
strings[fav]+="<div><a href='watch?v=${array[1]}'><img src='https://i.ytimg.com/vi/${array[1]}/mqdefault.jpg'><br><b>${array[@]:2:999}</b></a><br></div>";
|
||||
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"
|
||||
|
|
|
@ -4,6 +4,8 @@ source ${cfg[namespace]}/templates/header.shs
|
|||
|
||||
declare -A strings
|
||||
|
||||
strings[favourites]="No favorite videos found,<br>you can do it first! ^w^"
|
||||
|
||||
IFS=$'\n'
|
||||
for i in $(tac storage/faves); do
|
||||
IFS=':'
|
||||
|
|
|
@ -120,7 +120,7 @@ window.addEventListener('DOMContentLoaded', (event) => {
|
|||
return 1;
|
||||
}
|
||||
if (a.vcodec !== 'none' && b.vcodec !== 'none') {
|
||||
return b.width - a.height;
|
||||
return b.height - a.height;
|
||||
}
|
||||
if (a.acodec !== 'none' && b.acodec !== 'none') {
|
||||
return b.abr - a.abr;
|
||||
|
|
|
@ -22,5 +22,9 @@ for (( i=0; i<${#video_id[@]}; i++ )); do
|
|||
strings[playlist]+="<a href='watch?v=${video_id[$i]}&playlist=$(html_encode "${get_data[list]}")'><img src='https://i.ytimg.com/vi/${video_id[$i]}/mqdefault.jpg'><br>${video_title[$i]}</a><br>"
|
||||
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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -29,7 +29,11 @@ if [[ "${get_data[q]}" ]]; then
|
|||
strings[results]+="<a href='/watch?v=${id[$i]}'><img src='https://i.ytimg.com/vi/${id[$i]}/mqdefault.jpg'><br>${title[$i]}</a> | ${runtime[$i]} seconds | ${views[$i]} views<br>Uploaded by <a href='/channel/${channel_id[$i]}'>${channel[$i]}</a><br>"
|
||||
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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -1,7 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ ! -d "temp" ]]; then
|
||||
mkdir "temp"
|
||||
fi
|
||||
|
||||
declare -A strings
|
||||
|
||||
if [[ ! $(which haruhi-dl) ]]; then
|
||||
strings[error]='Could not load video'
|
||||
source templates/head.sh
|
||||
source "${cfg[namespace]}/templates/header.shs"
|
||||
render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/watch_error.t"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "${get_data[v]}" ]]; then
|
||||
if [[ "${get_data[v]}" == '18l' || "${get_data[v]}" == '5eFdt6Y_34E' ]]; then
|
||||
strings[uploader]='MyMusicGroup'
|
||||
|
@ -18,8 +30,22 @@ if [[ "${get_data[v]}" ]]; then
|
|||
cd temp
|
||||
video=$(haruhi-dl --write-pages --cookies ${cfg[_cookies]} -J "http://youtube.com/watch?v=${get_data[v]}")
|
||||
if [[ $video == '' ]]; then # okay who did this
|
||||
video=$(haruhi-dl --write-pages --cookies ${cfg[_cookies]} -J "http://youtube.com/watch?v=${get_data[v]}")
|
||||
random_hash=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1)
|
||||
video=$(haruhi-dl --write-pages --cookies ${cfg[_cookies]} -J "http://youtube.com/watch?v=${get_data[v]}" &> output$random_hash.log)
|
||||
if [[ $video == '' ]]; then # seriously WHO DID THIS
|
||||
output=$(cat output$random_hash.log)
|
||||
rm output$random_hash.log
|
||||
cd ..
|
||||
if [[ $output == 'ERROR: Video unavailable' ]]; then
|
||||
strings[error]='Video unavailable'
|
||||
elif [[ $output == *'ERROR: Incomplete YouTube ID'* ]]; then
|
||||
strings[error]='Incomplete YouTube ID'
|
||||
else
|
||||
strings[error]='Unexpected error has occured'
|
||||
fi
|
||||
source templates/head.sh
|
||||
source "${cfg[namespace]}/templates/header.shs"
|
||||
render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/watch_error.t"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
@ -51,8 +77,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>
|
||||
|
@ -136,6 +169,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
|
||||
|
|
Loading…
Reference in New Issue