/[james]/t2stats/t2stats
ViewVC logotype

Diff of /t2stats/t2stats

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

revision 28 by james, Mon Jan 27 22:18:18 2003 UTC revision 29 by james, Thu Apr 10 20:30:46 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>.</p>
 <address>- <a href='mailto:t2stats\@strcprstskrzkrk.co.uk'>James Bursa</a></address>  
138    
139  END  END
140    
141  ################################################################################  ################################################################################
142    
143  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";
144  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";
145  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";
146    
147  foreach $date (sort keys %players_day) {  foreach $date (sort keys %players_day) {
148          $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 155  foreach $date (sort keys %players_day) {
155    
156  close PLOTA1; close PLOTA2; close PLOTA3;  close PLOTA1; close PLOTA2; close PLOTA3;
157    
158  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";
159  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";
160  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";
161    
162  foreach $date (sort keys %players_hour) {  foreach $date (sort keys %players_hour) {
163          $meanplayer = $players_hour{$date} / 6.0;          $meanplayer = $players_hour{$date} / 6.0;
# Line 167  foreach $date (sort keys %players_hour) Line 170  foreach $date (sort keys %players_hour)
170    
171  close PLOTB1; close PLOTB2; close PLOTB3;  close PLOTB1; close PLOTB2; close PLOTB3;
172    
173  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";
174  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";
175  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";
176    
177  foreach $date (sort keys %players_10m) {  foreach $date (sort keys %players_10m) {
178          $meanplayer = $players_10m{$date};          $meanplayer = $players_10m{$date};
# Line 183  foreach $date (sort keys %players_10m) { Line 186  foreach $date (sort keys %players_10m) {
186  close PLOTC1; close PLOTC2; close PLOTC3;  close PLOTC1; close PLOTC2; close PLOTC3;
187    
188  print INDEX <<END;  print INDEX <<END;
189    <h2>Players online</h2>
190    <p>All available data, averaged over each day. <a href='graphs'>More graphs</a>.<br>
191    <img src='images/players_full.png' alt='Graph'></p>
192    END
193    
194    print GRAPHS <<END;
195    <h1>Tribes 2 Europe Statistics</h1>
196    $menu
197    <p>Graphs plotted with <a href='http://ploticus.sourceforge.net/'>ploticus</a>.</p>
198  <h2>Average players online</h2>  <h2>Average players online</h2>
199  <p>All available data, averaged over each day:<br />  <p>All available data, averaged over each day:<br>
200  <img src='images/players_full.png' alt='Graph' /></p>  <img src='images/players_full.png' alt='Graph'></p>
201  <p>Last 7 days, averaged over each hour:<br />  <p>Last 7 days, averaged over each hour:<br>
202  <img src='images/players_week.png' alt='Graph' /></p>  <img src='images/players_week.png' alt='Graph'></p>
203  <p>Last 24 hours, sampled every 10 minutes:<br />  <p>Last 24 hours, sampled every 10 minutes:<br>
204  <img src='images/players_day.png' alt='Graph' /></p>  <img src='images/players_day.png' alt='Graph'></p>
205    
206  <h2>Average server places available</h2>  <h2>Average server places available</h2>
207  <p><img src='images/capacity_full.png' alt='Graph' /></p>  <p><img src='images/capacity_full.png' alt='Graph'></p>
208  <p><img src='images/capacity_week.png' alt='Graph' /></p>  <p><img src='images/capacity_week.png' alt='Graph'></p>
209  <p><img src='images/capacity_day.png' alt='Graph' /></p>  <p><img src='images/capacity_day.png' alt='Graph'></p>
210    
211  <h2>Percentage server places used</h2>  <h2>Percentage server places used</h2>
212  <p><img src='images/usage_full.png' alt='Graph' /></p>  <p><img src='images/usage_full.png' alt='Graph'></p>
213  <p><img src='images/usage_week.png' alt='Graph' /></p>  <p><img src='images/usage_week.png' alt='Graph'></p>
214  <p><img src='images/usage_day.png' alt='Graph' /></p>  <p><img src='images/usage_day.png' alt='Graph'></p>
215    
216  END  END
217    
# Line 207  END Line 219  END
219    
220  $game_types = keys %game;  $game_types = keys %game;
221    
222  print INDEX <<END;  $key = <<END;
 <h2>Game type popularity</h2>  
223  <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,
224  <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.
225  $game_types game types.</p>  $game_types game types.
226  END  END
227    
228    print INDEX '<h2>Top 10 game types</h2>', $key, "<a href='games'>Full game type table</a>.</p>";
229    print GAMES '<h1>Game type popularity</h1>', $menu, $key, "</p>";
230    
231  $i = 0;  $i = 0;
232  foreach $gm (sort { $game{$b} <=> $game{$a} } keys %game) {  foreach $gm (sort { $game{$b} <=> $game{$a} } keys %game) {
233          $players = $game{$gm};          $players = $game{$gm};
# Line 226  foreach $gm (sort { $game{$b} <=> $game{ Line 240  foreach $gm (sort { $game{$b} <=> $game{
240          $pct = sprintf "%.3g", $propn * 100;          $pct = sprintf "%.3g", $propn * 100;
241          $pct7 = sprintf "%.3g", $propn7 * 100;          $pct7 = sprintf "%.3g", $propn7 * 100;
242          $class = $i % 2;          $class = $i % 2;
243          print INDEX <<END;          $line = <<END;
244          <p class='bar$class'>$gm<br />  <p class='bar$class'>$gm<br><img src='images/bar.png' width='$width' height='10' alt=''> $pct%<br>
245          <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>  
246  END  END
247            print INDEX $line if $i < 10;
248            print GAMES $line;
249          $i++;          $i++;
250  }  }
251    
# Line 238  END Line 253  END
253    
254  $maps = keys %map;  $maps = keys %map;
255    
256  print INDEX <<END;  $key = <<END;
 <h2>Map popularity</h2>  
257  <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,
258  <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.
259  $maps maps.  $maps maps.
260  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>.
261  END  END
262    
263    print INDEX '<h2>Top 10 maps</h2>', $key, "<a href='maps'>Full map popularity table</a>.</p>";
264    print MAPS '<h1>Map popularity</h1>', $menu, $key, "</p>";
265    
266  $i = 0;  $i = 0;
267  foreach $gmm (sort { $map{$b} <=> $map{$a} } keys %map) {  foreach $gmm (sort { $map{$b} <=> $map{$a} } keys %map) {
268          $players = $map{$gmm};          $players = $map{$gmm};
# Line 261  foreach $gmm (sort { $map{$b} <=> $map{$ Line 278  foreach $gmm (sort { $map{$b} <=> $map{$
278          $search = $gmm;          $search = $gmm;
279          $search =~ s/([^\w()'*~!.-])/sprintf '%%%02x', ord $1/eg;          $search =~ s/([^\w()'*~!.-])/sprintf '%%%02x', ord $1/eg;
280          $search =~ s/^Euro2_//;          $search =~ s/^Euro2_//;
281          print INDEX <<END;          $line = <<END;
282          <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>
283          <img src='images/bar.png' width='$width' height='10' alt='' /> $pct%<br />  <img src='images/bar.png' width='$width' height='10' alt=''> $pct%<br>
284          <img src='images/bar7.png' width='$width7' height='10' alt='' /> $pct7%</p>  <img src='images/bar7.png' width='$width7' height='10' alt=''> $pct7%</p>
285  END  END
286            print INDEX $line if $i < 10;
287            print MAPS $line;
288          $i++;          $i++;
289  }  }
290    
291  ################################################################################  ################################################################################
292    
293  print INDEX <<END;  $footer = <<END;
294  </body>  </body>
295  </html>  </html>
296  END  END
297    
298    print INDEX $footer;
299    print GRAPHS $footer;
300    print GAMES $footer;
301    print MAPS $footer;
302    
303  close INDEX;  close INDEX;
304    close GRAPHS;
305    close GAMES;
306    close MAPS;
307    
308  ################################################################################  ################################################################################
309    

Legend:
Removed from v.28  
changed lines
  Added in v.29

  ViewVC Help
Powered by ViewVC 1.1.26