View Single Post
  #8  
Old November 4th, 2006, 04:10 AM

Lollipop Lollipop is offline
Private
 
Join Date: Sep 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Lollipop is on a distinguished road
Default Re: Automatic backup of turn files

Quote:
PDF said:
Many thanks Lolly (can I call you that ? ) !
By way of an exception, cause you was brave enough to try my script

Quote:
Only small problem is that if Dom3 runs in fullscreen mode it's automatically minimized when executing the script... I suppose it's a Windowze thingie
Yes, it is. I doubt there's a way around


Quote:
Would it be easy to not only backup the last turn but also make a file history, I mean having subdirs with each turn's saves ? I know the game doesn't pass the turn numbers, so the utility should assume the player uses it by turn 1..
Just an idea, but it'll be cool
The script already does it, kind of. I was in a hurry when posting cause my boss was approaching and I wasn't supposed to work on a dom3 script.

1) create a 'archivedgames' directory in your dom3 directory.

2) modify the dom3 link to:
dom3.exe --scoredump --preexec 'python dom3backup.py -f 1'

The script parses scores.html to get the turn number (assumes turn 1, if not found) and creates a zipfile (name-Turn<turnnumber>.zip) every '-f <n>' turns (in archivedgames, optionally use the -d arg), with '-f 1' every turn.

You can limit the number of zip-files kept with '-m <n>', default is to keep all.

I hope this isn't too confusing.

Caveat: I haven't tested it under xp. The pyhton-doc says, that you need zlib (prob. not present) only, when deflating, so I used a simple store mechanism. But who knows..

Thanks for testing

Pia

Edit: Gnu zlib for XP is here. Change the line:

zipFile = ZipFile(zipName,'w')

to:
zipFile = ZipFile(zipName,'w',ZIP_DEFLATED)

Compression ratio is 1:10, not bad.
Reply With Quote