28 lines
963 B
Bash
28 lines
963 B
Bash
#!/bin/bash
|
|
|
|
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]}")
|
|
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
|
|
fi
|
|
|
|
if [[ ${cfg[template]} == 'default' ]]; then
|
|
source templates/head.sh
|
|
fi
|
|
|
|
IFS=$'\n'
|
|
for i in $(tac storage/faves | grep -P "^$(session_get_username ${cookies[sh_session]}):"); do
|
|
IFS=':'
|
|
array=($i)
|
|
if [[ ${array[1]} == '' ]]; then
|
|
break
|
|
fi
|
|
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
|
|
|
|
source "${cfg[namespace]}/templates/header.shs"
|
|
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/fav.t"
|