diff --git a/README.md b/README.md index 731162f..d1e9d75 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ #### 1. Genera una pagina html con il link aggiornato di streamingcommunity (richiede "attuale.txt"): ``` -# Setta la variabile "PWD_SC" in testa allo script o lasciala con "PWD" per provarla in locale +# Setta la variabile "PWD_SC" in testa allo script o lasciala con "PWD" per provare in locale nano make_index.sh # Avvia lo script manualmente ./make_index.sh -# o mettilo in cron +# oppure mettilo in cron 0 0 * * * /path/to/make_index.sh ``` ##### 1.1 Se vuoi pubblicarla sul web, mettila dietro un reverseproxy e dai i permessi alla cartella contenente lo script: @@ -16,20 +16,22 @@ nano make_index.sh sudo chown -R www-data:www-data ; sudo chmod -R 755 ``` + +#### 2. Crea un feed rss con il link (richiede "attuale.txt"): +``` +# Setta la variabile "PWD_SC" in testa allo script o lasciala con "PWD" per provare in locale +nano rss_generator.sh + +# Avvia lo manualmente +./rss_generator.sh + +# oppure mettilo in cron +0 0 * * * /path/to/rss_generator.sh +```
-#### 2. Se vuoi semplicemente sapere qual'è il link giusto aggiornato esegui "show_link.sh" (richiede "attuale.txt"): +#### 3. Se vuoi semplicemente sapere qual'è il link giusto aggiornato esegui "show_link.sh" (richiede "attuale.txt"): ``` ./show_link.sh ``` -
- -#### 3. Crea un feed rss (richiede "attuale.txt"): -``` -# Avvialo manualmente -./rss_generator.sh - -# o mettilo in cron -0 0 * * * /path/to/rss_generator.sh -``` \ No newline at end of file diff --git a/history.md b/history.md deleted file mode 100644 index ad025a1..0000000 --- a/history.md +++ /dev/null @@ -1,5 +0,0 @@ -### xx-xx-2024 -prof - -### 11-01-2025 -ooo \ No newline at end of file diff --git a/make_index.sh b/make_index.sh index c2d5f4d..26562d8 100755 --- a/make_index.sh +++ b/make_index.sh @@ -1,9 +1,10 @@ #!/bin/bash # SETTARE QUESTA VARIABILE CON IL PERCORSO GIUSTO: +# Es: PWD_SC="/var/www/html/streamingcommunity" PWD_SC="$PWD" -# Se il link è stato aggiornato, aggiorna il file "attuale.txt" +# Se il link è cambiato, allora aggiorna il file "attuale.txt" 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+)?') if [ "$attuale" != "$nuovo" ]; then @@ -13,7 +14,7 @@ fi # Formatta il link e lo stampa formatted="https://$(cat "$PWD_SC/attuale.txt")" -echo "$formatted" #per debug +echo "$formatted" # Crea pagina "index.html" cat <<- _EOF > $PWD_SC/index.html diff --git a/rss_gerator.sh b/rss_gerator.sh index 8c5a5a1..5daf2f3 100755 --- a/rss_gerator.sh +++ b/rss_gerator.sh @@ -1,15 +1,16 @@ #!/bin/bash # SETTARE QUESTA VARIABILE CON IL PERCORSO GIUSTO: +# Es: PWD_SC="/var/www/html/streamingcommunity" PWD_SC="$PWD" # Formatta il link e lo stampa formatted="https://$(cat "$PWD_SC/attuale.txt")" -echo "$formatted" #per debug +echo "$formatted" data=$(date +%Y-%m-%d) -# Crea pagina "index.html" +# Crea pagina "rss.xml" cat <<- _EOF > $PWD_SC/rss.xml @@ -31,4 +32,4 @@ cat <<- _EOF > $PWD_SC/rss.xml _EOF # Da i permessi alla cartella -#sudo chown -R www-data:www-data $PWD_SC ; sudo chmod -R 755 $PWD_SC \ No newline at end of file +sudo chown -R www-data:www-data $PWD_SC ; sudo chmod -R 755 $PWD_SC \ No newline at end of file diff --git a/show_link.sh b/show_link.sh index c0e2ec5..4700f10 100755 --- a/show_link.sh +++ b/show_link.sh @@ -3,7 +3,7 @@ # SETTARE QUESTA VARIABILE SE LO SCRIPT NON VIENE USATO IN LOCALE: PWD_SC="$PWD" -# Se il link è stato aggiornato, aggiorna il file "attuale.txt" +# Se il link è cambiato, allora aggiorna il file "attuale.txt" attuale=$(<$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+)?') if [ "$attuale" != "$nuovo" ]; then