Automatically download the newest daily build

Probably because I didn't make the change before compiling. Oops.

Try redownloading? Just tested with wine, seemed to work fine.
 
Sooo, just noticed that he latest builds have not been actually downloading.
Code:
---------------
4/12/2015 7:09:16 AM
Checking http://builds.kolmafia.us/ for the latest version of KoLMafia...
KoLmafia-15739.jar is the latest version
Attempting to download http://builds.kolmafia.us/KoLmafia-15739.jar...
Successfully downloaded http://builds.kolmafia.us/KoLmafia-15739.jar
Copying KoLmafia-15739.jar to KoLmafia-latest.jar
Deleting old version KoLmafia-15737.jar
Running KoLmafia-latest.jar...
---------------
---------------
4/20/2015 7:35:08 AM
Checking http://builds.kolmafia.us/ for the latest version of KoLMafia...
Running KoLmafia-latest.jar...
---------------

I took a few days off from playing thus the gap between attempts.
I tried downloading the program from the first post and I am getting a 404 error...
 
This morning's download was corrupted. The file was ~ 4MB not the typical ~12 MB.

Not sure if the repository for Mafia has a truncated / bad file.

Just got my coffee, so haven't done much poking yet in the forums. :-)
 
Must have been a transient issue, the last copy worked fine.

D:\Games\KoL>KoLMafiaUpdate.exe -d -o
---------------
11/29/2015 20:27:20
Checking http://builds.kolmafia.us/ for the latest version of KoLMafia...
KoLmafia-16497.jar is the latest version
Attempting to download http://builds.kolmafia.us/KoLmafia-16497.jar...
Successfully downloaded http://builds.kolmafia.us/KoLmafia-16497.jar
Copying KoLmafia-16497.jar to KoLmafia-latest.jar
---------------

D:\Games\KoL>TIME /T
20:28

D:\Games\KoL>PAUSE
Press any key to continue . . .
 
So people are aware i have updated the perl script as it was not working. Here is the latest code. still need WWW::Mechanize

Code:
#!/usr/bin/perl
use strict;
use warnings;

use WWW::Mechanize;

my $url = "http://builds.kolmafia.us/";

my $mech = WWW::Mechanize->new();

$mech->get( $url );
my @links = sort( $mech->content =~ m/http:\/\/builds.kolmafia.us\/KoLmafia-[0-9]+.jar/g);
my $downloadurl = pop @links;

print $downloadurl;
my $downloadlink = WWW::Mechanize->new();
$downloadlink->get ($downloadurl) or die "unable to find $downloadurl for download";
$downloadlink->save_content("kol.jar");
chmod(0755, "kol.jar") or die "Couldn't chmod kol.jar: $!";
 
Any chance of getting this updated to use the new automatic build site, or do I need to finally move to a different tool?
 
Looking at the code, updating this Perl script should be easy, assuming you know Perl, which I don't :(
Code:
#!/usr/bin/perl
use strict;
use warnings;

use WWW::Mechanize;

my $url = "http://ci.kolmafia.us/job/Kolmafia/lastSuccessfulBuild/artifact/dist/";

my $mech = WWW::Mechanize->new();

$mech->get( $url );
my @links = sort( $mech->content =~ m/KoLmafia-[0-9]+.jar/g);
my $downloadurl = "http://ci.kolmafia.us/job/Kolmafia/lastSuccessfulBuild/artifact/dist/" . pop @links;

print $downloadurl;
my $downloadlink = WWW::Mechanize->new();
$downloadlink->get ($downloadurl) or die "unable to find $downloadurl for download";
$downloadlink->save_content("kol.jar");
chmod(0755, "kol.jar") or die "Couldn't chmod kol.jar: $!";

Anyone have access to the C# code that was posted in the OP?
 
Futureproofing: change the "my @links = ..." line into
Code:
sub by_number {
    my ( $anum ) = $a =~ /(\d+)/;
    my ( $bnum ) = $b =~ /(\d+)/;
    ( $anum || 0 ) <=> ( $bnum || 0 );
}
my @links = sort by_number $mech->content =~ m/KoLmafia-[0-9]+.jar/g;

(otherwise you will keep getting r9999 until r99990 is released)
 
Actually, you'd only get r9999 until a new build (with the old system, that'd be "until r9999 gets kicked off the bottom of the list").

Doesn't affect me either way, since I just build from svn.
 
Then maybe it shouldn't be
Code:
my @links = sort( $mech->content =~ m/KoLmafia-[0-9]+.jar/g);
my $downloadurl = "http://ci.kolmafia.us/job/Kolmafia/lastSuccessfulBuild/artifact/dist/" . pop @links;
but
Code:
$mech->content =~ m/(KoLmafia-[0-9]+.jar)/
my $downloadurl = "http://ci.kolmafia.us/job/Kolmafia/lastSuccessfulBuild/artifact/dist/$1";
to make it obvious that there should be only one jar link in the page, and anything else is an unexpected change?
 
Anyone have access to the C# code that was posted in the OP?

Amusingly, I think you were the one in post 79 who most recently compiled a working copy - the 2012 version stopped working back in 2015 and you compiled and Dropboxed a new working executable.
 
Back
Top