Przeglądaj źródła

Add Most Active Nicks By Hour section

Morten Brix Pedersen 24 lat temu
rodzic
commit
ea8ea65434
5 zmienionych plików z 210 dodań i 0 usunięć
  1. 5 0
      docs/Changelog
  2. 109 0
      docs/pisg-doc.sgml
  3. 2 0
      lang.txt
  4. 3 0
      modules/Pisg.pm
  5. 91 0
      modules/Pisg/HTMLGenerator.pm

+ 5 - 0
docs/Changelog

@@ -11,6 +11,11 @@ pisg (x.xx)
      (thanks, Gissehel <gissehel-pisggene@giss.mine.nu>)
      (thanks, Gissehel <gissehel-pisggene@giss.mine.nu>)
    * --prefix commandline option wasn't working, fixed.
    * --prefix commandline option wasn't working, fixed.
    * Slovak translation added (thanks, Gabriel Svajko <snowman@ew.sk>)
    * Slovak translation added (thanks, Gabriel Svajko <snowman@ew.sk>)
+   * "Most Active Nicks By Hour" added, new options:
+     - ShowMostActiveByHour
+     - ShowMostActiveByHourGraph
+     - ActiveNicksByHour
+     (thanks, Gissehel <gissehel-pisggene@giss.mine.nu>)
 
 
 pisg (0.38) - Thu Apr, 25th 2002
 pisg (0.38) - Thu Apr, 25th 2002
    * Grammar fixes in documentation (thanks, Azhrarn <diablo2@krock.com>)
    * Grammar fixes in documentation (thanks, Azhrarn <diablo2@krock.com>)

+ 109 - 0
docs/pisg-doc.sgml

@@ -1583,6 +1583,80 @@
     </refsect1>
     </refsect1>
     </refentry>
     </refentry>
 
 
+    <!-- *** SHOWMOSTACTIVEBYHOUR *** -->
+    <refentry id="ShowMostActiveByHour">
+
+    <refmeta> <refentrytitle>ShowMostActiveByHour</refentrytitle> </refmeta>
+
+    <refnamediv>
+    <refname>ShowMostActiveByHour</refname>
+    <refpurpose>show most active nicks by hour</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv><programlisting>
+      <![CDATA[
+        <channel="#channel">
+         Logfile = "channel.log"
+         Format = "xchat"
+         ShowMostActiveByHour = "0"
+        </channel>
+
+        <set ShowMostActiveByHour="1">
+      ]]>
+    </programlisting></refsynopsisdiv>
+
+    <refsect1>
+    <title>Description</title>
+    <para>
+    By enabling this option, pisg will add a section to the stats showing
+    "Most Active Nicks By Hour" - also look at the
+    <command>ShowMostActiveByHourGraph</command> and
+    <command>ActiveNicksByHour</command> settings. 
+    </para>
+    </refsect1>
+    <refsect1>
+    <title>Default</title>
+    <para> 0 (disabled) </para>
+    </refsect1>
+    </refentry>
+
+    <!-- *** SHOWMOSTACTIVEBYHOURGRAPH *** -->
+    <refentry id="ShowMostActiveByHourGraph">
+
+    <refmeta> <refentrytitle>ShowMostActiveByHourGraph</refentrytitle> </refmeta>
+
+    <refnamediv>
+    <refname>ShowMostActiveByHourGraph</refname>
+    <refpurpose>show graphs in most active nicks by hour</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv><programlisting>
+      <![CDATA[
+        <channel="#channel">
+         Logfile = "channel.log"
+         Format = "xchat"
+         ShowMostActiveByHourGraph = "0"
+        </channel>
+
+        <set ShowMostActiveByHour="1">
+        <set ShowMostActiveByHourGraph="1">
+      ]]>
+    </programlisting></refsynopsisdiv>
+
+    <refsect1>
+    <title>Description</title>
+    <para>
+    By enabling this option and the <command>ShowMostActiveByHour</command>
+    option, pisg will show graphs in the "Most Active Nicks By Hour"
+    section.
+    </para>
+    </refsect1>
+    <refsect1>
+    <title>Default</title>
+    <para> 0 (disabled) </para>
+    </refsect1>
+    </refentry>
+
     <!-- *** IGNOREWORDS *** -->
     <!-- *** IGNOREWORDS *** -->
     <refentry id="IgnoreWords">
     <refentry id="IgnoreWords">
 
 
@@ -1856,6 +1930,41 @@
     </refsect1>
     </refsect1>
     </refentry>
     </refentry>
 
 
+    <!-- *** ACTIVENICKSBYHOUR *** -->
+    <refentry id="ActiveNicksByHour">
+
+    <refmeta> <refentrytitle>ActiveNicksByHour</refentrytitle> </refmeta>
+
+    <refnamediv>
+    <refname>ActiveNicksByHour</refname>
+    <refpurpose>number of nicks to show in "Most Active Nicks By Hour"</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv><programlisting>
+      <![CDATA[
+        <channel="#channel">
+         Logfile = "channel.log"
+         Format = "mIRC"
+         ActiveNicksByHour = "25"
+        </channel>
+
+        <set ActiveNicksByHour="10">
+      ]]>
+    </programlisting></refsynopsisdiv>
+
+    <refsect1>
+    <title>Description</title>
+    <para>
+    With this option you can define how many nicks you want to appear in the
+    "Most Active Nicks By Hour" section on the stats page.
+    </para>
+    </refsect1>
+    <refsect1>
+    <title>Default</title>
+    <para> 10 </para>
+    </refsect1>
+    </refentry>
+
     <!-- *** MOSTNICKSHISTORY *** -->
     <!-- *** MOSTNICKSHISTORY *** -->
     <refentry id="MostNicksHistory">
     <refentry id="MostNicksHistory">
 
 

+ 2 - 0
lang.txt

@@ -121,6 +121,7 @@ othernumtopic = "Other interesting numbers"
 latesttopic = "Latest Topics"
 latesttopic = "Latest Topics"
 activetimestopic = "Most active times"
 activetimestopic = "Most active times"
 activenickstopic = "Most active nicks"
 activenickstopic = "Most active nicks"
+activenickbyhourtopic = "Most active nicks by hours"
 mostwordstopic = "Most used words"
 mostwordstopic = "Most used words"
 referencetopic = "Most referenced nick"
 referencetopic = "Most referenced nick"
 urlstopic = "Most referenced URLs"
 urlstopic = "Most referenced URLs"
@@ -552,6 +553,7 @@ othernumtopic = "D'autres chiffres int
 latesttopic = "Les derniers topics"
 latesttopic = "Les derniers topics"
 activetimestopic = "Les périodes d'intense activité"
 activetimestopic = "Les périodes d'intense activité"
 activenickstopic = "Les nicks les plus actifs"
 activenickstopic = "Les nicks les plus actifs"
+activenickbyhourtopic = "Les nicks les plus actifs par heures"
 mostwordstopic = "Les mots les plus utilisés"
 mostwordstopic = "Les mots les plus utilisés"
 referencetopic = "Les nicks les plus utilisés dans la conversation"
 referencetopic = "Les nicks les plus utilisés dans la conversation"
 urlstopic = "Les URLs les plus citées"
 urlstopic = "Les URLs les plus citées"

+ 3 - 0
modules/Pisg.pm

@@ -149,6 +149,8 @@ sub get_default_config_settings
         showmru => 1,
         showmru => 1,
         showvoices => 0,
         showvoices => 0,
         showmostnicks => 0,
         showmostnicks => 0,
+        showmostactivebyhour => 0,
+        showmostactivebyhourgraph => 0,
 
 
         # Less important things
         # Less important things
 
 
@@ -158,6 +160,7 @@ sub get_default_config_settings
         wordlength => 5,
         wordlength => 5,
         activenicks => 25,
         activenicks => 25,
         activenicks2 => 30,
         activenicks2 => 30,
+        activenicksbyhour => 10,
         topichistory => 3,
         topichistory => 3,
         urlhistory => 5,
         urlhistory => 5,
         nickhistory => 5,
         nickhistory => 5,

+ 91 - 0
modules/Pisg/HTMLGenerator.pm

@@ -62,6 +62,10 @@ sub create_html
     }
     }
     $self->_activenicks();
     $self->_activenicks();
 
 
+    if ($self->{cfg}->{showmostactivebyhour}) {
+        $self->_mostactivebyhour();
+    }
+
     if ($self->{cfg}->{showbignumbers}) {
     if ($self->{cfg}->{showbignumbers}) {
         $self->_headline($self->_template_text('bignumtopic'));
         $self->_headline($self->_template_text('bignumtopic'));
         _html("<table width=\"$self->{cfg}->{tablewidth}\">\n"); # Needed for sections
         _html("<table width=\"$self->{cfg}->{tablewidth}\">\n"); # Needed for sections
@@ -1674,6 +1678,93 @@ sub _mostnicks
     }
     }
 }
 }
 
 
+sub _mostactivebyhour
+{
+    # List showing the user with most used nicks
+    my $self = shift;
+
+    my $sortnicks;
+
+    my $lastline=-1;
+    my $maxlines=0;
+
+    foreach my $period (0,1,2,3) {
+        my @sortnicks =
+        sort
+        {
+              (defined $self->{stats}->{line_times}{$b}[$period]?$self->{stats}->{line_times}{$b}[$period]:0)
+              <=>
+              (defined $self->{stats}->{line_times}{$a}[$period]?$self->{stats}->{line_times}{$a}[$period]:0)
+        }
+        keys %{ $self->{stats}->{nicks} } ;
+
+        for(my $i = 0; $i < $self->{cfg}->{activenicksbyhour}; $i++) {
+            next if is_ignored($sortnicks[$i]);
+            last unless $i < @sortnicks;
+
+            my $nick=$sortnicks[$i];
+            my $count=$self->{stats}->{line_times}{$nick}[$period] || 0;
+
+            last unless $nick;
+            last unless $count;
+
+            $sortnicks->[$period][$i]=$nick;
+
+            if ($lastline<$i) {
+              $lastline=$i;
+            }
+
+
+            if ($maxlines<$count) {
+              $maxlines=$count;
+            }
+        }
+    }
+
+    if ($lastline>=0) {
+
+        $self->_headline($self->_template_text('activenickbyhourtopic'));
+
+        _html("<table border=\"0\" width=\"$self->{cfg}->{tablewidth}\"><tr>");
+        _html("<td>&nbsp;</td>");
+        _html("<td class=\"tdtop\"><b>0-5</b></td>");
+        _html("<td class=\"tdtop\"><b>6-11</b></td>");
+        _html("<td class=\"tdtop\"><b>12-17</b></td>");
+        _html("<td class=\"tdtop\"><b>18-23</b></td>");
+        _html("</tr>");
+
+        for(my $i = 0; $i <= $lastline; $i++) {
+
+            my $a = $i + 1;
+            my $class = $a == 1 ? 'hirankc' : 'rankc';
+
+            _html("<tr><td class=\"$class\">$a</td>");
+            foreach my $period (0,1,2,3) {
+                my $nick=$sortnicks->[$period][$i];
+                if ($nick) {
+                    my $count=$self->{stats}->{line_times}{$nick}[$period];
+                    if ($count) {
+                        _html("<td class=\"hicell\">".$nick." - ".$count);
+
+                        if ($self->{cfg}->{showmostactivebyhourgraph}) {
+                            my $pic = 'pic_h_'.(6*$period);
+                            my $w = int(($count / $maxlines) * 100);
+                            _html("<br><img src=\"$self->{cfg}->{piclocation}/$self->{cfg}->{$pic}\" border=\"0\" width=\"$w\" height=\"15\" align=\"middle\" alt=\"\" />");
+                        }
+                        _html("</td>");
+                    } else {
+                        _html("<td class=\"hicell\">&nbsp;</td>");
+                    }
+                } else {
+                  _html("<td class=\"hicell\">&nbsp;</td>");
+                }
+            }
+            _html("</tr>");
+        }
+        _html("</table>");
+    }
+}
+
 1;
 1;
 
 
 __END__
 __END__