Page 1 of 13 1 2 3 11 ... LastLast
Results 1 to 10 of 127

Thread: Automatically download the newest daily build

  1. #1
    Developer
    Join Date
    Apr 2006
    Posts
    884

    Default Automatically download the newest daily build

    I wrote a small console program that will automatically parse http://builds.kolmafia.us/ and download the latest daily build if it doesn't exist locally. You could set this as a scheduled task, but make sure you don't hammer the server looking for updates.

    The program will also create (or modify) the file KoLMafiaUpdate.log so you can review previous attempts at updating. Some sample log output:
    Code:
    ---------------
    10/28/2009 11:56:41 PM
    Checking http://builds.kolmafia.us/ for the latest version of KoLMafia...
    KoLmafia-7772.jar is the latest version
    Attempting to download http://builds.kolmafia.us/KoLmafia-7772.jar...
    Successfully downloaded http://builds.kolmafia.us/KoLmafia-7772.jar
    Copying KoLmafia-7772.jar to KoLmafia-latest.jar
    ---------------
    ---------------
    10/29/2009 12:02:51 AM
    Checking http://builds.kolmafia.us/ for the latest version of KoLMafia...
    KoLmafia-7772.jar is the latest version
    KoLmafia-7772.jar exists, you have the latest version
    ---------------

    http://dl.getdropbox.com/u/220774/KoLMafiaUpdate.exe

    http://dl.getdropbox.com/u/220774/KoLMafiaUpdate.cs

    These files are no longer available. See the attached files -- heeheehee


    Version 1.8 - Fix for not being able to parse the revision number because the filename has an M at the end. Also fixed the -h typo.
    Version 1.7 - Fix for the build links sorting by string instead of revision number.
    Version 1.6 - Add some additional exception handling.
    Version 1.5 - Only delete kolmafia jar files.
    Version 1.4 - Delete old .jars after updating. Passing in -d as a command line argument will disable this functionality.
    Version 1.3 - Open KoLmafia-latest.jar automatically. Passing in -o as a command line argument will disable this functionality.
    Version 1.2 - Don't copy if the download fails
    Version 1.1 - Automatically make a copy of the latest version as KoLmafia-latest.jar
    Version 1.0 - Release
    Attached Files
    Last edited by heeheehee; 03-23-2017 at 12:51 AM. Reason: Version 1.8

  2. #2
    Junior Member
    Join Date
    Jun 2007
    Posts
    8

    Default

    Very nice! On my computer I have a cron job set up to run this script once a day. It uses ant to download the source and compile from svn, then copies the .jar to my working dir and runs it for me. The beauty of this is it only downloads the changes to kolmafia so server hits are always low. I use xterm to run the .jar because it is tough to get a cron script to start something graphical, plus it gives me a terminal where I can see any errors that mafia may spew.

    Code:
    #!/bin/bash
    kol_dir=~/kol
    mafia_src=$kol_dir/kolmafia
    
    cd $mafia_src
    ant daily
    
    rm $kol_dir/daily.jar
    mv $mafia_src/dist/KoLmafia* $kol_dir/daily.jar
    
    xterm -display :0 -e "/usr/bin/java -jar $kol_dir/daily.jar"

  3. #3
    Developer
    Join Date
    Apr 2006
    Posts
    884

    Default

    Yeah that's also a good solution, but a lot of people probably don't want to have to set up everything necessary to compile the source.
    Automatically download the newest daily build - Version 1.8
    Better Basement Automation
    - Version 1.??? Someone else is maintaining this
    Get an effect from a buffbot
    - Version 1.4

  4. #4
    Senior Member
    Join Date
    Mar 2006
    Posts
    118

    Default

    I personally prefer to compile the .jar myself, but I can see an automated download process being very attractive to a lot of users.

  5. #5
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,481

    Default

    Cool!

    Any chance you could make this also run the newly downloaded mafia? Or in the case that it already exists, run that? It would be cool to have a single click automatically run the latest daily.
    Sig by JakAtk
    My scripts: Prefref Plus | One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  6. #6
    Developer
    Join Date
    Apr 2006
    Posts
    884

    Default

    Yeah that's actually pretty easy to do. One sec.

    Okay done, passing in -o as a command line argument will disable automatically starting the jar.
    Last edited by Rinn; 10-31-2009 at 06:07 AM.
    Automatically download the newest daily build - Version 1.8
    Better Basement Automation
    - Version 1.??? Someone else is maintaining this
    Get an effect from a buffbot
    - Version 1.4

  7. #7
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,481

    Default

    Thanks, this is awesome, I just ran it and it worked like a charm. A few things you should probably mention in your first post: 1) it's for Windows, 2) you need .NET 2.0, otherwise you get a "could not initialize properly" error, and 3) it should go in your mafia directory.

    EDIT: Just one other thing, and then I think it would be perfect. It would be nice not to have to regularly delete old builds. Could you add an option for deleting all other jar files in the directory other than the current daily and KoLmafia-latest? Either that, or an option for auto-deleting kolmafia-buildnum after copying it to kolmafia-latest... in which case instead of checking file.exists, you'd have to parse the log to see if the latest is really the latest. I think the first option is probably easier.
    Last edited by zarqon; 10-31-2009 at 08:16 AM.
    Sig by JakAtk
    My scripts: Prefref Plus | One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  8. #8
    Developer
    Join Date
    Apr 2006
    Posts
    884

    Default

    Yeah I can do that. I'd rather keep the copy of the latest version downloaded so you can know at a quick glance what version the latest.jar is without opening up the log, but deleting other .jars should be simple enough.
    Automatically download the newest daily build - Version 1.8
    Better Basement Automation
    - Version 1.??? Someone else is maintaining this
    Get an effect from a buffbot
    - Version 1.4

  9. #9
    Senior Member That FN Ninja's Avatar
    Join Date
    Jun 2009
    Location
    Right behind you!
    Posts
    372

    Default

    This is great. Thanks Rinn!
    TraFa - Training Familiars the Mafia way! queen_cookie.ash - Get your queen cookies.
    TurTa - Turtle Taming the Mafia way! hatter.ash - Mad Hatter buffs.
    DwaFa - Dwarven Factory puzzle solver.
    Miner - Automated ore mining.

  10. #10
    Developer
    Join Date
    Apr 2006
    Posts
    884

    Default

    Okay it'll delete old jar files now.
    Automatically download the newest daily build - Version 1.8
    Better Basement Automation
    - Version 1.??? Someone else is maintaining this
    Get an effect from a buffbot
    - Version 1.4

Similar Threads

  1. Getting the latest daily build
    By matt.chugg in forum Community Support
    Replies: 1
    Last Post: 11-21-2011, 04:19 AM
  2. Bug - Not A Bug Relay Browser won't open in newest Firefox build (6.0.2)
    By maximillian the red in forum Bug Reports
    Replies: 9
    Last Post: 09-14-2011, 01:14 PM
  3. Problems with the daily build
    By linguinelad in forum Unofficial Builds
    Replies: 5
    Last Post: 09-16-2010, 10:41 PM
  4. Using the daily build
    By Jt in forum Community Support
    Replies: 2
    Last Post: 12-06-2007, 01:06 AM
  5. Replies: 1
    Last Post: 06-02-2006, 02:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •