fredreichbier / genie

A Python module to access Genie engine (Age of Empires, ...) files
BSD 2-Clause "Simplified" License
19 stars 5 forks source link

Combine `save` and `export` commands. #13

Closed phrohdoh closed 9 years ago

phrohdoh commented 9 years ago

Issue: They do the same thing from a user's standpoint. You could say save is a subcommand of export as it only deals with (interpreted) SLP data.

export   writes a file to disk
save     writes a frame to disk

Proposal: Combine the two as export but call the appropriate methods depending on the passed parameters.

Proposed examples: Filenames would be appended with N-of-M if frames=N is specified.

export 271.slp frames=* foo.slp       => write all frames to disk
export 271.slp frames=0,5[,n] foo.slp => writes only the specified frames to disk
export 271.slp foo.slp                => write entire file to disk
export 50500.bin foo.bin              => write entire file to disk
export 50500.bin frames=* foo.bin     => write entire file to disk, warn that `frames` is invalid

Any opinions / interjections before I spend a bit of time trying to implement this?

fredreichbier commented 9 years ago

I think you're right, from the user perspective they mostly do the same thing. However, from genie's perspective, they are pretty different, since export only uses the DRS parsing code, but save invokes the SLP parser. Personally, I feel like a unified interface to both functions might be a bit confusing. What do you think about just renaming save to saveframe, to make it more clear that they in fact to different things?

phrohdoh commented 9 years ago

I certainly see your point. That ought to be a fine change, but then I feel I'd be making a change for the sake of changing something, which I am not a fan of.

Closing as there is nothing more to do here.