',"\n"; + print HTMLFIL '',\$self->translate('PSI Statistics'),'

',"\n"; + print HTMLFIL \$self->translate('Statistics have been generated at '),'"',sprintf('%02d.%02d.%d %02d:%02d:%02d', \$mday, \$mon, \$year, \$hour, \$min, \$sec),'"

',"\n"; + + # daily activity + print HTMLFIL '
',\$self->translate('Daily activity'),'
',"\n"; + print HTMLFIL '',"\n"; + \$i = \$self->{history}; + while(\$i > 0) { + \$i--; + \$sum = \$self->{days}[\$i][0] + \$self->{days}[\$i][1] + \$self->{days}[\$i][2] + \$self->{days}[\$i][3]; + print HTMLFIL '',"\n"; + } + print HTMLFIL '',"\n"; + \$i = \$self->{history}; + while(\$i > 0) { + \$i--; + print HTMLFIL '',"\n"; + } + print HTMLFIL '
 ',\$sum,'',"\n"; + print HTMLFIL '',"\n"; + print HTMLFIL '',"\n"; + print HTMLFIL '',"\n"; + print HTMLFIL '',"\n"; + print HTMLFIL ' ',\$i,'
',"\n"; + print HTMLFIL '',"\n"; + print HTMLFIL '',"\n"; + print HTMLFIL '',"\n"; + print HTMLFIL '',"\n"; + print HTMLFIL '',"\n"; + print HTMLFIL '
 = 0-5 = 6-11 = 12-17 = 18-23

',"\n"; + + # most active times + print HTMLFIL '
',\$self->translate('Most active times'),'
',"\n"; + print HTMLFIL '',"\n"; + \$i = 0; + while(\$i < 24) { + print HTMLFIL '',"\n"; + \$i++; + } + print HTMLFIL '',"\n"; + \$i = 0; + while(\$i < 24) { + print HTMLFIL '',"\n"; + \$i++; + } + print HTMLFIL '
 ',sprintf('%.1f', \$self->{hours}[\$i] * 100 / \$sum_h),'% ',\$i,'

',"\n"; + + # contacts + print HTMLFIL '
',\$self->translate('Contacts'),'
',"\n"; + print HTMLFIL '',"\n"; + print HTMLFIL '',"\n"; + \$i = 0; + foreach \$nick (@{\$self->{snicks}}) { + \$i++; + if(\$self->{nicks}{\$nick}{lines} > 0) { + \$sum = \$self->{nicks}{\$nick}{linest}[0] + \$self->{nicks}{\$nick}{linest}[1] + \$self->{nicks}{\$nick}{linest}[2] + \$self->{nicks}{\$nick}{linest}[3]; + \$sum = (\$sum > 0) ? \$sum : 1; + my (\$sec,\$min,\$hour,\$mday,\$mon,\$year) = (localtime(\$self->{nicks}{\$nick}{last})); + \$year += 1900; + \$mon++; + print HTMLFIL ''; + print HTMLFIL ''; + print HTMLFIL '',"\n"; + } + } + print HTMLFIL '
 ',\$self->translate('Nick'),' ',\$self->translate('Posts'),' ',\$self->translate('Time'),' ',\$self->translate('To'),' ',\$self->translate('From'),' ',\$self->translate('Last message'),' ',\$i,' {nickname} ',\$self->{nicks}{\$nick}{lines},' '; + print HTMLFIL ''; + print HTMLFIL ''; + print HTMLFIL ''; + print HTMLFIL ''; + print HTMLFIL ' ',sprintf('%.2f', \$self->{nicks}{\$nick}{to} * 100 / \$self->{nicks}{\$nick}{lines}),'% ',sprintf('%.2f', 100 - \$self->{nicks}{\$nick}{to} * 100 / \$self->{nicks}{\$nick}{lines}),'% ',sprintf('%02d.%02d.%d %02d:%02d:%02d', \$mday, \$mon, \$year, \$hour, \$min, \$sec),'

',"\n"; + + # footer + print HTMLFIL \$self->translate('Total number of lines'),': ',\$self->{lines},'

',"\n"; + print HTMLFIL '',"\n"; + print HTMLFIL \$self->translate('Stats generated by'),' psist v',\$self->{version},'
',"\n"; + print HTMLFIL 'psist by Michal Zbortek (zet)
',"\n"; + \$time = time - \$self->{start}; + print HTMLFIL \$self->translate('Stats generated in'),' ',sprintf('%02d:%02d:%02d', \$time / 3600, (\$time % 3600) / 60, (\$time % 3600) % 60),"\n"; + print HTMLFIL '
',"\n"; + + print HTMLFIL '
',"\n"; + print HTMLFIL '',"\n"; + print HTMLFIL '',"\n"; + close(HTMLFIL); +} + +sub translate +{ + my \$self = shift; + my \$message = shift; + + return \$message; +} + +return 1; + diff --git a/README b/README new file mode 100644 index 0000000..d7fd58d --- /dev/null +++ b/README @@ -0,0 +1,22 @@ +psist +----- +It's a perl script for creating statistics from history logs jabber +application Psi. + +First it loads config file and parse contacts from it. It grabs +statistics data from history files and finally generates html file. + +Run with parameters + -p path ... path to profile directory, default is directory + of default profile of psi in unix structure. + -o outfile ... target generated html file, in that directory + you must also have png images and style.css, + default name is out.html. + +While programming i was inspirated by IRC statistics generator Pisg +(http://pisg.sourceforge.net/) and i used their output html design. + +----- +Michal Zbortek +\$Date: 2006-03-24 17:48:30 +0100 (Fri, 24 Mar 2006) \$ + diff --git a/TODO b/TODO new file mode 100644 index 0000000..b0dc497 --- /dev/null +++ b/TODO @@ -0,0 +1,2 @@ +- Last post in contact section + diff --git a/blue-h.png b/blue-h.png new file mode 100644 index 0000000000000000000000000000000000000000..fdad6b540864d935e0e9cc3d5a99f738fe1569b8 GIT binary patch literal 112 zcmeAS@N?(olHy`uVBq!ia0vp^j6lrK!2~2%)f%k>Qs\$m6jv*3~tOqUm8XS0799RCA zpZM8Dsb-C>vWw{TzY4W;Ol_A%rObZwbggQTOXmw!?<+Ix(yrNm{;T!dyv05SXas|& LtDnm{r-UW|KrACu literal 0 HcmV?d00001 diff --git a/blue-v.png b/blue-v.png new file mode 100644 index 0000000000000000000000000000000000000000..62877a7658436b634389dd1712f9948c07de8543 GIT binary patch literal 106 zcmeAS@N?(olHy`uVBq!ia0vp^{6Nge!2~4x_9f>6DML>e#}J9jtOpJG4jAw-Ieh&e z{mpJ;aBc^q>(1(Hzi*~%&uPe8wo-mo*+Ey+9?o*NohKJ+-TS_yItQqk!PC{xWt~\$( F69DVQBOd?& literal 0 HcmV?d00001 diff --git a/green-h.png b/green-h.png new file mode 100644 index 0000000000000000000000000000000000000000..1fe92243594323ec0778ddacb18f41fee6affc7c GIT binary patch literal 114 zcmeAS@N?(olHy`uVBq!ia0vp^j6lrK!2~2%)f%k>QkI@Bjv*3~tOpIn8VopG4nDiT z|AU>}\$)+8gEC%N#-#t&7f9Q4~`>UhT!rF6DI-r8#}Elg*+Y(e3<5kX2Y&oN zTW@o6p^olumn5T=SN7<|^0As&w+n8oUzBUYTi_(8E_Yf->*!zJ&69z;89ZJ6T-G@y GGywom4;~x< literal 0 HcmV?d00001 diff --git a/psist b/psist new file mode 100755 index 0000000..1bad8e8 --- /dev/null +++ b/psist @@ -0,0 +1,54 @@ +#!/usr/bin/perl -w + +# \$HeadURL: http://svn.mzet.net/psist/psist \$ +# \$Author: zet \$ +# \$Date: 2006-08-24 15:39:25 +0200 (Thu, 24 Aug 2006) \$ +# \$Revision: 12 \$ + +use strict; +use Psist; +use Getopt::Long; +use Env; + +sub get_cmdline_options +{ + my %cfg = ( + profile => \$ENV{HOME}.'/.psi/profiles/default', + outfile => 'out.html' + ); + + my \$usage = < \\$cfg{profile}, + 'outfile=s' => \\$cfg{outfile}, + 'silent' => \\$cfg{silent}, + 'help' => \\$help) == 0 or \$help) { + die(\$usage); + } + + return %cfg; +} + +sub main +{ + my %cfg = &get_cmdline_options(); + + my \$psist = Psist->new(profile => \$cfg{profile}, + outfile => \$cfg{outfile}, + silent => \$cfg{silent}, + version => '0.2'); + \$psist->run(); +} + +&main(); + diff --git a/red-h.png b/red-h.png new file mode 100644 index 0000000000000000000000000000000000000000..2f52f4a6205731df8dcc00458d71793df0beda17 GIT binary patch literal 110 zcmeAS@N?(olHy`uVBq!ia0vp^j6lrK!2~2%)f%k>Ql_3Rjv*4^s\$HI33<^9)68_b{ zvbVi?RIg*I98)7pH-|aX(>^2Tl}a-OwN9LU?0ahY>=QM|#T^C_&3I!U#;OXk; Jvd\$@?2>{t?Aou_P literal 0 HcmV?d00001 diff --git a/red-v.png b/red-v.png new file mode 100644 index 0000000000000000000000000000000000000000..cfe6c3bc75d694c6f15d712ba456520f230689f1 GIT binary patch literal 104 zcmeAS@N?(olHy`uVBq!ia0vp^{6Nge!2~4x_9f>6DSb~D#}J9jtOp(W7!){|H~jc7 z{r}4ownJjcyUUKuF5JF)j%LCnD*=NB4nx;nr?%T4SJv9KWX`q(pjHM?S3j3^P6Ql_3Rjv*3~yhk_kGAQsc8%+7H zZuf-2>`K?9kdzHJ-)6ng^AHbdlC9wBI4(aW@Eg<9qb;{e?0Ft&_urR|SOzqJ!PC{x JWt~\$(69CV0Aus>{ literal 0 HcmV?d00001 diff --git a/yellow-v.png b/yellow-v.png new file mode 100644 index 0000000000000000000000000000000000000000..87bbde350081400c893c0ca5292260ef91934d5e GIT binary patch literal 105 zcmeAS@N?(olHy`uVBq!ia0vp^{6Nge!2~4x_9f>6DFaUz#}J9jtOpPBGAMAc9K7-W zJfH4?`>aZLgwn6sRxf)n^NWl1hFe;vPsp|w7;(O5zH6mjQd;@#B2X`br>mdKI;Vst E0I