3 # Copyright (c) 2002 Ivan Kohler
5 # This program is free software; you can redistribute it and/or modify it under
6 # the same terms as Perl itself.
11 use vars qw($host $port $admin_password $template $outdir);
15 require "/etc/icesnap.conf";
17 unless ( -e $outdir) {
18 mkdir($outdir, 0755) or die "can't mkdir $outdir: $!";
21 my $c = Net::Icecast->new($host, $port, $admin_password)
22 or die "can't connect";
24 my %hash = $c->listeners;
27 use vars qw( %mount );
30 foreach my $mount (qw( / /24 ) ) {
34 foreach my $listener ( keys %hash ) {
35 # print "$listener => \n";
36 my %lhash = %{$hash{$listener}};
37 foreach my $key ( keys %lhash ) {
38 # print " $key => $lhash{$key}\n";
41 $mount{$lhash{mountpoint}}{$lhash{user_agent}}++;
47 foreach $mount ( keys %mount ) {
50 # print "$mount => \n";
51 # foreach my $user_agent ( keys %{$mount{$mount}} ) {
52 # $total += $mount{$mount}{$user_agent};
53 # print " $user_agent => $mount{$mount}{$user_agent}\n";
55 # print " TOTAL $total\n\n";
60 # my %mount = %{shift()};
63 open(STDOUT,">$outdir/$mount.html") or die "can't open $outdir/$mount.html: $!";
65 #nicked from cgi/asp in the Apache::ASP disribution
67 my $r = &Apache::ASP::CGI::init($template);
69 $r->dir_config('NoHeaders', 1);
71 &Apache::ASP::handler($r);