Nice, although you can extract more interesting data than
that with Seti's XML interface. I have a couple of quick
and nasty scripts that return information on your standings.
The first script gives your individual rank, the second script shows the status of the team of your choice. Enjoy.
getstat.pl (single user)
#!/usr/bin/perl -w
# ====================================================================
+==
# Project: Seti@Home
# Project Leader: Peter Wise
# --------------------------------------------------------------------
+--
# Program name: GetStat
# Program state: pre-alpha
# Program notes: Pull stats on a seti user using XML interface
#
# Program filename: getstat.pl
# --------------------------------------------------------------------
+--
# Version Author Date Comment
# ~~~~~~~~ ~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~
# 1.0 P.J.Wise 10/02/2003 Initial version
#
# --------------------------------------------------------------------
+--
# CVS:
# ID: $Id: getstat.pl,v 1.1 2003/02/10 02:32:04 peter Exp $
# Author: $Author: peter $
# Date: $Date: 2003/02/10 02:32:04 $
# Revision: $Revision: 1.1 $
#
# --------------------------------------------------------------------
+--
# Notes:
# ~~~~~~
#
# ====================================================================
+==
use strict;
use LWP::Simple qw/get/;
use XML::Simple;
use Data::Dumper;
#Config
my $TARGET_EMAIL = $ARGV[0] || 'youremail@yourdomain';
my $TARGET_URL = "http://setiathome.ssl.berkeley.edu/fcgi-bin/fcgi?cmd
+=user_xml&email=$TARGET_EMAIL";
print "Getting data from server...";
if ( my $data = get($TARGET_URL)){
print "Done\nProcessing...";
my $ref_data = XMLin($data);
print "Done\n\n";
print "Number of Results: $ref_data->{userinfo}{numresults}\n"
+;
print " Last Result: $ref_data->{userinfo}{lastresulttime
+}\n";
print " Rank: $ref_data->{rankinfo}{rank} / $ref_d
+ata->{rankinfo}{ranktotalusers} (". (100-$ref_data->{rankinfo}{top_r
+ankpct})."%)\n";
}else{
print "Failed\n";
}
getstats.pl (team info)
#!/usr/bin/perl -w
# ====================================================================
+==
# Project: Seti@Home
# Project Leader: Peter Wise
# --------------------------------------------------------------------
+--
# Program name: GetStats
# Program state: pre-alpha
# Program notes: Pull stats on a seti user using XML interface
#
# Program filename: getstats.pl
# --------------------------------------------------------------------
+--
# Version Author Date Comment
# ~~~~~~~~ ~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~
# 1.0 P.J.Wise 10/02/2003 Initial version
#
# --------------------------------------------------------------------
+--
# CVS:
# ID: $Id: getstats.pl,v 1.1 2003/02/10 02:32:04 peter Exp $
# Author: $Author: peter $
# Date: $Date: 2003/02/10 02:32:04 $
# Revision: $Revision: 1.1 $
#
# --------------------------------------------------------------------
+--
# Notes:
# ~~~~~~
#
# ====================================================================
+==
use strict;
use LWP::Simple qw/get/;
use XML::Simple;
use Data::Dumper;
#Config
my $TARGET_NAME= $ARGV[0] || 'YourTeamNameHere';
my $TARGET_URL = "http://setiathome.ssl.berkeley.edu/fcgi-bin/fcgi?cmd
+=team_lookup_xml&name=$TARGET_NAME";
$= = 20;
my ($nnn,$ccc,$rrr);
format STDOUT_TOP =
Stats
Pos. Name Results
-------------------------------------------------------------------
.
format STDOUT =
@>> @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @>>>>>>>
$ccc, $nnn, $rrr
.
#print "Getting data from server...";
if ( my $data = get($TARGET_URL)){
#print "Done\nProcessing...";
my $ref_data = XMLin($data);
#print "Done\n\n";
my $members = $ref_data->{topmembers}{member};
my $count = 0;
foreach my $name (sort {$members->{$b}{numresults}<=>$members-
+>{$a}{numresults}} keys %$members){
$count++;
$nnn = $name;
$ccc = $count;
$rrr = $members->{$name}{numresults};
write();
}
}else{
print "Failed\n";
}
_______________________________________________________
Remember that amateurs built Noah's Ark. Professionals built the Titanic.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|