Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Tracking Utility/Mod Versions  (Read 2146 times)

salithus

  • Bay Watcher
  • gottagofast
    • View Profile
Tracking Utility/Mod Versions
« on: September 02, 2014, 10:35:38 am »

Sorry for the crosspost, but no bites so far in my thread in the modding forum. Any ideas/guidance from the Wiki folks?

Before I go much further down this rabbit hole - has anyone done any work on tracking the "current" version of a give module/graphics pack/utility?

I've put together the following so far and think it might work if I can get adoption of it, but there's also got to be a better way of doing it:

1) http://dwarffortresswiki.org/index.php/Template:Salithus defines the start of a template for utlity/module/whatever info. It accepts a title, updated, and version param right now.
2) If version isn't specified, it'll check the current location /version to grab that value:

Examples:
http://dwarffortresswiki.org/index.php/Sandbox:Test
http://dwarffortresswiki.org/index.php/Sandbox:Test/version

http://dwarffortresswiki.org/index.php/User:Salithus
http://dwarffortresswiki.org/index.php/User:Salithus/version

Next up: http://dwarffortresswiki.org/index.php/Sandbox:Test/version?action=raw gives me a string I can parse to check the version and compare to a currently installed version.

However, I know there is some kind of voodoo going on with how Raws are displayed via templates.

Any pointers here, or better ways to do this?
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: Tracking Utility/Mod Versions
« Reply #1 on: September 02, 2014, 02:26:28 pm »

I'm not sure what exactly you're looking for, but it sounds like a centralized place to store information about utilities. This should be possible (possibly easier with an extension), although I'm not sure how much of a bandwidth issue it'll be.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

salithus

  • Bay Watcher
  • gottagofast
    • View Profile
Re: Tracking Utility/Mod Versions
« Reply #2 on: September 02, 2014, 02:36:18 pm »

I'm not sure what exactly you're looking for, but it sounds like a centralized place to store information about utilities. This should be possible (possibly easier with an extension), although I'm not sure how much of a bandwidth issue it'll be.
Yep, exactly that, although for bandwidth concerns I planned to set up a hosted service that caches the wiki information periodically (once a day or so?) so that clients don't hammer the wiki.

Right now I've got a thing that checks http://www.bay12games.com/dwarves/dev_release.rss and strips out the version # for it to compare to a current version # and determine if it's time to upgrade. At a high level, I'm setting up an architecture to take a given utility (ie QuickFort) and have it specify "somewhere" a latest version, min df compatible version, and max df compatible version. Then when DF can upgrade, prompt the user and notify them which ones will automatically get disabled (DF version > utility max df compatible version) and automatically download/unzip/etc.

Mostly a exercise to deepen some of my programming skills (C# developer by trade) so it's entirely possible nothing comes of this, but I at least have the "get the latest DF" working.
Logged

salithus

  • Bay Watcher
  • gottagofast
    • View Profile
Re: Tracking Utility/Mod Versions
« Reply #3 on: September 02, 2014, 11:27:28 pm »

Ok, made some progress with it, so it's now time to get the wiki gods' blessing on this. The idea is to set up an Azure Web Job to run daily (hourly if you really love me) with something similar to this:

Code: [Select]
using (HttpClient c = new HttpClient())
{
c.BaseAddress = new Uri("http://dwarffortresswiki.org/");
c.DefaultRequestHeaders.Add("user-agent", "salithus (salithus@goonbase.com)");
try
{
var r = c.GetStringAsync(@"api.php?action=query&list=embeddedin&eititle=Template:Salithus&format=json");
var d = JsonConvert.DeserializeObject<ApiRequestRoot>(r.Result);
foreach (var p in d.Query.EmbeddedPages)
{
var r2 = c.GetStringAsync(string.Format(@"index.php/{0}/version?action=raw", p.Title));
//Parse version string and store with p.Title in website database.
}
}
catch (HttpRequestException hre)
{
Console.WriteLine(hre.Message);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}

This will keep the load off the wiki while still making it a good place to store version information about utilities. We'd replace of course the Template name with one standardized for Utilities. There's one there now (Template:Utility) so I can expand off of that one if they want.

What I don't know how to do is pull multiple values off of, say, a /utilityinfo page, so right now this approach would be limited to using it for tracking versions of the utilities themselves, although I'd like the template to include the following:

  • Title
  • Version
  • Last Updated
  • Minimum DF Version
  • Maximum DF Version
  • Contributors
  • Forum Support Thread/Link
  • Forum Development Thread/Link

fake edit: also I saw your move of the pages. I can't remember how I ended up in that namespace but I think it was something Wikimedia recommended. If I find it again I'll let you know, but I'm good with not doing things there again :)
« Last Edit: September 02, 2014, 11:33:20 pm by salithus »
Logged