#! /bin/bash
matrix_url="matrixs://uptime-bot:szDAudNcRMvw2vzAap4AWCFc@chat.beatty.family/!hizIEdnJphOz
yRAtoh:chat.beatty.family"
msg_title="New Podcast has been downloaded!"
msg_body="Check what's new on Audiobookshelf podcasts"
tree -J -D -t -r -L 1 --timefmt=%c /home/jimbuntu/audiobookshelf/data/podcasts | jq '.[0].
contents[].time' | \
sed s/\"//g | while IFS= read -r line; do
delta=$(( $(date +%s) - $(date -d "$line" +%s) ))
if [[ $delta -lt 86400 ]]; then
#echo '{"urls":"'"$matrix_url"'","body":"'"$msg_body"'","title":"'"$msg_ti
tle"'"}'
curl -X POST -d '{"urls":"'"$matrix_url"'","body":"'"$msg_body"'","title":
"'"$msg_title"'"}' \
-H "Content-Type: application/json" \
http://192.168.44.137:8525/notify/
break
fi
done