diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2010-02-07 16:13:28 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2010-02-07 16:13:28 +0000 |
commit | bd320bcf66dfdca763627430d5213374e32727b0 (patch) | |
tree | 7d018cef1a73d10b9ef18dae26c9f9a0e09c2e0a | |
parent | 852be563e41b1e2c25920501098ccc353714fcbb (diff) |
Nytt script som teller tono-flagget.
-rwxr-xr-x | frikanalen/bin/tonostats | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/frikanalen/bin/tonostats b/frikanalen/bin/tonostats new file mode 100755 index 0000000..6ca57bc --- /dev/null +++ b/frikanalen/bin/tonostats @@ -0,0 +1,50 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +# SOAP:Lite må modifiseres til å gjøre ting på MS måten :-/ +use SOAP::Lite on_action => sub {sprintf '%s/%s', @_}, ; + +sub print_tono_stats { + my $id = shift; + + my $soap = new SOAP::Lite + -> uri('http://localhost/CommunitySiteService') + -> proxy('http://communitysite1.frikanalen.tv/CommunitySiteFacade/CommunitySiteService.asmx'); + + my $obj = $soap->SearchVideos( + SOAP::Data->name('searcher' => { + 'PredefinedSearchType' => 'Default', + 'Take' => 10000, + } + ) + ); + if ($obj->fault) { + print join ', ', + $obj->faultcode, + $obj->faultstring; + return; + } + + my $res = $obj->result; +# print Dumper($res); + unless ($res->{'Data'}) { + return; + } + my $tono; + my $notono; + foreach my $video (@{$res->{'Data'}->{'Video'}}) { + if ("true" eq $video->{'HasTonoRecords'}) { + $tono++; + } else { + $notono++; + } + } + print("Innslag med tono-musikk: $tono (", + int( 100 * $tono / ($tono+$notono)),"%)\n"); + print("Innslag uten tonon-musikk: $notono (", + int( 100 * $notono / ($tono+$notono)),"%)\n"); +} + +print_tono_stats(); |