[plugin] DownloadArchives

[plugin] DownloadArchives

SpringRTS Perl Autohost for Dedicated Server

Moderators: Moderators, Lobby Developers, SPADS AutoHost

Post Reply
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

[plugin] DownloadArchives

Post by Jools »

Here's an improvement of the DownloadArchives plugin: it now includes the following commands:

[quote]
[dlmap]
!dlmap <mapArchiveUrl> - downloads a map archive to the "maps" subdirectory of Spring data directory
"!dlmap http://springfiles.com/sites/default/fi ... egeDry.sd7" downloads map DeltaSiegeDry

[dlthismap]
!dlthismap - downloads current autohost selected map to the "maps" subdirectory of Spring data directory
"!dlthismap

[dlmod]
!dlmod <modArchiveUrl> - downloads a mod archive to the "games" subdirectory of Spring data directory
"dlmod http://springfiles.com/sites/default/fi ... /ba772.sdz" downloads Balanced Annihilation v7.72

[downloadmap]
!downloadmap <case sensitive mapname> - downloads a map archive to the "maps" subdirectory of Spring data directory
!downloadmap duck - downloads map 'duck' from rapid to the "maps" subdirectory of Spring data directory
!downloadmap Red Comet - downloads map 'Red Comet' from rapid to the "maps" subdirectory of Spring data directory

[downloadmod]
!downloadmod <case sensitive name of game> - downloads a game archive to the "games" subdirectory of Spring data directory
!downloadmod XTA 9.745 - downloads mod XTA 9.745 to the the "games" subdirectory of Spring data directory[/quote]

In other words you can use Map and Game names to download them from rapid. If it doesn't find the map or game it will just say the download failed—like before.

It also automatically looks for a map on rapid if the autohost doesn't have the current map (map changed and autohost is not synced). But currently this condition cannot happen since you cannot change a map to one that the autohost doesn't have. It will just respond with:
Could not find matching map for <mapname> in current map list
It would be ideal if it could try to download a map it doensn't have instead. Maybe the check could be done in prespadscommand but then you would have to call the set map command again...

Requirement for rapid downloading is for the autohost to have pr-downloader installed and working. It comes with spring but may need a bit of hassle to get working.
Last edited by Jools on 10 May 2015, 14:34, edited 1 time in total.
User avatar
bibim
Lobby Developer
Posts: 952
Joined: 06 Dec 2007, 11:12

Re: SPADS AutoHost

Post by bibim »

I didn't check the code of your plugin, but concerning the specifications, what do you think of reusing the same commands instead for simplification?

For example if dlMap is called with exactly one parameter and this parameter starts with "http://", then the map is downloaded directly from url like before.
In all other cases it uses rapid to find and download the map (if dlMap is called with no parameter then it uses current map name as parameter).

So all these calls would be valid:
!dlMap http://springfiles.com/sites/default/fi ... _Redux.sd7
!dlMap Comet Catcher Redux
!dlMap
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: SPADS AutoHost

Post by Jools »

bibim wrote:I didn't check the code of your plugin, but concerning the specifications, what do you think of reusing the same commands instead for simplification?

For example if dlMap is called with exactly one parameter and this parameter starts with "http://", then the map is downloaded directly from url like before.
In all other cases it uses rapid to find and download the map (if dlMap is called with no parameter then it uses current map name as parameter).

So all these calls would be valid:
!dlMap http://springfiles.com/sites/default/fi ... _Redux.sd7
!dlMap Comet Catcher Redux
!dlMap
Yes, I think that would be better, but I wanted to make changes to the plugin that don't "break" the old usage. But it would be easy to make it that way and I can do it.
User avatar
bibim
Lobby Developer
Posts: 952
Joined: 06 Dec 2007, 11:12

Re: SPADS AutoHost

Post by bibim »

Jools wrote:Yes, I think that would be better, but I wanted to make changes to the plugin that don't "break" the old usage. But it would be easy to make it that way and I can do it.
But the changes I proposed don't break the old usage, do they?
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: SPADS AutoHost

Post by Jools »

No, but I was just being conservative editing previous code.

Here is version 0.4, it also adds a dlengine command. Here's the content of help file for reference:
[dlmap]
!dlmap [<mapArchiveUrl | case sensitive modname>] -- downloads a map archive to the "maps" subdirectory of Spring data directory
!dlmap http://springfiles.com/sites/default/fi ... egeDry.sd7 -- downloads map DeltaSiegeDry
!dlmap duck -- downloads map 'duck' from rapid to the "maps" subdirectory of Spring data directory
!dlmap Red Comet -- downloads map 'Red Comet' from rapid to the "maps" subdirectory of Spring data directory
!dlmap red comet -- will fail because of wrong case in name.
!dlmap -- downloads current autohost selected map to the "maps" subdirectory of Spring data directory


[dlmod]
!dlmod <modArchiveUrl|case sensitive modname> -- downloads a mod archive to the "games" subdirectory of Spring data directory
!dlmod http://springfiles.com/sites/default/fi ... /ba772.sdz" -- downloads Balanced Annihilation v7.72
!dlmod XTA 9.745 -- downloads XTA 9.745 to the the "games" subdirectory of Spring data directory


[dlgame]
!dlgame <modArchiveUrl|case sensitive modname> -- downloads a mod archive to the "games" subdirectory of Spring data directory
!dlgame http://springfiles.com/sites/default/fi ... /ba772.sdz" -- downloads Balanced Annihilation v7.72
!dlgame XTA 9.745 -- downloads XTA 9.745 to the the "games" subdirectory of Spring data directory


[dlengine]
!dlengine <case sensitive name of game engine> -- downloads a game archive to the "engines" subdirectory of Spring data directory
!dlengine 98.0.1-353-gcae510f -- downloads engine called {develop}98.0.1-353-gcae510f_minimal-portable to the "engines" subdirectory of Spring data directory
It works quite nicely. It even checks if autohost already has map or a map with same name but wrong case. Rapid downloads are case sensitive so they will fail if you have wrong case. In this case it will just say the download failed.

I think it would be possible to check also for mods/games by calling unitsync, but I'm not really sure how to do it, but maybe it's not so important. Mods are not downloaded that often anyway.

The Regex

Code: Select all

=~ /\"/
tests if name has any quotation marks or just that it begins with "? I'm not completely sure but cannot map names have quotation marks? If they are made by some stupid guy? I tried with some online regex tester but it just highlights any " mark in the string.

Edit: Version 0.5 is a fix of a simple typo that caused dlengine command to crash.
Last edited by Jools on 10 May 2015, 14:32, edited 5 times in total.
User avatar
bibim
Lobby Developer
Posts: 952
Joined: 06 Dec 2007, 11:12

Re: SPADS AutoHost

Post by bibim »

Jools wrote:The Regex

Code: Select all

=~ /\"/
tests if name has any quotation marks or just that it begins with "?
It tests if it has any.
Jools wrote:I'm not completely sure but cannot map names have quotation marks? If they are made by some stupid guy?
This test is only needed when calling wget to download the map. If you download it with rapid you don't need it I guess.
Post Reply

Return to “SPADS AutoHost”