2024-08-30 10:36:22 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2025-01-13 18:50:02 +01:00
|
|
|
# SETTARE QUESTA VARIABILE CON IL PERCORSO GIUSTO:
|
2025-01-19 00:58:54 +01:00
|
|
|
# Es: PWD_SC="/var/www/html/streamingcommunity"
|
2025-01-13 20:03:55 +01:00
|
|
|
PWD_SC="$PWD"
|
2025-01-11 16:01:17 +01:00
|
|
|
|
2025-01-24 01:31:20 +01:00
|
|
|
# Segue link per vedere se è stato aggiornato...
|
2025-01-13 18:50:02 +01:00
|
|
|
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+)?')
|
2025-01-24 01:31:20 +01:00
|
|
|
|
2025-01-24 18:29:36 +01:00
|
|
|
# Se il nuovo link è diverso dal nuovo, allora...
|
|
|
|
|
if [ "$attuale" != "$nuovo" ]; then
|
|
|
|
|
# se è vuoto lascia il vecchio
|
|
|
|
|
if [ -z "$nuovo" ]; then
|
|
|
|
|
echo "STANNO FACENDO CASINI O LINK CORROTTO. LASCIATO IL VECCHIO LINK"
|
|
|
|
|
else
|
|
|
|
|
# Se non è vuoto lo aggiorna con il nuovo link il file attuale.txt
|
2025-01-11 16:01:17 +01:00
|
|
|
attuale="$nuovo"
|
2025-01-13 18:32:09 +01:00
|
|
|
echo "$attuale" > $PWD_SC/attuale.txt
|
2025-01-24 18:29:36 +01:00
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
# se il link giusto è ancora il vecchio lascia il vecchio
|
|
|
|
|
echo "Il link giusto è ancora il vecchio"
|
2025-01-11 16:01:17 +01:00
|
|
|
fi
|
2025-01-13 18:50:02 +01:00
|
|
|
|
2025-01-24 18:29:36 +01:00
|
|
|
|
2025-01-13 18:50:02 +01:00
|
|
|
# Formatta il link e lo stampa
|
2025-01-13 18:32:09 +01:00
|
|
|
formatted="https://$(cat "$PWD_SC/attuale.txt")"
|
2025-01-19 00:58:54 +01:00
|
|
|
echo "$formatted"
|
2025-01-13 18:50:02 +01:00
|
|
|
|
|
|
|
|
# Crea pagina "index.html"
|
2025-01-13 18:32:09 +01:00
|
|
|
cat <<- _EOF > $PWD_SC/index.html
|
2024-08-30 10:36:22 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
|
2025-01-13 18:32:09 +01:00
|
|
|
|
2024-08-30 10:36:22 +02:00
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
<title>StreamingCommunity Link Giusto</title>
|
|
|
|
|
<style>
|
|
|
|
|
body {
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
margin: 0;
|
|
|
|
|
padding: 4wh;
|
|
|
|
|
border: 10px solid #ccc;
|
2025-01-14 00:39:21 +01:00
|
|
|
background-color: #f4f4f4;
|
2024-08-30 10:36:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
div {
|
|
|
|
|
width: 200wj;
|
|
|
|
|
height: 200wj;
|
2025-01-14 00:39:21 +01:00
|
|
|
background-color: #fbfbfb;
|
2024-08-30 10:36:22 +02:00
|
|
|
padding: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
img {
|
|
|
|
|
max-width: 90%;
|
|
|
|
|
padding: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
a {
|
|
|
|
|
width: 300wj;
|
|
|
|
|
height: 200wj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
h1 {
|
|
|
|
|
font-size: 36px;
|
|
|
|
|
/* Default size */
|
|
|
|
|
}
|
2025-01-24 19:46:06 +01:00
|
|
|
|
2024-08-30 10:36:22 +02:00
|
|
|
@media (max-width: 480px) {
|
|
|
|
|
h1 {
|
2024-08-30 14:19:39 +02:00
|
|
|
font-size: 17px;
|
2024-08-30 10:36:22 +02:00
|
|
|
/* Size mobile phones */
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-01-24 19:46:06 +01:00
|
|
|
|
2024-08-30 10:36:22 +02:00
|
|
|
@media (max-width: 480px) {
|
|
|
|
|
h3 {
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
/* Size mobile phones */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<center>
|
|
|
|
|
<br><br>
|
|
|
|
|
|
|
|
|
|
<div class="link">
|
2025-01-13 18:50:02 +01:00
|
|
|
<h3> Link aggiornato per Streaming Community: </h3>
|
|
|
|
|
<h1> <a href=$formatted>$formatted </a> </h1>
|
|
|
|
|
<h3> (cambia circa una volta al mese) </h3>
|
2025-01-24 20:05:41 +01:00
|
|
|
<h5> link2stats of $attuale: <a href=./stats1.html>stats1</a> e <a href=./stats2.html>stats2 </a> </h5>
|
2024-08-30 10:36:22 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<br><br>
|
|
|
|
|
|
2024-11-03 00:08:20 +01:00
|
|
|
<a href=$formatted target="_blank">
|
2024-08-30 10:36:22 +02:00
|
|
|
<img style="display:block; margin-left: auto; margin-right: auto" src="./splash.gif">
|
2024-11-03 00:02:09 +01:00
|
|
|
</a>
|
2024-08-30 10:36:22 +02:00
|
|
|
|
|
|
|
|
<br><br>
|
|
|
|
|
|
|
|
|
|
<div class="link">
|
2025-01-13 18:50:02 +01:00
|
|
|
<h3> Link aggiornato per Streaming Community: </h3>
|
2025-01-13 17:53:14 +01:00
|
|
|
<h1> <a href=$formatted> $formatted </a> </h1>
|
2025-01-13 18:50:02 +01:00
|
|
|
<h3> (cambia circa una volta al mese) </h3>
|
2025-01-24 20:05:41 +01:00
|
|
|
<h5> link2stats of $attuale: <a href=./stats1.html>stats1</a> e <a href=./stats2.html>stats2 </a> </h5>
|
2024-08-30 10:36:22 +02:00
|
|
|
</div>
|
|
|
|
|
|
2024-11-03 00:02:09 +01:00
|
|
|
<br><br>
|
2024-08-30 10:36:22 +02:00
|
|
|
</center>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|
_EOF
|
|
|
|
|
|
2025-01-24 19:46:06 +01:00
|
|
|
# Genera le stats scrapate da streaming community sui client più altre cose da capire
|
|
|
|
|
./make_stats.sh
|
|
|
|
|
|
2025-01-19 01:02:10 +01:00
|
|
|
# Da i permessi alla cartella (decommentare se hostato)
|
2025-01-24 21:35:14 +01:00
|
|
|
#chown -R root:root $PWD_SC; echo "cartella di root"
|
|
|
|
|
#chmod +x $PWD_SC ; echo "permetto di leggere dentro a $PWD_SC"
|
|
|
|
|
#chmod 740 $PWD_SC/*; echo "reset permessi per tutti i file"
|
|
|
|
|
#chown -R www-data:www-data $PWD_SC/*.html; chmod -R 744 $PWD_SC/*.html; echo "do i permessi agli html"
|
|
|
|
|
#chown -R www-data:www-data $PWD_SC/*.json; chmod -R 744 $PWD_SC/*.json; echo "do i permessi ai json"
|
|
|
|
|
#chown -R www-data:www-data $PWD_SC/*.xml; chmod -R 744 $PWD_SC/*.xml; echo "do i permessi agli xml"
|
|
|
|
|
#chown root:root ./*.sh; chmod 740 ./*.sh; echo "do i permesi agli sh"
|