fix se il link è guasto

This commit is contained in:
2025-01-24 01:45:41 +01:00
parent e06452dce9
commit d58194f376
2 changed files with 10 additions and 16 deletions

View File

@@ -8,16 +8,13 @@ PWD_SC="$PWD"
attuale="$(cat "$PWD_SC/attuale.txt")"
nuovo=$(curl --no-progress-meter -L $attuale | sed -n 's/.*\(https:\/\/cdn\.streamingcommunity\.[^ ]*images[^ ]*\).*/\1/p' | grep -oP 'streamingcommunity\.\w+(\.\w+)?')
# Se il nuovo link è vuoto, ci sono casini in corso, lascia il vecchio link ed esce
if [ -z "$nuovo" ]; then
echo "STANNO FACENDO CASINI. LASCIATO IL VECCHIO LINK"
exit 1
fi
# Altrimenti aggiorna il file "attuale.txt"
if [ "$attuale" != "$nuovo" ]; then
# Se il nuovo link non è vuoto e diverso dal nuovo, allora aggiorna attuale.txt
if [ "$attuale" != "$nuovo" ] && [ -n "$nuovo" ]; then
attuale="$nuovo"
echo "$attuale" > $PWD_SC/attuale.txt
else
# ALTRIMENTI LASCIA IL VECCHIO
echo "STANNO FACENDO CASINI O LINK CORROTTO. LASCIATO IL VECCHIO LINK"
fi
# Formatta il link e lo stampa