Просмотр исходного кода

New patch from Hanno, show_cpl and show_wpl

Morten Brix Pedersen 25 лет назад
Родитель
Сommit
01ca79bd5d
4 измененных файлов с 68 добавлено и 27 удалено
  1. 20 16
      CONFIG-README
  2. 3 0
      Changelog
  3. 4 0
      lang.txt
  4. 41 11
      pisg.pl

+ 20 - 16
CONFIG-README

@@ -85,25 +85,33 @@ format               logfile format. see FORMATS file
 network              Network the channels is using.
 outputfile           The name of the html file to be generated
 maintainer           The maintainer or bot which makes the logfile
-pagehead             Some 'page header' file which you want to
-                     include in top of the stats
+pagehead             Some 'page header' file which you want to include in top
+                     of the stats
 
 configfile           Path to config file (aliases, ignores,
                      pics and more, see pisg.cfg for examples)
 
-imagepath            If your user pictures is located
-                     some special directory, set the path here.
+imagepath            If your user pictures is located some special directory,
+                     set the path here.
 
-logdir               If you specify a path to a dir here, then
-                     pisg will take that dir, and parse ALL
-                     logfiles in it, and create 1 HTML file
-                     from it
+logdir               If you specify a path to a dir here, then pisg will
+                     take that dir, and parse ALL logfiles in it, and create
+                     1 HTML file from it
 
 lang                 Language to use:
                      EN | DE | DK | FR | ES | PL | NO | NL
 
 langfile             Name of language file
 
+timeoffset           A time offset on the stats page - if your country has
+                     a different timezone than the machine where the stats
+                     are being generated, then for example do +1
+
+show_wpl             1 or 0, this enables pisg to show 'words per line' for
+                     each person in 'most active nicks'
+
+show_cpl             Same as above, this is just 'chars per line'
+
   * Colors for your stats page *
 
 bgcolor              Background color of the page
@@ -127,18 +135,14 @@ pic2                 Bar-graphic-file for top-times
 
 minquote             Minimal value of letters for a random quote
 maxquote             Maximum value of letters for a random quote
-wordlength           The minimum number of chars an interesting
-                     word may be (in 'most referenced words')
+wordlength           The minimum number of chars an interesting word may be
+                     (in 'most referenced words')
 activenicks          Number of nicks to show in the 'top 25'
 activenicks2         Nicks to show in 'these didnt make it...'
 topichistory         How many topics to show in 'latest topics'
-nicktracking         Track nickchanges and create aliases (can
-                     be slow, so it's disabled by default)
+nicktracking         Track nickchanges and create aliases (can be slow, so
+                     it's disabled by default)
 
-timeoffset           A time offset on the stats page - if your
-                     country has a different timezone than the
-                     machine where the stats are being
-                     generated, then for example do +1
 
 
 WORD OPTIONS

+ 3 - 0
Changelog

@@ -5,6 +5,9 @@ pisg (0.20)
      from crontab), then try opening the config file in which pisg.pl resides
      instead..
    * <words foul="..."> is now known as <set words="...">
+   * Add new options 'show_wpl' and 'show_cpl', this enables user to view the
+     'chars per line' and 'words per line' in the 'most active nicks',
+     disabled by default.
    * Usual cleanups and improvements
 
 pisg (0.19) - Tue, Aug 7th 2001

+ 4 - 0
lang.txt

@@ -107,6 +107,8 @@ userpic = "Userpic"
 nottop = "These didn't make it to the top:"
 word = "Word"
 numberuses = "Number of Uses"
+show_wpl = "Words per line"
+show_cpl = "Chars per line"
 lastused = "Last Used by"
 pagetitle1 = "[:channel] @ [:network] stats by [:maintainer]"
 pagetitle2 = "Statistics generated on [:time]"
@@ -201,6 +203,8 @@ randquote = "Zufalls quote"
 userpic = "Userbild"
 nottop = "Sie haben es nicht an die Spitze geschafft:"
 word = "Wort"
+show_wpl = "Worte pro Zeile"
+show_cpl = "Zeichen pro Zeile"
 numberuses = "Wie oft benutzt"
 lastused = "Zuletzt benutzt von"
 pagetitle1 = "[:channel] @ [:network] stats erstellt von [:maintainer]"

+ 41 - 11
pisg.pl

@@ -73,6 +73,11 @@ my $conf = {
     nicktracking => 0,
     timeoffset => "+0",
 
+    # Stats settings
+    
+    show_wpl => 0,
+    show_cpl => 0,
+
     # Misc settings
 
     foul => "ass fuck bitch shit scheisse scheiße kacke arsch ficker ficken schlampe",
@@ -91,7 +96,8 @@ $thirdline, @ignore, $processtime, @topics, %monologue, %kicked, %gotkick,
 %line, %length, %sadface, %smile, $nicks, %longlines, %mono, %times, %question,
 %loud, $totallength, %gaveop, %tookop, %joins, %actions, %sayings, %wordcount,
 %lastused, %gotban, %setban, %foul, $days, $oldtime, $lastline, $actions,
-$normals, %T, $repeated, $lastnormal, %shout, %slap, %slapped, %words);
+$normals, %T, $repeated, $lastnormal, %shout, %slap, %slapped, %words, 
+$tablewidth, $headwidth);
 
 
 sub main
@@ -193,6 +199,7 @@ sub init_pisg
     undef %slapped; 
     undef %words; 
 
+
     $timestamp = time;
 
     if ($conf->{timeoffset} =~ /\+(\d+)/) {
@@ -219,6 +226,7 @@ sub init_pisg
     $normals = "0";
     $time = localtime($timestamp);
     $repeated = 0;
+    $tablewidth = 614;
     $conf->{start} = time();   # set start time of file parse
 
     print "Using language template: $conf->{lang}\n\n" if ($conf->{lang} ne 'EN');
@@ -1000,13 +1008,20 @@ sub create_html
 
     open (OUTPUT, "> $conf->{outputfile}") or die("$0: Unable to open outputfile($conf->{outputfile}): $!\n");
 
+    if ($conf->{show_wpl}) {
+        $tablewidth += 40;
+    }
+    if ($conf->{show_cpl}) {
+        $tablewidth += 40;
+    }
+    $headwidth = $tablewidth - 4;
     htmlheader();
     pageheader();
     activetimes();
     activenicks();
 
     headline(template_text('bignumtopic'));
-    html("<table width=\"614\">\n"); # Needed for sections
+    html("<table width=\"$tablewidth\">\n"); # Needed for sections
     questions();
     loudpeople();
 	shoutpeople();
@@ -1024,7 +1039,7 @@ sub create_html
     mostreferenced();
 
     headline(template_text('othernumtopic'));
-    html("<table width=\"614\">\n"); # Needed for sections
+    html("<table width=\"$tablewidth\">\n"); # Needed for sections
     gotkicks();
     mostkicks();
     mostop();
@@ -1034,7 +1049,7 @@ sub create_html
     html("</table>"); # Needed for sections
 
     headline(template_text('latesttopic'));
-    html("<table width=\"614\">\n"); # Needed for sections
+    html("<table width=\"$tablewidth\">\n"); # Needed for sections
     lasttopics();
     html("</table>"); # Needed for sections
 
@@ -1099,7 +1114,7 @@ sub activetimes
         $output{$hour} = "<td align=\"center\" valign=\"bottom\" class=\"asmall\">$percent%<br><img src=\"$image\" width=\"15\" height=\"$size\" alt=\"$percent\"></td>\n";
     }
 
-    html("<table border=\"0\" width=\"614\"><tr>\n");
+    html("<table border=\"0\" width=\"$tablewidth\"><tr>\n");
 
     for ($b = 0; $b < 24; $b++) {
         if ($b < 10) { $a = "0" . $b; } else { $a = $b; }
@@ -1127,8 +1142,14 @@ sub activenicks
 
     headline(template_text('activenickstopic'));
 
-    html("<table border=\"0\" width=\"614\"><tr>");
-    html("<td>&nbsp;</td><td bgcolor=\"$conf->{tdtop}\"><b>" . template_text('nick') . "</b></td><td bgcolor=\"$conf->{tdtop}\"><b>" . template_text('numberlines') ."</b></td><td bgcolor=\"$conf->{tdtop}\"><b>". template_text('randquote') ."</b></td>");
+    html("<table border=\"0\" width=\"$tablewidth\"><tr>");
+    html("<td>&nbsp;</td><td bgcolor=\"$conf->{tdtop}\"><b>" 
+        . template_text('nick') . "</b></td><td bgcolor=\"$conf->{tdtop}\"><b>"
+	. template_text('numberlines') 
+        . "</b></td><td bgcolor=\"$conf->{tdtop}\"><b>"
+	. ($conf->{show_wpl} ? template_text('show_wpl')."</b></td><td bgcolor=\"$conf->{tdtop}\"><b>" : "") 
+	. ($conf->{show_cpl} ? template_text('show_cpl')."</b></td><td bgcolor=\"$conf->{tdtop}\"><b>" : "") 
+        . template_text('randquote') ."</b></td>");
     if (scalar keys %{$users->{userpics}} > 0) {
         html("<td bgcolor=\"$conf->{tdtop}\"><b>" . template_text('userpic') ."</b></td>");
     }
@@ -1182,7 +1203,16 @@ sub activenicks
 
         html("<tr><td bgcolor=\"$conf->{rankc}\" align=\"left\">");
         my $line = $line{$nick};
-        html("$i</td><td bgcolor=\"#$col_r$col_g$col_b\">$visiblenick</td><td bgcolor=\"#$col_r$col_g$col_b\">$line</td><td bgcolor=\"#$col_r$col_g$col_b\">");
+	my $w    = $words{$nick};
+	my $ch   = $length{$nick};
+        html("$i</td><td bgcolor=\"#$col_r$col_g$col_b\">$visiblenick</td><td bgcolor=\"#$col_r$col_g$col_b\">$line</td>"
+	. ($conf->{show_wpl} ? 
+	 "<td bgcolor=\"#$col_r$col_g$col_b\">".sprintf("%.1f",$w/$line)."</td>"
+	 : "")
+	. ($conf->{show_cpl} ? 
+	 "<td bgcolor=\"#$col_r$col_g$col_b\">".sprintf("%.1f",$ch/$line)."</td>"
+	 : "")
+	."<td bgcolor=\"#$col_r$col_g$col_b\">");
         html("\"$randomline\"</td>");
 
         if ($users->{userpics}{$nick}) {
@@ -1232,7 +1262,7 @@ sub mostusedword
     if (@popular) {
         &headline(template_text('mostwordstopic'));
 
-        html("<table border=\"0\" width=\"614\"><tr>");
+        html("<table border=\"0\" width=\"$tablewidth\"><tr>");
         html("<td>&nbsp;</td><td bgcolor=\"$conf->{tdtop}\"><b>" . template_text('word') . "</b></td>");
         html("<td bgcolor=\"$conf->{tdtop}\"><b>" . template_text('numberuses') . "</b></td>");
         html("<td bgcolor=\"$conf->{tdtop}\"><b>" . template_text('lastused') . "</b></td>");
@@ -1308,7 +1338,7 @@ sub mostreferenced
 
         &headline(template_text('referencetopic'));
 
-        html("<table border=\"0\" width=\"614\"><tr>");
+        html("<table border=\"0\" width=\"$tablewidth\"><tr>");
         html("<td>&nbsp;</td><td bgcolor=\"$conf->{tdtop}\"><b>" . template_text('nick') . "</b></td>");
         html("<td bgcolor=\"$conf->{tdtop}\"><b>" . template_text('numberuses') . "</b></td>");
         html("<td bgcolor=\"$conf->{tdtop}\"><b>" . template_text('lastused') . "</b></td>");
@@ -2038,7 +2068,7 @@ sub headline
     my ($title) = @_;
 print OUTPUT <<HTML;
    <br>
-   <table width="610" cellpadding="1" cellspacing="0" border="0">
+   <table width="$headwidth" cellpadding="1" cellspacing="0" border="0">
     <tr>
      <td bgcolor="$conf->{headline}">
       <table width="100%" cellpadding="2" cellspacing="0" border="0" align="center">