diff --git a/templates/themes/default/watch.t b/templates/themes/default/watch.t
index 474569b..45b3682 100644
--- a/templates/themes/default/watch.t
+++ b/templates/themes/default/watch.t
@@ -29,20 +29,21 @@
-
+
+{{start ?playlist}}
Playlist
-{{start _playlist}}
-
{{.title}}
+
+ {{start _playlist}}
-{{end _playlist}}
+
{{.title}}
+ {{end _playlist}}
+{{end ?playlist}}
diff --git a/webroot/fav.shs b/webroot/fav.shs
index d5c4307..0437011 100644
--- a/webroot/fav.shs
+++ b/webroot/fav.shs
@@ -3,7 +3,7 @@
declare -A strings
if session_verify "${cookies[sh_session]}" && [[ "${get_data[v]}" != '' ]]; then
- title=$(haruhi-dl --cookies ${cfg[_cookies]} -e "https://youtube.com/watch?v=${get_data[v]}")
+ title=$(yt-dlp --cookies ${cfg[_cookies]} -e "https://youtube.com/watch?v=${get_data[v]}")
if [[ $(grep -F "$title" storage/faves | grep "$(echo ${cookies[username]} | sed -E "s/\r//")") == '' ]]; then
echo "$(session_get_username ${cookies[sh_session]}):${get_data[v]}:$title" >> storage/faves
fi
diff --git a/webroot/search.shs b/webroot/search.shs
index d61557b..3007074 100755
--- a/webroot/search.shs
+++ b/webroot/search.shs
@@ -1,4 +1,5 @@
#!/bin/bash
+source "${cfg[namespace]}/code/common.sh"
declare -A meow
@@ -21,7 +22,7 @@ if [[ "${get_data[search_query]}" ]]; then
id=($(jq -r '.id' <<< "$data"))
title=($(jq -r '.title' <<< "$data"))
runtime=($(jq -r '.duration' <<< "$data"))
- views=($(jq -r '.view_count' <<< "$data" | xargs printf "%d\n"))
+ views=($(jq -r '.view_count' <<< "$data" | format_numbers))
channel=($(jq -r '.channel' <<< "$data"))
channel_id=($(jq -r '.channel_id' <<< "$data"))
diff --git a/webroot/watch.shs b/webroot/watch.shs
index ff3bd1c..5290178 100755
--- a/webroot/watch.shs
+++ b/webroot/watch.shs
@@ -1,14 +1,5 @@
#!/bin/bash
-#TODO: move this somewhere more apropriate
-#jq_to_array(jq_expression)
-function _jq_to_array() {
- declare -ga "_tmp=($(jq -r "$1" | sed 's/[][`~!@#$%^&*():;<>.,?\|{}=+-]/\\&/g;'"s@\\\'@\\'@g" ))"
-}
-
-
-function format_numbers() {
- rev | sed "s#[[:digit:]]\{3\}#&,#g" | rev | sed -E 's/^,//'
-}
+source "${cfg[namespace]}/code/common.sh"
if [[ ! -d "temp" ]]; then
mkdir "temp"
@@ -194,8 +185,7 @@ if [[ "${get_data[v]}" ]]; then
done
strings[_recommended]="rec"
-
- strings[playlist]=""
+ strings[next]=""
if [[ "${get_data[playlist]}" ]]; then
playlist=$(yt-dlp --cookies ${cfg[_cookies]} -j --flat-playlist "https://www.youtube.com/playlist?list=${get_data[playlist]}")
@@ -213,6 +203,7 @@ if [[ "${get_data[v]}" ]]; then
[[ "$next" == '' ]] && next='dQw4w9WgXcQ'
+ strings[?playlist]=true
strings[playlist_id]="$(html_encode "${get_data[playlist]}")"
strings[next]="$next"