Automatically download the newest daily build

I fixed the updater exe yesterday morning before you reported the M link broke it since I had the same issue.
 
More 'M' versioned files are breaking the auto-downloaders again:

KoLmafia-10623M.jar
KoLmafia-10618M.jar
KoLmafia-10617M.jar

Thanks.
 
Code:
Buildfile: /home/kolmafia/svn/build.xml

clean:
  [symlink] Removing symlink: dist/KoLmafia-15.1/Applications


init:


update:
     [exec] U    /home/kolmafia/svn/src/net/sourceforge/kolmafia/session/ChoiceManager.java
     [exec] U    /home/kolmafia/svn/src/net/sourceforge/kolmafia/RequestEditorKit.java
     [exec] U    /home/kolmafia/svn/src/net/sourceforge/kolmafia/request/GenericRequest.java
     [exec] Updated to revision 10634.


svn-version:


gitsvn-version:


version:
     [echo] Current revision: 10634M


daily:


init:


jikeshome:


javahome:
     [exec] java version "1.6.0_26"
     [exec] Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
     [exec] Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)


compile:
     [echo] Using modern compiler
    [javac] Compiling 70 source files to /home/kolmafia/svn/build
     [copy] Copying 10 files to /home/kolmafia/svn/build
     [copy] Copied 3 empty directories to 1 empty directory under /home/kolmafia/svn/build


svn-version:


gitsvn-version:


version:
     [echo] Current revision: 10634M
    [javac] Compiling 684 source files to /home/kolmafia/svn/build


svn-version:


gitsvn-version:


unversion:
     [copy] Copying 137 files to /home/kolmafia/svn/build
      [jar] Building jar: /home/kolmafia/svn/dist/KoLmafia-10634M.jar


BUILD SUCCESSFUL
Total time: 12 seconds

Not sure why it's not getting cleared out, will take a look into it.
 
See my other note. Delete /home/kolmafia/svn/src/net/sourceforge/kolmafia/KoLConstants.java and try again. In fact, it would not hurt if your build script always did that before building.
 
I have made a perl script to download the latest hourly build for me. This script was written for unix type system but should work on windows ( the chmod line is not needed on windows) this script needs the www:Mechanize package installed.

#!/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 = $mech->links();

foreach my $link (@links) {
if ( $link->url =~ m/.*.jar$/ ) {
my $downloadurl = $link->url();
my $downloadlink = WWW::Mechanize->new();
$downloadlink->get ($downloadurl) or die "unable to find $downloadurl for download";
$downloadlink->save_content("kol.jar") or die "Could't save kol.jar file";
chmod(0755, "kol.jar") or die "Couldn't chmod kol.jar: $!";
last;
}

}
 
I have made a perl script to download the latest hourly build for me. This script was written for unix type system but should work on windows ( the chmod line is not needed on windows) this script needs the www:Mechanize package installed.
(code removed to save space)
This is interesting! I didn't realize a KoLmafia updater was even possible to do with Perl. Thanks for sharing!
 
one of my die statments caused some issues here is the revised 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 = $mech->links();

foreach my $link (@links) {
if ( $link->url =~ m/.*.jar$/ ) {
my $downloadurl = $link->url();
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: $!";
last;
}

}
 
Catch-22: Agreed, perl can be very hard to read at times, but something like this downloader is simple enough to understand what is going on.
 
one of my die statments caused some issues here is the revised 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 = $mech->links();

foreach my $link (@links) {
if ( $link->url =~ m/.*.jar$/ ) {
my $downloadurl = $link->url();
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: $!";
last;
}

}

Tried this on my ubuntu PC, and got:

Code:
Can't locate WWW/Mechanize.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at update.pl line 5.
BEGIN failed--compilation aborted at update.pl line 5.

I've literally never used perl so I'm not really aware of what that means. Any advice, anyone?
 
@heeheehee Sorry I missed that part.

I have been using this script on both linux and windows for a few weeks now.
(on windows install strawberry perl from http://strawberryperl.com/, create a new text file, paste the script inside and name it kol-download.pl, put this file where you want kol to be downloaded to then double click it.)
 
The change to the daily builds page seems to have broken this. I really hope you are able to fix it, so much easier to update mafia using this.
 
Oh, I see. Someone with a C# compiler could probably recompile this after changing the line
Code:
List<string> split = new List<string>(line.Split("\"\"".ToCharArray())).FindAll(s => s.Contains("http://builds.kolmafia.us/KoLmafia-"));
to split on "'" instead of "\"".

edit: I made this change, compiled with Mono's C# compiler under Linux. I've never written a line of C# before, so hopefully it doesn't crash and burn.

https://dl.dropboxusercontent.com/u/7601303/KoLMafiaUpdate.exe
 
Last edited:
Well, the post 79 version still doesn't find or download any new builds for me, even after deleting my KoLmafia-15749.jar file...
 
Back
Top