New backup 2025-10-09 21:15:02

This commit is contained in:
Penelope Gwen 2025-10-09 21:15:02 -07:00
parent ca02717249
commit c10b17599f

View file

@ -3,20 +3,22 @@
cache_path="${HOME}/.cache/mcstatus"
mcstatus_cache="${cache_path}/mcstatus.json"
mkdir -p "${cache_path}"
server_list=("mc.pogmom.me" "mc.pogmom.me")
server_list=("mc.pogmom.me" "ian.hotn.gay")
update_cache_json(){
for s in "${server_list[@]}";do
mcstatus "${s}" json | jq '. += {"address":"'"${s}"'","icon_path":"'"${cache_path}/${s}"'.png"}'
done | jq -n '[inputs]' | tee "${mcstatus_cache}" >/dev/null
jq -rc '.[] | "\(.address) \(.status.icon)"' ~/.cache/mcstatus.json | while read name icon;do
echo "${icon/*base64,/}" | base64 --decode > "${cache_path}/${name}.png"
# for s in "${server_list[@]}";do
# mcstatus "${s}" json | jq '. += {"address":"'"${s}"'","icon_path":"'"${cache_path}/${s}"'.png"}'
# done | jq -n '[inputs]' | tee "${mcstatus_cache}" >/dev/null
jq -rc '.[] | "\(.address) \(.status.icon)"' "${mcstatus_cache}" | while read name icon;do
echo "${name}"
echo "${icon/*base64,/}"
# echo "${icon/*base64,/}" | base64 --decode > "${cache_path}/${name}.png"
done
}
if [[ ! $(find "${mcstatus_cache}" -cmin -60 -print 2>/dev/null) ]]; then
#if [[ ! $(find "${mcstatus_cache}" -cmin -15 -print 2>/dev/null) ]]; then
update_cache_json
fi
#fi
cat "${mcstatus_cache}"
#cat "${mcstatus_cache}"