forked from lra/shoutstats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.php
43 lines (39 loc) · 1.17 KB
/
update.php
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
<?php
require('sslib.php');
$servers = GetServerList();
if(!file_exists(SS_PATH_RRD))
{
mkdir(SS_PATH_RRD,0777);
}
foreach ($servers as $n => $s)
{
if($s["type"]=="shoutcast")
{
if(!empty($s["sid"]))
{
$audience[i]=GetShoutcast2Stats($s["host"],$s["port"],$s["sid"]);
$rddfile = SS_PATH_RRD."/{$s["host"]}.".$s["port"].".{$s["sid"]}.rrd";
}
$audience[$i]=GetShoutcastStats($s["host"],$s["port"]);
$rddfile = SS_PATH_RRD."/{$s["host"]}.".$s["port"].".rrd";
}
else
{
$audience[$i]=GetIcecastStats($s["host"],$s["port"],$s["mpoint"]);
$rddfile = SS_PATH_RRD."/{$s["host"]}.".$s["port"].".{$s["mpoint"]}.rrd";
}
if(!file_exists($rddfile))
{
system(SS_RRDTOOL_COMMAND.
' create '.$rddfile.' '.
'DS:audience:GAUGE:600:U:U '.
'RRA:AVERAGE:0.5:1:288 '.
'RRA:AVERAGE:0.5:6:336 '.
'RRA:AVERAGE:0.5:24:420 '.
'RRA:AVERAGE:0.5:288:365');
}
system(SS_RRDTOOL_COMMAND.
' update '.$rddfile.' '.
'-t audience '.
'N:'.$audience[$i]['current']);
}