Senna Jawa
Literotica Guru
- Joined
- May 13, 2002
- Posts
- 3,272
This is still the old program. The indentations are surpressed in your html viewing window but they are still present in the html source.
I've added the stats related to the comments on submissions. (Thus there is now even more of the ugly copy+paste+modify stuff, which makes the code unnecessarily long; I've simplified one detail though
). I intend to have a new, cleaner program and to post it here too.
In a separate post I'll present the output of the present program.
The whole approach should be different, via a professional data base, but that's a different story.
############################################
#!/usr/bin/perl
## author: Senna Jawa ## program: litS.pl (in perl)
print "Enter the Literotica submission file\n path+name ==> ";
(chomp($subFile = <>));
open (SUB, $subFile) or die "can't open $subFile";
print "Enter the date ==> ";
chomp($day = <>);
$outF= ">litStat".$day."o";
open (STAT,$outF);
print $outF,"\n";
while (<SUB>) # skip the irrelevant part of the file
{
last if /colspan=\"2\"/
}
$vv=0; # votes/views switch
while (<SUB>)
{ ++$subTot if /colspan=\"2\"/;
++$noDescr if /No Description/;
if (/(\d\.\d\d)/)
{ ++$graded;
$vot=$1;
if ($1 == 5) {++$g5}
elsif($1 > 4) {++$g4p}
elsif($1 == 4) {++$g4}
elsif($1 > 3) {++$g3p}
elsif($1 == 3) {++$g3}
elsif($1 > 2) {++$g2p}
elsif($1 == 2) {++$g2}
elsif($1 > 1) {++$g1p}
elsif($1 == 1) {++$g1}
}
if(/x\.xx/) {++$nG; $vot=0}
if(/>(\d+)</)
{ if($vv)
{ if ($vot==5) {$vie5 += $1}
elsif($vot>4) {$vie4p += $1}
elsif($vot==4) {$vie4 += $1}
elsif($vot>3) {$vie3p += $1}
elsif($vot==3) {$vie3 += $1}
elsif($vot>2) {$vie2p += $1}
elsif($vot==2) {$vie2 += $1}
elsif($vot>1) {$vie1p += $1}
elsif($vot==1) {$vie1 += $1}
else {$vienG += $1}
++$v100[int($1/100)];
++$v500[int($1/500)]
$vv=1-$vv;
}
else
{ if ($vot==5) {$vts5 += $1}
elsif($vot>4) {$vts4p += $1}
elsif($vot==4) {$vts4 += $1}
elsif($vot>3) {$vts3p += $1}
elsif($vot==3) {$vts3 += $1}
elsif($vot>2) {$vts2p += $1}
elsif($vot==2) {$vts2 += $1}
elsif($vot>1) {$vts1p += $1}
elsif($vot==1) {$vts1 += $1}
++$votes[$1]; $vv=1-$vv
}
}
++$nonE if /\">Non-Erotic/;
++$erot if /\">Erotic/;
if(/Comments: (\d+)/)
{ ++$comments[$1];
if($1)
{
if ($vot==5) {$comT5 += $1; ++$comS5}
elsif($vot>4) {$comT4p += $1; ++$comS4p}
elsif($vot==4) {$comT4 += $1; ++$comS4}
elsif($vot>3) {$comT3p += $1; ++$comS3p}
elsif($vot==3) {$comT3 += $1; ++$comS3}
elsif($vot>2) {$comT2p += $1; ++$comS2p}
elsif($vot==2) {$comT2 += $1; ++$comS2}
elsif($vot>1) {$comT1p += $1; ++$comS1p}
elsif($vot==1) {$comT1 += $1; ++$comS1}
} } }
print STAT "date: $day\n\n";
print STAT "\nThe total number of submissions = $subTot\n";
print STAT "The number of submissions w/o description = $noDescr\n";
print STAT "Erotic poems: $erot\n";
print STAT "Non-Erotic poems: $nonE\n";
print STAT "The number of rated submissions : $graded\n";
print STAT "\nThe number of\n";
print STAT '-'x8," SUBM-s VOTES VIEWS ** COMsubs COMM-s --within the given\n";
print STAT "RATING range:\n\n";
$format = "-- %4d %4d %7d ** %3d %4d\n";
printf STAT "5.00 --------".$format, $g5, $vts5, $vie5, $comS5, $comT5;
printf STAT "4.01 to 4.99 ".$format, $g4p,$vts4p,$vie4p, $comS4p, $comT4p;
printf STAT "4.00 --------".$format, $g4, $vts4, $vie4, $comS4, $comT4;
printf STAT "3.01 to 3.99 ".$format, $g3p,$vts3p,$vie3p, $comS3p, $comT3p;
printf STAT "3.00 --------".$format, $g3, $vts3, $vie3, $comS3, $comT3;
printf STAT "2.01 to 2.99 ".$format, $g2p,$vts2p,$vie2p, $comS2p, $comT2p;
printf STAT "2.00 --------".$format, $g2, $vts2, $vie2, $comS2, $comT2;
printf STAT "1.01 to 1.99 ".$format, $g1p,$vts1p,$vie1p, $comS1p, $comT1p;
printf STAT "1.00 --------".$format, $g1, $vts1, $vie1, $comS1, $comT1;
printf STAT "x.xx --------".$format, $nG, 0, $vienG, 0, 0;;
print STAT "\n";
print STAT "votes submissions\n";
print STAT "====================\n";
print STAT "0 $nG\n";
for(1..$#votes)
{
print STAT $_," ",$votes[$_],"\n" if $votes[$_]
}
print STAT "\n";
print STAT "comments submissions\n";
print STAT "=======================\n";
for(0..$#comments)
{
print STAT $_," ",$comments[$_],"\n" if $comments[$_]
}
print STAT "\n";
print STAT "views/500 submissions\n";
print STAT "========================\n";
for(0..$#v500)
{
$lowR = 500*$_; $highR = $lowR + 499;
print STAT $lowR," to $highR --- ",$v500[$_],"\n"
if $v500[$_]
}
print STAT "\n";
print STAT "views/100 submissions\n";
print STAT "========================\n";
for(0..$#v100)
{
$lowR = 100*$_; $highR = $lowR + 99;
print STAT $lowR,," to $highR --- ",$v100[$_],"\n" if $v100[$_]
}
I've added the stats related to the comments on submissions. (Thus there is now even more of the ugly copy+paste+modify stuff, which makes the code unnecessarily long; I've simplified one detail though
In a separate post I'll present the output of the present program.
The whole approach should be different, via a professional data base, but that's a different story.
Senna Jawa
############################################
#!/usr/bin/perl
## author: Senna Jawa ## program: litS.pl (in perl)
print "Enter the Literotica submission file\n path+name ==> ";
(chomp($subFile = <>));
open (SUB, $subFile) or die "can't open $subFile";
print "Enter the date ==> ";
chomp($day = <>);
$outF= ">litStat".$day."o";
open (STAT,$outF);
print $outF,"\n";
while (<SUB>) # skip the irrelevant part of the file
{
last if /colspan=\"2\"/
}
$vv=0; # votes/views switch
while (<SUB>)
{ ++$subTot if /colspan=\"2\"/;
++$noDescr if /No Description/;
if (/(\d\.\d\d)/)
{ ++$graded;
$vot=$1;
if ($1 == 5) {++$g5}
elsif($1 > 4) {++$g4p}
elsif($1 == 4) {++$g4}
elsif($1 > 3) {++$g3p}
elsif($1 == 3) {++$g3}
elsif($1 > 2) {++$g2p}
elsif($1 == 2) {++$g2}
elsif($1 > 1) {++$g1p}
elsif($1 == 1) {++$g1}
}
if(/x\.xx/) {++$nG; $vot=0}
if(/>(\d+)</)
{ if($vv)
{ if ($vot==5) {$vie5 += $1}
elsif($vot>4) {$vie4p += $1}
elsif($vot==4) {$vie4 += $1}
elsif($vot>3) {$vie3p += $1}
elsif($vot==3) {$vie3 += $1}
elsif($vot>2) {$vie2p += $1}
elsif($vot==2) {$vie2 += $1}
elsif($vot>1) {$vie1p += $1}
elsif($vot==1) {$vie1 += $1}
else {$vienG += $1}
++$v100[int($1/100)];
++$v500[int($1/500)]
$vv=1-$vv;
}
else
{ if ($vot==5) {$vts5 += $1}
elsif($vot>4) {$vts4p += $1}
elsif($vot==4) {$vts4 += $1}
elsif($vot>3) {$vts3p += $1}
elsif($vot==3) {$vts3 += $1}
elsif($vot>2) {$vts2p += $1}
elsif($vot==2) {$vts2 += $1}
elsif($vot>1) {$vts1p += $1}
elsif($vot==1) {$vts1 += $1}
++$votes[$1]; $vv=1-$vv
}
}
++$nonE if /\">Non-Erotic/;
++$erot if /\">Erotic/;
if(/Comments: (\d+)/)
{ ++$comments[$1];
if($1)
{
if ($vot==5) {$comT5 += $1; ++$comS5}
elsif($vot>4) {$comT4p += $1; ++$comS4p}
elsif($vot==4) {$comT4 += $1; ++$comS4}
elsif($vot>3) {$comT3p += $1; ++$comS3p}
elsif($vot==3) {$comT3 += $1; ++$comS3}
elsif($vot>2) {$comT2p += $1; ++$comS2p}
elsif($vot==2) {$comT2 += $1; ++$comS2}
elsif($vot>1) {$comT1p += $1; ++$comS1p}
elsif($vot==1) {$comT1 += $1; ++$comS1}
} } }
print STAT "date: $day\n\n";
print STAT "\nThe total number of submissions = $subTot\n";
print STAT "The number of submissions w/o description = $noDescr\n";
print STAT "Erotic poems: $erot\n";
print STAT "Non-Erotic poems: $nonE\n";
print STAT "The number of rated submissions : $graded\n";
print STAT "\nThe number of\n";
print STAT '-'x8," SUBM-s VOTES VIEWS ** COMsubs COMM-s --within the given\n";
print STAT "RATING range:\n\n";
$format = "-- %4d %4d %7d ** %3d %4d\n";
printf STAT "5.00 --------".$format, $g5, $vts5, $vie5, $comS5, $comT5;
printf STAT "4.01 to 4.99 ".$format, $g4p,$vts4p,$vie4p, $comS4p, $comT4p;
printf STAT "4.00 --------".$format, $g4, $vts4, $vie4, $comS4, $comT4;
printf STAT "3.01 to 3.99 ".$format, $g3p,$vts3p,$vie3p, $comS3p, $comT3p;
printf STAT "3.00 --------".$format, $g3, $vts3, $vie3, $comS3, $comT3;
printf STAT "2.01 to 2.99 ".$format, $g2p,$vts2p,$vie2p, $comS2p, $comT2p;
printf STAT "2.00 --------".$format, $g2, $vts2, $vie2, $comS2, $comT2;
printf STAT "1.01 to 1.99 ".$format, $g1p,$vts1p,$vie1p, $comS1p, $comT1p;
printf STAT "1.00 --------".$format, $g1, $vts1, $vie1, $comS1, $comT1;
printf STAT "x.xx --------".$format, $nG, 0, $vienG, 0, 0;;
print STAT "\n";
print STAT "votes submissions\n";
print STAT "====================\n";
print STAT "0 $nG\n";
for(1..$#votes)
{
print STAT $_," ",$votes[$_],"\n" if $votes[$_]
}
print STAT "\n";
print STAT "comments submissions\n";
print STAT "=======================\n";
for(0..$#comments)
{
print STAT $_," ",$comments[$_],"\n" if $comments[$_]
}
print STAT "\n";
print STAT "views/500 submissions\n";
print STAT "========================\n";
for(0..$#v500)
{
$lowR = 500*$_; $highR = $lowR + 499;
print STAT $lowR," to $highR --- ",$v500[$_],"\n"
if $v500[$_]
}
print STAT "\n";
print STAT "views/100 submissions\n";
print STAT "========================\n";
for(0..$#v100)
{
$lowR = 100*$_; $highR = $lowR + 99;
print STAT $lowR,," to $highR --- ",$v100[$_],"\n" if $v100[$_]
}
Last edited: