fix per quando il link è mezzo rotto

This commit is contained in:
2025-01-24 01:31:20 +01:00
parent 2d5db7a07c
commit e06452dce9
2 changed files with 19 additions and 3 deletions

View File

@@ -4,9 +4,17 @@
# Es: PWD_SC="/var/www/html/streamingcommunity"
PWD_SC="$PWD"
# Se il link è cambiato, allora aggiorna il file "attuale.txt"
# Segue link per vedere se è stato aggiornato...
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
attuale="$nuovo"
echo "$attuale" > $PWD_SC/attuale.txt

View File

@@ -3,9 +3,17 @@
# SETTARE QUESTA VARIABILE SE LO SCRIPT NON VIENE USATO IN LOCALE:
PWD_SC="$PWD"
# Se il link è cambiato, allora aggiorna il file "attuale.txt"
attuale=$(<$PWD_SC/attuale.txt)
# Segue link per vedere se è stato aggiornato...
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
attuale="$nuovo"
echo "$attuale" > $PWD_SC/attuale.txt