forked from shihaam/starlink_status
Satellite View added
This commit is contained in:
parent
b95c26e879
commit
97704ed648
31
bot.sh
31
bot.sh
@ -5,7 +5,8 @@ source .env
|
||||
while true; do
|
||||
|
||||
date=$(date "+%Y%m%d_%H%M%S")
|
||||
image=data/image_$date.png
|
||||
camera_image=data/image_$date.png
|
||||
satellite_image=data/satellite_image_$date.png
|
||||
speedtest_ookla=data/speedtest_ookla_$date.json
|
||||
speedtest_libre=data/speedtest_libre_$date.json
|
||||
speedtest_fast=data/speedtest_fast_$date.json
|
||||
@ -13,10 +14,22 @@ weather_file=data/weather_$date.json
|
||||
edited_image=data/edited_image_$date.png
|
||||
|
||||
#################################################################################
|
||||
echo Grabbing Image
|
||||
echo Grabbing Camara Image
|
||||
# Capture a frame from RTSP stream
|
||||
mpv $RTSP_URL --frames=1 --vo=image --ovc=png --o=$image >> /dev/null
|
||||
echo Image grabbed
|
||||
mpv $RTSP_URL --frames=1 --vo=image --ovc=png --o=$camera_image >> /dev/null
|
||||
echo Camera Image grabbed
|
||||
#################################################################################
|
||||
|
||||
#################################################################################
|
||||
echo Grabbing Satellite Image
|
||||
# scrap html and get image link
|
||||
satellite_image_url=$(curl "https://www.meteorology.gov.mv/?pd=satellite" -s | \
|
||||
grep "https://mobile.codeworks.mv/uploads/Satellite/"| \
|
||||
grep -o 'https://mobile.codeworks.mv/uploads/Satellite/[^"]*' | \
|
||||
tail -n 1)
|
||||
# Download the Setellite Image
|
||||
curl $satellite_image_url -o $satellite_image
|
||||
echo Satellite Image grabbed
|
||||
#################################################################################
|
||||
|
||||
#################################################################################
|
||||
@ -111,7 +124,7 @@ $current_weather
|
||||
#################################################################################
|
||||
|
||||
#################################################################################
|
||||
#convert "$image" \
|
||||
#convert "$camera_image" \
|
||||
# -gravity South \
|
||||
# -font $PWD/JoyPixels.ttf \
|
||||
# -pointsize 20 \
|
||||
@ -121,11 +134,11 @@ $current_weather
|
||||
|
||||
#################################################################################
|
||||
echo Uploading to Telegram
|
||||
curl -X POST https://api.telegram.org/bot$TG_BOT_TOKEN/sendPhoto \
|
||||
curl -X POST https://api.telegram.org/bot$TG_BOT_TOKEN/sendMediaGroup \
|
||||
-F chat_id=$TG_CHATID \
|
||||
-F photo=@$image \
|
||||
-F caption="$caption" \
|
||||
-F parse_mode=Markdown >> /dev/null
|
||||
-F media='[{"type": "photo", "media": "attach://photo1", "caption": "'"$caption"'", "parse_mode": "Markdown"}, {"type": "photo", "media": "attach://photo2"}]' \
|
||||
-F photo1=@$camera_image \
|
||||
-F photo2=@$satellite_image >> /dev/null
|
||||
#################################################################################
|
||||
echo Ok done, Sleeping for $DELAY
|
||||
sleep $DELAY
|
||||
|
Loading…
x
Reference in New Issue
Block a user