Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seti Stats

Status
Not open for further replies.

houtek

Programmer
Aug 14, 2001
8
US
Could you please take a look at and setistatsjs.pl (following) and see if you can tell me how to get it running again? Thank you very much!

#!/usr/bin/perl
#
#Seti Stat Grabber (JavaScript Output Version) V1.3 Copyright (c) 2002, James Battersby
#
#
# You must change YOUR-EMAIL-ADDRESS to be the Email address of the account registered
# with Seti@Home
#
#NOTE: All software is supplied "as is", with no guarantee offered or
#implied. While every effort has been made to ensure the correct operation of
#the software, no responsibility is accepted for any loss, damage or charges incurred
#which may arise from the use of this software. A virus scan has not been performed on
#the download files, you are advised to do this before running any of the software.
#Re-distribution of the software is permitted providing that
# I) no charge is made for it,
# II) it is distributed in exactly the same form as found on # III) you do not take any credit for it's production.
#
# V1.3 Changes - 13 July 2002
# Updated to cope with Seti URL change. Added URI include.
#
# V1.2 Changes
# Changed regular expression for total CPU time to work correctly with times less than
# and more than 1 year
#
# V1.1 Changes
# Changed to produce JavaScript output
#
# V1.0
# Initial URL grabber
#

use LWP::UserAgent;
use URI::URL;

$accountname='houtek@earthlink.net';

$hdrs = new HTTP::Headers(Accept=>'text/plain',User-Agent=>'SetiStatGrabber/1.3');
$url = new URI::URL('$req = new HTTP::Request(GET, $url, $hdrs);
$ua = new LWP::UserAgent;
$resp = $ua->request($req);
print "Content-type: application/x-javascript\n\n";
$totalusers = "0";
$unitsreturned = "0";
$cputime = "0";
$averagecputime = "0";
$lastreturned = "0";
$usersatrank = "0";
$beaten = "0";
$rank = "0";
if ($resp->is_success)
{
$test = $resp->content;
#Get the total number of users
$test =~ m/of <b>([0-9]+)<\/b>/;
$totalusers = $1;
#Get the number of units returned
$test =~ m/<td align=right>([0-9]+)<\/td>/;
$unitsreturned = $1;
#Get the total cpu time
$test =~ m/<td align=right>\s*(\d.+(years|min))<\/td>/;
$cputime = $1;
#Get the avarage cpu time
$test =~ m/<td align=right>(.+sec)<\/td>/;
$averagecputime = $1;
#Get the time the last unit was returned
$test =~ m/<td align=right>(... ... .+)<\/td>/;
$lastreturned = $1;
#Get the number of users at this rank
$test =~ m/rank: <b>(.+)<\/b>/;
$usersatrank = $1;
#Get the percentage of users beaten
$test =~ m/<b>(.+)%<\/b>/;
$beaten = $1;
#Get the current rank
$test =~ m/is: <b>(.+)<\/b>/;
$rank = $1;
}

print "totalusers = '",$totalusers,"'\n";
print "unitsreturned = '",$unitsreturned,"'\n";
print "cputime = '",$cputime,"'\n";
print "averagecputime = '",$averagecputime,"'\n";
print "lastreturned = '",$lastreturned,"'\n";
print "usersatrank = '",$usersatrank,"'\n";
print "beaten = '",$beaten,"'\n";
print "rank = '",$rank,"'\n";
 
I can get the stats on setiathome or setiathome2, however, the perl script fails either way. Thanks, H.
 
Then add an else statement that prints out the failure message. This will tell you what error setiathome is giving you.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top