|
@@ -47,7 +47,7 @@ sub info{
|
|
$json = <$fh>;
|
|
$json = <$fh>;
|
|
close $fh;
|
|
close $fh;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
my $data = decode_json($json);
|
|
my $data = decode_json($json);
|
|
# pour chaque valeur on vérifie que ce n'est pas nul, si c'est le cas on
|
|
# pour chaque valeur on vérifie que ce n'est pas nul, si c'est le cas on
|
|
# indique N/A (not available)
|
|
# indique N/A (not available)
|
|
@@ -64,7 +64,7 @@ sub info{
|
|
else {
|
|
else {
|
|
$nb_abo = $data->{"ispformat"}->{"subscriberCount"};
|
|
$nb_abo = $data->{"ispformat"}->{"subscriberCount"};
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (!length $data->{"ispformat"}->{"website"}) {
|
|
if (!length $data->{"ispformat"}->{"website"}) {
|
|
$site = "N/A";
|
|
$site = "N/A";
|
|
}
|
|
}
|
|
@@ -77,14 +77,14 @@ sub info{
|
|
else {
|
|
else {
|
|
$salon = $data->{"ispformat"}->{"chatrooms"}->[0];
|
|
$salon = $data->{"ispformat"}->{"chatrooms"}->[0];
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (!length $data->{"ispformat"}->{"progressStatus"}) {
|
|
if (!length $data->{"ispformat"}->{"progressStatus"}) {
|
|
$statut = "N/A";
|
|
$statut = "N/A";
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
$statut = $data->{"ispformat"}->{"progressStatus"};
|
|
$statut = $data->{"ispformat"}->{"progressStatus"};
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (!length $data->{"ispformat"}->{"creationDate"}) {
|
|
if (!length $data->{"ispformat"}->{"creationDate"}) {
|
|
$date_crea = "N/A";
|
|
$date_crea = "N/A";
|
|
}
|
|
}
|
|
@@ -111,7 +111,7 @@ sub info{
|
|
$description = $data->{"ispformat"}->{"description"};
|
|
$description = $data->{"ispformat"}->{"description"};
|
|
}
|
|
}
|
|
|
|
|
|
- my $filename = "/home/daga/bot-irc/wrk-dir/". $fai.".info";
|
|
|
|
|
|
+ my $filename = "/home/daga/bot-irc/wrk-dir/". $fai.".info";
|
|
|
|
|
|
# On indique dans le fichier la phrase que le bot va répondre
|
|
# On indique dans le fichier la phrase que le bot va répondre
|
|
|
|
|
|
@@ -131,7 +131,7 @@ sub adh{
|
|
$json = <$fh>;
|
|
$json = <$fh>;
|
|
close $fh;
|
|
close $fh;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
my $data = decode_json($json);
|
|
my $data = decode_json($json);
|
|
# pour chaque valeur on vérifie que ce n'est pas nul, si c'est le cas on
|
|
# pour chaque valeur on vérifie que ce n'est pas nul, si c'est le cas on
|
|
# indique N/A (not available)
|
|
# indique N/A (not available)
|
|
@@ -141,7 +141,7 @@ sub adh{
|
|
else {
|
|
else {
|
|
$nb_adh = $data->{"ispformat"}->{"memberCount"};
|
|
$nb_adh = $data->{"ispformat"}->{"memberCount"};
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (!length $data->{"ispformat"}->{"subscriberCount"}) {
|
|
if (!length $data->{"ispformat"}->{"subscriberCount"}) {
|
|
$nb_abo = "N/A";
|
|
$nb_abo = "N/A";
|
|
}
|
|
}
|
|
@@ -149,7 +149,7 @@ sub adh{
|
|
$nb_abo = $data->{"ispformat"}->{"subscriberCount"};
|
|
$nb_abo = $data->{"ispformat"}->{"subscriberCount"};
|
|
}
|
|
}
|
|
|
|
|
|
- my $filename = "/home/daga/bot-irc/wrk-dir/". $fai.".adh";
|
|
|
|
|
|
+ my $filename = "/home/daga/bot-irc/wrk-dir/". $fai.".adh";
|
|
my $fh2;
|
|
my $fh2;
|
|
open ($fh2, '>', $filename) or die "Impossible d'ouvrir le fichier $filename en écriture";
|
|
open ($fh2, '>', $filename) or die "Impossible d'ouvrir le fichier $filename en écriture";
|
|
print $fh2 $nb_adh ." adhérent·e·s (et ".$nb_abo." abonné·e·s).\n";
|
|
print $fh2 $nb_adh ." adhérent·e·s (et ".$nb_abo." abonné·e·s).\n";
|
|
@@ -157,11 +157,11 @@ sub adh{
|
|
}
|
|
}
|
|
# indique le nombre d'adh et d'abo dans l'ensemble des FAI ; fichier : ffdn.adh
|
|
# indique le nombre d'adh et d'abo dans l'ensemble des FAI ; fichier : ffdn.adh
|
|
sub adh_abo_ffdn {
|
|
sub adh_abo_ffdn {
|
|
-
|
|
|
|
|
|
+
|
|
my @filesdump = </home/daga/bot-irc/dump/*>;
|
|
my @filesdump = </home/daga/bot-irc/dump/*>;
|
|
my $filedump;
|
|
my $filedump;
|
|
|
|
|
|
- my $adh_ffdn = 0;
|
|
|
|
|
|
+ my $adh_ffdn = 0;
|
|
my $abo_ffdn = 0;
|
|
my $abo_ffdn = 0;
|
|
foreach $filedump (@filesdump) {
|
|
foreach $filedump (@filesdump) {
|
|
$filedump =~ s{/home/daga/bot-irc/dump/}{};
|
|
$filedump =~ s{/home/daga/bot-irc/dump/}{};
|
|
@@ -173,13 +173,13 @@ sub adh_abo_ffdn {
|
|
$json = <$fh>;
|
|
$json = <$fh>;
|
|
close $fh;
|
|
close $fh;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
my $data = decode_json($json);
|
|
my $data = decode_json($json);
|
|
-# si pas d'info, tant pis
|
|
|
|
|
|
+# si pas d'info, tant pis
|
|
unless (!length $data->{"ispformat"}->{"memberCount"}) {
|
|
unless (!length $data->{"ispformat"}->{"memberCount"}) {
|
|
$nb_adh = $data->{"ispformat"}->{"memberCount"};
|
|
$nb_adh = $data->{"ispformat"}->{"memberCount"};
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
unless (!length $data->{"ispformat"}->{"subscriberCount"}) {
|
|
unless (!length $data->{"ispformat"}->{"subscriberCount"}) {
|
|
$nb_abo = $data->{"ispformat"}->{"subscriberCount"};
|
|
$nb_abo = $data->{"ispformat"}->{"subscriberCount"};
|
|
}
|
|
}
|
|
@@ -188,17 +188,17 @@ sub adh_abo_ffdn {
|
|
# on incrémente pour chaque FAI
|
|
# on incrémente pour chaque FAI
|
|
$adh_ffdn += $nb_adh;
|
|
$adh_ffdn += $nb_adh;
|
|
$abo_ffdn += $nb_abo;
|
|
$abo_ffdn += $nb_abo;
|
|
- close $fh2;
|
|
|
|
|
|
+ close $fh2;
|
|
}
|
|
}
|
|
-
|
|
|
|
- my $filenameadh = "/home/daga/bot-irc/wrk-dir/ffdn.adh";
|
|
|
|
|
|
+
|
|
|
|
+ my $filenameadh = "/home/daga/bot-irc/wrk-dir/ffdn.adh";
|
|
|
|
|
|
my $fh3;
|
|
my $fh3;
|
|
# on met l'info dans le fichier
|
|
# on met l'info dans le fichier
|
|
open ($fh3, '>', $filenameadh) or die "Impossible d'ouvrir le fichier $filenameadh en écriture";
|
|
open ($fh3, '>', $filenameadh) or die "Impossible d'ouvrir le fichier $filenameadh en écriture";
|
|
print $fh3 "La fédé compte ".$adh_ffdn ." adhérent·e·s et ". $abo_ffdn ." abonné·e·s";
|
|
print $fh3 "La fédé compte ".$adh_ffdn ." adhérent·e·s et ". $abo_ffdn ." abonné·e·s";
|
|
close $fh3;
|
|
close $fh3;
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
# pour chaque FAI on génère l'info
|
|
# pour chaque FAI on génère l'info
|