Pages: [1]
  Print  
Author Topic: New script for the easy management of installed maps  (Read 3505 times)
SukkoPera
Ok i've posted twice!


Cakes 0
Posts: 2


Constructicons, combine and form Devastator


« on: February 04, 2010, 05:42:53 pm »

Ok, so, here's my contrib to OA.

A short story: I recently deployed a private OA server, so that my workmates and I can frag each other a bit even when we are not at work. Since we like to use more maps than the default ones, we gathered a lot from the net and put them on the server. Unfortunately it seemed there was no way to quickly generate a map rotation file for the OA server. Actually it would even be a pain just to get the names of all the installed maps.

So, I quickly hacked together my own script that scans for maps that are installed in the system and lists them. It can even generate .cfg files with all the maps of one ore more given types, shuffling their order. This way you can just have a base .cfg exec'ing the one containing the maplist, and change the latter very quickly.


Usage is as follows:

List all the installed maps, sorted alphabetically:
$ oamaps.py -m

Generate a .cfg including all the FFA and CTF maps:
$ oamaps -o my-maps.cfg -t ffa,ctf

The above command will shuffle the maps by default. If you want them sorted (alphabetically), add "-s". In this case you can also add "-r" if you want to randomize at least the starting map.

If you want to know all the possible types of the installed maps, run:
$ oamaps.py -t

There is also a "-a" option that will output a series of "<type>-maps.cfg", each one rotating all the maps of a given type. Some types (i.e. those starting with "ut_") are ignored in this case.

Lastly, you can even get a (short) online help:
$ oamaps.py -h


I guess there is a lot of space for improvements, so feel free to give suggestions.


*** IMPORTANT ***

By default, the script will only look in /usr/share/games/openarena/baseoa and in ~/.openarena/baseoa, as this is where I keep my maps. If you keep your maps in a different directory, just add it in the script (open it in a text editor and search for "DEFAULT_MAPDIRS", you'll understand what you will have to do...). This will be improved later on, if somebody reports the most commonly used paths.

The script is written in Python 2.5 and tested under GNU/Linux. It seems to work on MacOS X as well. No testing was performed under Windows.


I hope you find this script useful. Please note that I had no idea of how OA maps were structured, so the parsing might be silly or wrong at all.
Logged
Udi
Member


Cakes 25
Posts: 536


i do my own stunts


WWW
« Reply #1 on: February 05, 2010, 12:45:44 am »

Cool script, thanks for contributing Cheesy! What license do you have in mind, GPLv2 or something else?

I've tested on Windows, it works fine. Please add the os.path.expanduser ("~/Application Data/OpenArena/baseoa") entry to DEFAULT_MAPDIRS, that's the folder where OA stores the files on Windows. An optional -i and --input option would come handy, since there could be some esoteric install folders out there. I have the unified package on an NTFS partition so I can access it from both Windows and Linux, I use a localized foldername for games and on the top I have the version number in the foldername: c:\Játékok\openarena-0.8.5\baseoa and /mnt/windows/Játékok/openarena-0.8.5/baseoa/. I think you cannot be prepared for such layouts Smiley.
Logged

http://udionline.hu/en/projektek/openarena/
Todo list: 1. q3dm17 textures replacement (95% done)
SukkoPera
Ok i've posted twice!


Cakes 0
Posts: 2


Constructicons, combine and form Devastator


« Reply #2 on: February 05, 2010, 01:57:43 am »

I forgot to mention in the post above (but the header of the script should say it) that the script can be considered public domain.

Thanks for the testing on Windows and for reporting those paths, I will surely add them in the next version Smiley.
Logged
Gig
In the year 3000
***

Cakes 45
Posts: 4374


WWW
« Reply #3 on: July 06, 2010, 02:20:37 am »

SukkoPera, did you then do the second version?
Logged

I never want to be aggressive, offensive or ironic with my posts. If you find something offending in my posts, read them again searching for a different mood there. If you still see something bad with them, please ask me infos. I can be wrong at times, but I never want to upset anyone.
Pages: [1]
  Print  
 
Jump to: