info
This commit is contained in:
parent
b6b0f55b82
commit
b6b0c07d33
13
bot.sh
13
bot.sh
@ -11,11 +11,14 @@ weather_file=data/weather_$date.json
|
|||||||
edited_image=data/edited_image_$date.png
|
edited_image=data/edited_image_$date.png
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
echo Grabbing Image
|
||||||
# Capture a frame from RTSP stream
|
# Capture a frame from RTSP stream
|
||||||
mpv rtsp://$RTSP_IP --frames=1 --vo=image --ovc=png --o=$image
|
mpv rtsp://$RTSP_IP --frames=1 --vo=image --ovc=png --o=$image >> /dev/null
|
||||||
|
echo Image grabbed
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
echo Doing speedtest
|
||||||
# Run speedtest and output to a file
|
# Run speedtest and output to a file
|
||||||
speedtest > $speedtest_result
|
speedtest > $speedtest_result
|
||||||
# Extract information from the speedtest output
|
# Extract information from the speedtest output
|
||||||
@ -23,9 +26,11 @@ isp_name=$(grep -oP 'Hosted by \K.*(?= \[)' $speedtest_result)
|
|||||||
latency=$(grep -oP 'Hosted by.*\[.*\]: \K[0-9.]+(?= ms)' $speedtest_result)
|
latency=$(grep -oP 'Hosted by.*\[.*\]: \K[0-9.]+(?= ms)' $speedtest_result)
|
||||||
download_speed=$(grep -oP 'Download: \K.*(?= Mbit/s)' $speedtest_result)
|
download_speed=$(grep -oP 'Download: \K.*(?= Mbit/s)' $speedtest_result)
|
||||||
upload_speed=$(grep -oP 'Upload: \K.*(?= Mbit/s)' $speedtest_result)
|
upload_speed=$(grep -oP 'Upload: \K.*(?= Mbit/s)' $speedtest_result)
|
||||||
|
echo Speedtest complete
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
echo Checking weather
|
||||||
# Make the API request
|
# Make the API request
|
||||||
curl -s "https://api.open-meteo.com/v1/forecast?latitude=${LATITUDE}&longitude=${LONGITUDE}¤t_weather=true" > $weather_file
|
curl -s "https://api.open-meteo.com/v1/forecast?latitude=${LATITUDE}&longitude=${LONGITUDE}¤t_weather=true" > $weather_file
|
||||||
# Extract Weather Condition
|
# Extract Weather Condition
|
||||||
@ -41,6 +46,7 @@ case $weather_condition in
|
|||||||
95|96|99) current_weather="⛈️ Thunderstorm" ;;
|
95|96|99) current_weather="⛈️ Thunderstorm" ;;
|
||||||
*) current_weather="🌐 Weather condition not recognized" ;;
|
*) current_weather="🌐 Weather condition not recognized" ;;
|
||||||
esac
|
esac
|
||||||
|
echo Weather checked
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
@ -64,13 +70,14 @@ $current_weather
|
|||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
echo Uploading to Telegram
|
||||||
curl -X POST https://api.telegram.org/bot$TG_BOT_API_KEY/sendPhoto \
|
curl -X POST https://api.telegram.org/bot$TG_BOT_API_KEY/sendPhoto \
|
||||||
-F chat_id=$TG_CHANNEL_ID \
|
-F chat_id=$TG_CHANNEL_ID \
|
||||||
-F photo=@$image \
|
-F photo=@$image \
|
||||||
-F caption="$caption" \
|
-F caption="$caption" \
|
||||||
-F parse_mode=Markdown
|
-F parse_mode=Markdown >> /dev/null
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
echo Ok done, Sleeping
|
||||||
sleep $DELAY
|
sleep $DELAY
|
||||||
|
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user