/[james]/t2stats/t2stats
ViewVC logotype

Diff of /t2stats/t2stats

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3 by james, Mon Jan 27 22:18:18 2003 UTC revision 30 by james, Sun Apr 13 10:57:37 2003 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -W  #!/usr/bin/perl -W
2    
3  $ploticus_chron = 'ploticus png -prefab chron data=- x=1 y=2 xgrid=color=0.8 ygrid=color=0.8 datefmt=yyyymmdd mode=line gapmissing=yes yrange=0 -font Arial -diagfile /dev/null';  $ploticus_chron = 'ploticus png -prefab chron data=- x=1 y=2 xgrid=color=0.3 ygrid=color=0.3 datefmt=yyyymmdd mode=line gapmissing=yes yrange=0 -font Arial -diagfile /dev/null -backcolor black -color brightgreen';
4  $bar_width = 600;  $bar_width = 600;
5    
6  ################################################################################  ################################################################################
# Line 105  while ($line = <>) { Line 105  while ($line = <>) {
105    
106  ################################################################################  ################################################################################
107    
108    undef $/;
109    open HEADER, '< header' or die "Failed to open header: $!";
110    $header = <HEADER>;
111    
112    $menu = <<END;
113    <p class='menu'><a href='/t2stats/'>Home</a> |
114    <a href='graphs'>Graphs</a> |
115    <a href='games'>Game types</a> |
116    <a href='maps'>Map popularity</a></p>
117    END
118    
119  $now = gmtime;  $now = gmtime;
120    
121  open INDEX, '>', '../index.html';  open INDEX, '>', 'index';
122    open GRAPHS, '>', 'graphs';
123    open GAMES, '>', 'games';
124    open MAPS, '>', 'maps';
125    
126    print INDEX $header;
127    print GRAPHS $header;
128    print GAMES $header;
129    print MAPS $header;
130    
131  print INDEX <<END;  print INDEX <<END;
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
 <html xmlns="http://www.w3.org/1999/xhtml">  
 <head>  
 <title>Tribes 2 Europe Statistics</title>  
 <style type='text/css'>  
 body { background-color: white; margin: 3em; font-family: sans-serif; }  
 p { text-align: center; }  
 address { text-align: right; }  
 h1, h2 { background-color: #ccffcc; padding: 0.5em; }  
 p.bar0, p.bar1 { text-align: left; margin-top: 0; margin-bottom: 0; font-size: 75%; }  
 p.bar1 { background-color: #eee; }  
 </style>  
 </head>  
   
 <body>  
132  <h1>Tribes 2 Europe Statistics</h1>  <h1>Tribes 2 Europe Statistics</h1>
133  <p>This page updated every hour, last update $now UTC. All times in UTC.  $menu
134    <p>Updated every hour, last update $now UTC. All times in UTC.
135  Data collected every 10 minutes by <a href='http://www.qstat.org/'>QStat</a>,  Data collected every 10 minutes by <a href='http://www.qstat.org/'>QStat</a>,
136  processed by a <a href='scripts/'>script</a>, and graphs plotted  processed by a <a href='http://cvs.strcprstskrzkrk.co.uk/t2stats/'>script</a>,
137  with <a href='http://ploticus.sourceforge.net/'>ploticus</a>.</p>  and graphs plotted with <a href='http://ploticus.sourceforge.net/'>ploticus</a>.
138  <address>- <a href='mailto:t2stats\@strcprstskrzkrk.co.uk'>James Bursa</a></address>  Created by <a href='http://www.strcprstskrzkrk.co.uk/'>James Bursa</a>.</p>
139    
140  END  END
141    
142  ################################################################################  ################################################################################
143    
144  open PLOTA1, "|$ploticus_chron xinc='14 days' stubfmt='Mmmdd' -o ../images/players_full.png";  open PLOTA1, "|$ploticus_chron xinc='30 days' stubfmt='Mmmdd' -o images/players_full.png";
145  open PLOTA2, "|$ploticus_chron xinc='14 days' stubfmt='Mmmdd' -o ../images/capacity_full.png";  open PLOTA2, "|$ploticus_chron xinc='30 days' stubfmt='Mmmdd' -o images/capacity_full.png";
146  open PLOTA3, "|$ploticus_chron xinc='14 days' stubfmt='Mmmdd' -o ../images/usage_full.png";  open PLOTA3, "|$ploticus_chron xinc='30 days' stubfmt='Mmmdd' -o images/usage_full.png";
147    
148  foreach $date (sort keys %players_day) {  foreach $date (sort keys %players_day) {
149          $meanplayer = $players_day{$date} / (6.0 * 24.0);          $meanplayer = $players_day{$date} / (6.0 * 24.0);
# Line 152  foreach $date (sort keys %players_day) { Line 156  foreach $date (sort keys %players_day) {
156    
157  close PLOTA1; close PLOTA2; close PLOTA3;  close PLOTA1; close PLOTA2; close PLOTA3;
158    
159  open PLOTB1, "|$ploticus_chron unittype=datetime xinc='1 day' stubfmt='Www' -o ../images/players_week.png";  open PLOTB1, "|$ploticus_chron unittype=datetime xinc='1 day' stubfmt='Www' -o images/players_week.png";
160  open PLOTB2, "|$ploticus_chron unittype=datetime xinc='1 day' stubfmt='Www' -o ../images/capacity_week.png";  open PLOTB2, "|$ploticus_chron unittype=datetime xinc='1 day' stubfmt='Www' -o images/capacity_week.png";
161  open PLOTB3, "|$ploticus_chron unittype=datetime xinc='1 day' stubfmt='Www' -o ../images/usage_week.png";  open PLOTB3, "|$ploticus_chron unittype=datetime xinc='1 day' stubfmt='Www' -o images/usage_week.png";
162    
163  foreach $date (sort keys %players_hour) {  foreach $date (sort keys %players_hour) {
164          $meanplayer = $players_hour{$date} / 6.0;          $meanplayer = $players_hour{$date} / 6.0;
# Line 167  foreach $date (sort keys %players_hour) Line 171  foreach $date (sort keys %players_hour)
171    
172  close PLOTB1; close PLOTB2; close PLOTB3;  close PLOTB1; close PLOTB2; close PLOTB3;
173    
174  open PLOTC1, "|$ploticus_chron unittype=datetime xinc='2 hours' stubfmt='hh' -o ../images/players_day.png";  open PLOTC1, "|$ploticus_chron unittype=datetime xinc='2 hours' stubfmt='hh' -o images/players_day.png";
175  open PLOTC2, "|$ploticus_chron unittype=datetime xinc='2 hours' stubfmt='hh' -o ../images/capacity_day.png";  open PLOTC2, "|$ploticus_chron unittype=datetime xinc='2 hours' stubfmt='hh' -o images/capacity_day.png";
176  open PLOTC3, "|$ploticus_chron unittype=datetime xinc='2 hours' stubfmt='hh' -o ../images/usage_day.png";  open PLOTC3, "|$ploticus_chron unittype=datetime xinc='2 hours' stubfmt='hh' -o images/usage_day.png";
177    
178  foreach $date (sort keys %players_10m) {  foreach $date (sort keys %players_10m) {
179          $meanplayer = $players_10m{$date};          $meanplayer = $players_10m{$date};
# Line 183  foreach $date (sort keys %players_10m) { Line 187  foreach $date (sort keys %players_10m) {
187  close PLOTC1; close PLOTC2; close PLOTC3;  close PLOTC1; close PLOTC2; close PLOTC3;
188    
189  print INDEX <<END;  print INDEX <<END;
190    <h2>Players online</h2>
191    <p>All available data, averaged over each day. <a href='graphs'>More graphs</a>.<br>
192    <img src='images/players_full.png' alt='Graph'></p>
193    END
194    
195    print GRAPHS <<END;
196    <h1>Tribes 2 Europe Statistics</h1>
197    $menu
198    <p>Graphs plotted with <a href='http://ploticus.sourceforge.net/'>ploticus</a>.</p>
199  <h2>Average players online</h2>  <h2>Average players online</h2>
200  <p>All available data, averaged over each day:<br />  <p>All available data, averaged over each day:<br>
201  <img src='images/players_full.png' alt='Graph' /></p>  <img src='images/players_full.png' alt='Graph'></p>
202  <p>Last 7 days, averaged over each hour:<br />  <p>Last 7 days, averaged over each hour:<br>
203  <img src='images/players_week.png' alt='Graph' /></p>  <img src='images/players_week.png' alt='Graph'></p>
204  <p>Last 24 hours, sampled every 10 minutes:<br />  <p>Last 24 hours, sampled every 10 minutes:<br>
205  <img src='images/players_day.png' alt='Graph' /></p>  <img src='images/players_day.png' alt='Graph'></p>
206    
207  <h2>Average server places available</h2>  <h2>Average server places available</h2>
208  <p><img src='images/capacity_full.png' alt='Graph' /></p>  <p><img src='images/capacity_full.png' alt='Graph'></p>
209  <p><img src='images/capacity_week.png' alt='Graph' /></p>  <p><img src='images/capacity_week.png' alt='Graph'></p>
210  <p><img src='images/capacity_day.png' alt='Graph' /></p>  <p><img src='images/capacity_day.png' alt='Graph'></p>
211    
212  <h2>Percentage server places used</h2>  <h2>Percentage server places used</h2>
213  <p><img src='images/usage_full.png' alt='Graph' /></p>  <p><img src='images/usage_full.png' alt='Graph'></p>
214  <p><img src='images/usage_week.png' alt='Graph' /></p>  <p><img src='images/usage_week.png' alt='Graph'></p>
215  <p><img src='images/usage_day.png' alt='Graph' /></p>  <p><img src='images/usage_day.png' alt='Graph'></p>
216    
217  END  END
218    
# Line 207  END Line 220  END
220    
221  $game_types = keys %game;  $game_types = keys %game;
222    
223  print INDEX <<END;  $key = <<END;
 <h2>Game type popularity</h2>  
224  <p><img src='images/bar.png' width='10' height='10' alt='First value' />&nbsp;all available data,  <p><img src='images/bar.png' width='10' height='10' alt='First value' />&nbsp;all available data,
225  <img src='images/bar7.png' width='10' height='10' alt='second value' />&nbsp;last 7 days.  <img src='images/bar7.png' width='10' height='10' alt='second value' />&nbsp;last 7 days.
226  $game_types game types.</p>  $game_types game types.
227  END  END
228    
229    print INDEX '<h2>Top 10 game types</h2>', $key, "<a href='games'>Full game type table</a>.</p>";
230    print GAMES '<h1>Game type popularity</h1>', $menu, $key, "</p>";
231    
232  $i = 0;  $i = 0;
233  foreach $gm (sort { $game{$b} <=> $game{$a} } keys %game) {  foreach $gm (sort { $game{$b} <=> $game{$a} } keys %game) {
234          $players = $game{$gm};          $players = $game{$gm};
# Line 226  foreach $gm (sort { $game{$b} <=> $game{ Line 241  foreach $gm (sort { $game{$b} <=> $game{
241          $pct = sprintf "%.3g", $propn * 100;          $pct = sprintf "%.3g", $propn * 100;
242          $pct7 = sprintf "%.3g", $propn7 * 100;          $pct7 = sprintf "%.3g", $propn7 * 100;
243          $class = $i % 2;          $class = $i % 2;
244          print INDEX <<END;          $line = <<END;
245          <p class='bar$class'>$gm<br />  <p class='bar$class'>$gm<br><img src='images/bar.png' width='$width' height='10' alt=''> $pct%<br>
246          <img src='images/bar.png' width='$width' height='10' alt='' /> $pct%<br />  <img src='images/bar7.png' width='$width7' height='10' alt=''> $pct7%</p>
         <img src='images/bar7.png' width='$width7' height='10' alt='' /> $pct7%</p>  
247  END  END
248            print INDEX $line if $i < 10;
249            print GAMES $line;
250          $i++;          $i++;
251  }  }
252    
# Line 238  END Line 254  END
254    
255  $maps = keys %map;  $maps = keys %map;
256    
257  print INDEX <<END;  $key = <<END;
 <h2>Map popularity</h2>  
258  <p><img src='images/bar.png' width='10' height='10' alt='First value' />&nbsp;all available data,  <p><img src='images/bar.png' width='10' height='10' alt='First value' />&nbsp;all available data,
259  <img src='images/bar7.png' width='10' height='10' alt='second value' />&nbsp;last 7 days.  <img src='images/bar7.png' width='10' height='10' alt='second value' />&nbsp;last 7 days.
260  $maps maps.  $maps maps.
261  Follow the link to search for a map on <a href='http://www.tribes2maps.com/'>Tribes2Maps</a>.</p>  Follow the link to search for a map on <a href='http://www.tribes2maps.com/'>Tribes2Maps</a>.
262  END  END
263    
264    print INDEX '<h2>Top 10 maps</h2>', $key, "<a href='maps'>Full map popularity table</a>.</p>";
265    print MAPS '<h1>Map popularity</h1>', $menu, $key, "</p>";
266    
267  $i = 0;  $i = 0;
268  foreach $gmm (sort { $map{$b} <=> $map{$a} } keys %map) {  foreach $gmm (sort { $map{$b} <=> $map{$a} } keys %map) {
269          $players = $map{$gmm};          $players = $map{$gmm};
# Line 261  foreach $gmm (sort { $map{$b} <=> $map{$ Line 279  foreach $gmm (sort { $map{$b} <=> $map{$
279          $search = $gmm;          $search = $gmm;
280          $search =~ s/([^\w()'*~!.-])/sprintf '%%%02x', ord $1/eg;          $search =~ s/([^\w()'*~!.-])/sprintf '%%%02x', ord $1/eg;
281          $search =~ s/^Euro2_//;          $search =~ s/^Euro2_//;
282          print INDEX <<END;          $line = <<END;
283          <p class='bar$class'><a href="http://www.tribes2maps.com/cgi-bin/map_search.cgi?names_only=1;search=$search">$gmm</a><br />  <p class='bar$class'><a href="http://www.tribes2maps.com/cgi-bin/map_search.cgi?names_only=1;search=$search">$gmm</a><br>
284          <img src='images/bar.png' width='$width' height='10' alt='' /> $pct%<br />  <img src='images/bar.png' width='$width' height='10' alt=''> $pct%<br>
285          <img src='images/bar7.png' width='$width7' height='10' alt='' /> $pct7%</p>  <img src='images/bar7.png' width='$width7' height='10' alt=''> $pct7%</p>
286  END  END
287            print INDEX $line if $i < 10;
288            print MAPS $line;
289          $i++;          $i++;
290  }  }
291    
292  ################################################################################  ################################################################################
293    
294  print INDEX <<END;  $footer = <<END;
295    <p class='footer'><a href='/'>Omroth</a> &#187; Tribes 2 Europe Statistics</p>
296  </body>  </body>
297  </html>  </html>
298  END  END
299    
300    print INDEX $footer;
301    print GRAPHS $footer;
302    print GAMES $footer;
303    print MAPS $footer;
304    
305  close INDEX;  close INDEX;
306    close GRAPHS;
307    close GAMES;
308    close MAPS;
309    
310    system 'gzip --best -c index > index.gz';
311    system 'gzip --best -c graphs > graphs.gz';
312    system 'gzip --best -c games > games.gz';
313    system 'gzip --best -c maps > maps.gz';
314    
315  ################################################################################  ################################################################################
316    

Legend:
Removed from v.3  
changed lines
  Added in v.30

  ViewVC Help
Powered by ViewVC 1.1.26