forked from shihaam/starlink_status
add support for librespeed
This commit is contained in:
parent
73c61a98d6
commit
5f8f557cdb
@ -1,8 +1,12 @@
|
|||||||
FROM archlinux
|
FROM archlinux
|
||||||
|
|
||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
RUN pacman -Sy --noconfirm mpv jq curl speedtest-cli bc npm \
|
RUN pacman -Sy --noconfirm mpv jq curl speedtest-cli bc npm nss \
|
||||||
&& npm install --global fast-cli
|
&& npm install --global fast-cli \
|
||||||
|
&& curl -LOJ https://github.com/librespeed/speedtest-cli/releases/download/v1.0.10/librespeed-cli_1.0.10_linux_amd64.tar.gz \
|
||||||
|
&& tar -xzvf librespeed-cli_1.0.10_linux_amd64.tar.gz \
|
||||||
|
&& mv -v librespeed-cli /usr/bin/librespeed-cli \
|
||||||
|
&& rm -v librespeed-cli_1.0.10_linux_amd64.tar.gz LICENSE
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
36
bot.sh
36
bot.sh
@ -7,6 +7,7 @@ while true; do
|
|||||||
date=$(date "+%Y%m%d_%H%M%S")
|
date=$(date "+%Y%m%d_%H%M%S")
|
||||||
image=data/image_$date.png
|
image=data/image_$date.png
|
||||||
speedtest_ookla=data/speedtest_ookla_$date.json
|
speedtest_ookla=data/speedtest_ookla_$date.json
|
||||||
|
speedtest_libre=data/speedtest_libre_$date.json
|
||||||
speedtest_fast=data/speedtest_fast_$date.json
|
speedtest_fast=data/speedtest_fast_$date.json
|
||||||
weather_file=data/weather_$date.json
|
weather_file=data/weather_$date.json
|
||||||
edited_image=data/edited_image_$date.png
|
edited_image=data/edited_image_$date.png
|
||||||
@ -34,15 +35,28 @@ ookla_upload=$(jq '.upload' "$speedtest_ookla")
|
|||||||
ooka_bytes_received=$(jq '.bytes_received' "$speedtest_ookla")
|
ooka_bytes_received=$(jq '.bytes_received' "$speedtest_ookla")
|
||||||
ooka_bytes_sent=$(jq '.bytes_sent' "$speedtest_ookla")
|
ooka_bytes_sent=$(jq '.bytes_sent' "$speedtest_ookla")
|
||||||
|
|
||||||
# Converting download and upload speeds from bytes per second to Mbit/s
|
# Converting to human readable units
|
||||||
ookla_download_mbps=$(echo "scale=4; $download / 1000000" | bc)
|
ookla_download_mbps=$(echo "scale=4; $download / 1000000" | bc)
|
||||||
ookla_upload_mbps=$(echo "scale=4; $upload / 1000000" | bc)
|
ookla_upload_mbps=$(echo "scale=4; $upload / 1000000" | bc)
|
||||||
|
|
||||||
# Converting bytes to MB
|
|
||||||
ookla_bytes_received_mb=$(echo "scale=2; $bytes_received / 1048576" | bc)
|
ookla_bytes_received_mb=$(echo "scale=2; $bytes_received / 1048576" | bc)
|
||||||
ookla_bytes_sent_mb=$(echo "scale=2; $bytes_sent / 1048576" | bc)
|
ookla_bytes_sent_mb=$(echo "scale=2; $bytes_sent / 1048576" | bc)
|
||||||
|
|
||||||
|
echo Starting LibreSpeed
|
||||||
|
librespeed-cli --json > $speedtest_libre
|
||||||
|
|
||||||
|
# Parsing JSON data
|
||||||
|
libre_bytes_sent=$(jq '.[0].bytes_sent' "$speedtest_libre")
|
||||||
|
libre_bytes_received=$(jq '.[0].bytes_received' "$speedtest_libre")
|
||||||
|
libre_ping=$(jq '.[0].ping' "$speedtest_libre")
|
||||||
|
libre_upload=$(jq '.[0].upload' "$speedtest_libre")
|
||||||
|
libre_download=$(jq '.[0].download' "$speedtest_libre")
|
||||||
|
libre_server_name=$(jq -r '.[0].server.name' "$speedtest_libre")
|
||||||
|
|
||||||
|
# Converting to human readable units
|
||||||
|
libre_bytes_sent_mb=$(echo "scale=2; $bytes_sent / 1048576" | bc)
|
||||||
|
libre_bytes_received_mb=$(echo "scale=2; $bytes_received / 1048576" | bc)
|
||||||
|
|
||||||
|
echo Starting Fast
|
||||||
fast --upload --json > $speedtest_fast
|
fast --upload --json > $speedtest_fast
|
||||||
fast_download_speed=$(jq '.downloadSpeed' "$speedtest_fast")
|
fast_download_speed=$(jq '.downloadSpeed' "$speedtest_fast")
|
||||||
fast_upload_speed=$(jq '.uploadSpeed' "$speedtest_fast")
|
fast_upload_speed=$(jq '.uploadSpeed' "$speedtest_fast")
|
||||||
@ -50,7 +64,7 @@ fast_latency=$(jq '.latency' "$speedtest_fast")
|
|||||||
fast_downloaded=$(jq '.downloaded' "$speedtest_fast")
|
fast_downloaded=$(jq '.downloaded' "$speedtest_fast")
|
||||||
fast_uploaded=$(jq '.uploaded' "$speedtest_fast")
|
fast_uploaded=$(jq '.uploaded' "$speedtest_fast")
|
||||||
|
|
||||||
echo Speedtest complete
|
echo Speedtests complete
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
@ -77,19 +91,19 @@ echo Weather checked
|
|||||||
caption="
|
caption="
|
||||||
$current_weather
|
$current_weather
|
||||||
|
|
||||||
Speedtest by Ookla:
|
*Speedtest by Ookla*:
|
||||||
🌐 *Server*: $ookla_server, $ookla_city, $ookla_country
|
🌐 *Server*: $ookla_server, $ookla_city, $ookla_country
|
||||||
🏓 *Latency*: $ookla_ping ms
|
🏓 *Latency*: $ookla_ping ms
|
||||||
⬇️ *Download*: $ookla_download_mbps Mbit/s, Used: $ookla_bytes_received_mb MB
|
⬇️ *Download*: $ookla_download_mbps Mbit/s, Used: $ookla_bytes_received_mb MB
|
||||||
⬆️ *Upload*: Upload: $ookla_upload_mbps Mbit/s, Used: $ookla_bytes_sent_mb MB
|
⬆️ *Upload*: Upload: $ookla_upload_mbps Mbit/s, Used: $ookla_bytes_sent_mb MB
|
||||||
|
|
||||||
LibreSpeed:
|
*LibreSpeed*:
|
||||||
🌐 *Server*:
|
🌐 *Server*: $libre_server_name
|
||||||
🏓 *Latency*: ms
|
🏓 *Latency*: $libre_ping ms
|
||||||
⬇️ *Download*: Mbit/s, Used: MB
|
⬇️ *Download*: $libre_download Mbit/s, Used: $libre_bytes_received_mb MB
|
||||||
⬆️ *Upload*: Upload: Mbit/s, Used MB
|
⬆️ *Upload*: Upload: $libre_uploadv Mbit/s, Used $libre_bytes_sent_mb MB
|
||||||
|
|
||||||
Fast Powered by Netflix:
|
*Fast Powered by Netflix*:
|
||||||
🏓 *Latency*: $fast_latency ms
|
🏓 *Latency*: $fast_latency ms
|
||||||
⬇️ *Download*: $fast_download_speed Mbit/s, Used: $fast_downloaded MB
|
⬇️ *Download*: $fast_download_speed Mbit/s, Used: $fast_downloaded MB
|
||||||
⬆️ *Upload*: Upload: $fast_upload_speed Mbit/s, Used: $fast_uploaded MB
|
⬆️ *Upload*: Upload: $fast_upload_speed Mbit/s, Used: $fast_uploaded MB
|
||||||
|
Loading…
x
Reference in New Issue
Block a user