xmltv/grab/huro tv_grab_huro.in,1.49,1.50
Geoff <[email protected]>
| Newsgroups | gmane.comp.tv.xmltv.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/xmltv/xmltv/grab/huro
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv12832
Modified Files:
tv_grab_huro.in
Log Message:
(minor) revised star-rating procedure
Index: tv_grab_huro.in
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/huro/tv_grab_huro.in,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** tv_grab_huro.in 10 Apr 2014 16:05:16 -0000 1.49
--- tv_grab_huro.in 19 May 2014 13:16:38 -0000 1.50
***************
*** 1126,1129 ****
--- 1126,1136 ----
worker("ajax-parsing");
+
+ # get the "star-rating"
+ # The rating includes the number of votes. Testing for statistical significance calculates that, at
+ # a confidence level of .95, a population of 100 will give 70% confidence in the score being accurate
+ # (and is largely independent of population size).
+ # Therefore only output the rating where the population is > 100.
+ #
if (my $anchor = $ajaxtree->look_down(_tag=>"div", class=>qr/starholder/)) {
my $starsval;
***************
*** 1131,1147 ****
$starsval = $stars->as_text();
$starsval =~ s/,/./; $starsval += 0; # convert to float
- $prog->{q(star-rating)} = [[ sprintf("%.0f / 10", $starsval) ]];
}
- #
- # add another "star-rating" showing the number of votes (it doesn't really belong here but there's nowhere better)
- # - this gives a clue as to whether 0 means 'bad' or it simply means 'unrated'!
- #
if (my $votes = $anchor->look_down(_tag=>"div", class=>"votenum")) {
my $votesval = $votes->as_text();
if ($votesval) {
(my $num_votes) = $votesval =~ /(\d*)/;
! # if star-rating is 0 and num_votes is null then we'll assume it hasn't been voted on yet
! if ($starsval == 0 && $num_votes eq '') { undef $prog->{q(star-rating)} }
! push @{ $prog->{q(star-rating)} }, [ $num_votes, "votes" ] if $num_votes ne '';
}
}
--- 1138,1150 ----
$starsval = $stars->as_text();
$starsval =~ s/,/./; $starsval += 0; # convert to float
}
if (my $votes = $anchor->look_down(_tag=>"div", class=>"votenum")) {
my $votesval = $votes->as_text();
if ($votesval) {
(my $num_votes) = $votesval =~ /(\d*)/;
! # if number of votes is >100 then output the star-rating
! if ($num_votes ne '' && int($num_votes) > 100) {
! $prog->{q(star-rating)} = [[ sprintf("%.0f / 10", $starsval), "uservotes" ]];
! }
}
}
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs