Correction fip.sh
This commit is contained in:
5
fip.sh
5
fip.sh
@@ -38,19 +38,14 @@ function print_data() {
|
|||||||
|
|
||||||
md5=""
|
md5=""
|
||||||
while true; do
|
while true; do
|
||||||
# Exécuter la commande curl pour obtenir les données JSON
|
|
||||||
json_data=$(curl -s "https://www.radiofrance.fr/fip/api/webradios?station=fip")
|
json_data=$(curl -s "https://www.radiofrance.fr/fip/api/webradios?station=fip")
|
||||||
|
|
||||||
# Calculer le hachage MD5 des données JSON actuelles
|
|
||||||
new_md5=$(echo -n "$json_data" | md5sum | awk '{print $1}')
|
new_md5=$(echo -n "$json_data" | md5sum | awk '{print $1}')
|
||||||
|
|
||||||
# Vérifier si le hachage MD5 a changé (c'est-à-dire si les données ont changé)
|
|
||||||
if [ "$new_md5" != "$md5" ]; then
|
if [ "$new_md5" != "$md5" ]; then
|
||||||
# Afficher les données en utilisant la fonction print_data
|
|
||||||
print_data "$json_data"
|
print_data "$json_data"
|
||||||
md5="$new_md5"
|
md5="$new_md5"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Attendre 5 secondes avant la prochaine requête curl
|
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
Reference in New Issue
Block a user