1 |
james |
3 |
#!/usr/bin/perl |
2 |
|
|
|
3 |
|
|
$datetime = `date -u '+%Y%m%d/%H%M'`; |
4 |
|
|
chomp $datetime; |
5 |
|
|
|
6 |
|
|
$/ = ''; |
7 |
|
|
$sep = '\\\\'; |
8 |
|
|
|
9 |
|
|
while ($server = <>) { |
10 |
|
|
chomp $server; |
11 |
|
|
@data = split /\n/, $server; |
12 |
|
|
($type, $ip, $name, $map, $maxplayers, $players, $ping, $tries) |
13 |
|
|
= split /$sep/, $data[0]; |
14 |
|
|
next if $type ne 'T2S'; |
15 |
|
|
next if $name eq 'TIMEOUT' or $name eq 'DOWN'; |
16 |
|
|
next if $map eq '?'; |
17 |
|
|
%detail = ('bot_count' => 0, 'game' => '?', 'mission' => '?'); |
18 |
|
|
foreach $detail (split /$sep/, $data[1]) { |
19 |
|
|
($key, $value) = split /=/, $detail, 2; |
20 |
|
|
$detail{$key} = $value; |
21 |
|
|
} |
22 |
|
|
$players -= $detail{'bot_count'}; |
23 |
|
|
|
24 |
|
|
print "$datetime\t$detail{'game'}\t$detail{'mission'}\t$map\t$maxplayers\t$players\n"; |
25 |
|
|
} |
26 |
|
|
|