summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2010-08-24 12:12:24 +0000
committerPetter Reinholdtsen <pere@hungry.com>2010-08-24 12:12:24 +0000
commite7ca1a4415d0783a3fd42b625bb7e7aecd4fc7ee (patch)
tree37a4bf4eb44b18087e791453449bc20e21ea7700
parent5911b339e7240159bbc36bceccdbbb428f5c2372 (diff)
Inn med tonostatistikk pr. organisasjon.
-rwxr-xr-xfrikanalen/bin/frikanalen-tonostats18
1 files changed, 17 insertions, 1 deletions
diff --git a/frikanalen/bin/frikanalen-tonostats b/frikanalen/bin/frikanalen-tonostats
index 6a5e999..6c5c7b8 100755
--- a/frikanalen/bin/frikanalen-tonostats
+++ b/frikanalen/bin/frikanalen-tonostats
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use vars qw(%opts);
+use vars qw(%opts %orgs);
use Getopt::Std;
@@ -38,8 +38,10 @@ sub get_tono_stats {
foreach my $video (@{$res->{'Data'}->{'Video'}}) {
if ("true" eq $video->{'HasTonoRecords'}) {
$tono++;
+ $orgs{$video->{'Organization'}}{tono}++;
} else {
$notono++;
+ $orgs{$video->{'Organization'}}{notono}++;
}
}
return ($tono, $notono);
@@ -48,6 +50,20 @@ sub print_tono_stats {
my ($with, $without) = get_tono_stats();
printf("Innslag med tono-musikk: %d (%.1f%%)\n", $with, 100 * $with / ($with+$without));
printf("Innslag uten tonon-musikk: %d (%.1f%%)\n",$without, 100 *$without/($with+$without));
+
+ for my $org (sort tonoorder keys %orgs) {
+ my $tono = $orgs{$org}{tono} || 0;
+ my $notono = $orgs{$org}{notono} || 0;
+ print "$tono\t$notono\t$org\n";
+ }
+}
+
+sub tonoorder {
+ my $order = ($orgs{$b}{tono} || 0) <=> ($orgs{$a}{tono} || 0);
+ if (0 == $order) {
+ $order = ($orgs{$b}{notono} || 0) <=> ($orgs{$a}{notono} || 0);
+ }
+ return $order;
}
sub munin_plugin {
my @ARGV = @_;