blob: f5cbb1f7debb215d654e3ddf938f07b2b3843ea7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#!/usr/bin/perl -w
#
# Copyright (c) 2002 Ivan Kohler
# All rights reserved.
# This program is free software; you can redistribute it and/or modify it under
# the same terms as Perl itself.
#
# ivan-icelog@420.am
use strict;
use vars qw($host $port $admin_password $template $outdir);
use Net::Icecast;
use Apache::ASP;
require "/etc/icesnap.conf";
unless ( -e $outdir) {
mkdir($outdir, 0755) or die "can't mkdir $outdir: $!";
}
my $c = Net::Icecast->new($host, $port, $admin_password)
or die "can't connect";
my %hash = $c->listeners;
#my %mount;
use vars qw( %mount );
#produce blank pages
foreach my $mount (qw( / /24 ) ) {
$mount{$mount} = {};
}
foreach my $listener ( keys %hash ) {
# print "$listener => \n";
my %lhash = %{$hash{$listener}};
foreach my $key ( keys %lhash ) {
# print " $key => $lhash{$key}\n";
}
$mount{$lhash{mountpoint}}{$lhash{user_agent}}++;
}
#print "\n\n";
use vars qw($mount);
foreach $mount ( keys %mount ) {
my $total = 0;
&writepage();
# print "$mount => \n";
# foreach my $user_agent ( keys %{$mount{$mount}} ) {
# $total += $mount{$mount}{$user_agent};
# print " $user_agent => $mount{$mount}{$user_agent}\n";
# }
# print " TOTAL $total\n\n";
}
sub writepage {
#my $mount = shift;
# my %mount = %{shift()};
#my $mref = shift;
open(STDOUT,">$outdir/$mount.html") or die "can't open $outdir/$mount.html: $!";
#nicked from cgi/asp in the Apache::ASP disribution
my $r = &Apache::ASP::CGI::init($template);
$r->dir_config('NoHeaders', 1);
&Apache::ASP::handler($r);
close STDOUT;
}
|