Major refactor to make handling name/path manipulation easier.
Most of this is now in doom_base.py, which stores wad/map/name, exposes them as properties, and also takes care of most common tasks needed for building command lines and such.
This commit is contained in:
parent
85d3686f1c
commit
2438995093
11 changed files with 113 additions and 100 deletions
15
dcc/dsda.py
15
dcc/dsda.py
|
@ -14,15 +14,14 @@ class DSDA(dcc.doom_base.WadMap):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
dip = dcc.config.DemoInPath(parsed_args.wad, parsed_args.map, parsed_args.name)
|
||||
dtp = dcc.config.DsdaTextPath(parsed_args.wad, parsed_args.map, parsed_args.name)
|
||||
dip = self.demo_in_path()
|
||||
dtp = self.dsda_text_path()
|
||||
if not dtp.exists():
|
||||
command = [dcc.config.DSDA]
|
||||
if shutil.which("xvfb-run") is not None:
|
||||
command = ["xvfb-run"] + command
|
||||
# TODO: negative tics should seek from the end, but this doesn't seem to work.
|
||||
subprocess.run(command +
|
||||
dcc.config.DsdaPreamble(parsed_args.wad, parsed_args.map) +
|
||||
subprocess.run(command + self.dsda_preamble() +
|
||||
["-fastdemo", dip, "-nosound", "-skiptic", "999999999", "-export_text_file"])
|
||||
editor = "nano"
|
||||
if "EDITOR" in os.environ:
|
||||
|
@ -31,11 +30,11 @@ class DSDA(dcc.doom_base.WadMap):
|
|||
if parsed_args.abbreviation:
|
||||
fh1 = parsed_args.abbreviation
|
||||
if not parsed_args.single:
|
||||
fh1 += parsed_args.map
|
||||
fh1 += self.map
|
||||
else:
|
||||
fh1 = parsed_args.wad[0:2] + parsed_args.map
|
||||
fh1 = self.wad[0:2] + self.map
|
||||
if parsed_args.single:
|
||||
fh1 = parsed_args.wad[0:min(len(parsed_args.wad), 4)]
|
||||
fh1 = self.wad[0:min(len(self.wad), 4)]
|
||||
fh2 = ""
|
||||
with open(dtp, mode="r") as f:
|
||||
for line in f:
|
||||
|
@ -52,6 +51,6 @@ class DSDA(dcc.doom_base.WadMap):
|
|||
|
||||
# TODO: demo names other than uv-max.
|
||||
fnf = fh1 + "-" + fh2 + ".zip"
|
||||
with zipfile.ZipFile(dcc.config.DEMOS.joinpath(parsed_args.wad).joinpath(fnf), mode="w") as zf:
|
||||
with zipfile.ZipFile(dcc.config.DEMOS.joinpath(self.wad).joinpath(fnf), mode="w") as zf:
|
||||
zf.write(dip, arcname=dip.name)
|
||||
zf.write(dtp, arcname=dtp.name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue