Compare commits
4 commits
6aaa3ea15f
...
e4c5c8b475
Author | SHA1 | Date | |
---|---|---|---|
e4c5c8b475 | |||
70e1a3a39e | |||
1ee4ea4dc6 | |||
7925281ceb |
6 changed files with 88 additions and 42 deletions
|
@ -11,8 +11,8 @@ class Base(Command):
|
|||
def get_parser(self, prog_name):
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--doom', default=pathlib.Path.home().joinpath("doom"))
|
||||
parser.add_argument('--config-name', default='config.toml')
|
||||
"--doom", default=pathlib.Path.home().joinpath("doom"))
|
||||
parser.add_argument("--config-name", default="config.toml")
|
||||
return parser
|
||||
|
||||
def init_base(self, parsed_args):
|
||||
|
|
|
@ -10,7 +10,7 @@ import tomlkit
|
|||
class Wad(dcc.config.Base):
|
||||
def get_parser(self, prog_name):
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument('wad')
|
||||
parser.add_argument("wad")
|
||||
return parser
|
||||
|
||||
def wad_init(self, parsed_args):
|
||||
|
@ -53,7 +53,7 @@ class Wad(dcc.config.Base):
|
|||
def load_order(self):
|
||||
wads = self._config.get("load_order")
|
||||
if wads is None:
|
||||
wads = sorted(self.pwad_path.glob('*.wad', case_sensitive=False))
|
||||
wads = sorted(self.pwad_path.glob("*.wad", case_sensitive=False))
|
||||
else:
|
||||
wads = [self.pwad_path.joinpath(wad) for wad in wads]
|
||||
return wads
|
||||
|
@ -73,8 +73,8 @@ class Wad(dcc.config.Base):
|
|||
class WadMap(Wad):
|
||||
def get_parser(self, prog_name):
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument('map')
|
||||
parser.add_argument('-n', '--name', '--demo_name')
|
||||
parser.add_argument("map")
|
||||
parser.add_argument("-n", "--name", "--demo_name")
|
||||
return parser
|
||||
|
||||
def run(self, parsed_args):
|
||||
|
@ -92,20 +92,21 @@ class WadMap(Wad):
|
|||
def name_string(self):
|
||||
return "" if self._name is None else "_" + self._name
|
||||
|
||||
def dsda_preamble(self):
|
||||
def dsda_preamble(self, warp=True):
|
||||
args = ["-iwad", self.iwad_path]
|
||||
|
||||
wads = self.load_order()
|
||||
if len(wads) > 0:
|
||||
args = args + ["-file"] + wads
|
||||
|
||||
dehs = sorted(self.pwad_path.glob('*.deh', case_sensitive=False))
|
||||
dehs = sorted(self.pwad_path.glob("*.deh", case_sensitive=False))
|
||||
if len(dehs) > 0:
|
||||
args = args + ["-deh"] + dehs
|
||||
|
||||
args = args + ["-complevel", str(self.complevel())]
|
||||
args = args + ["-skill", "4"]
|
||||
args = args + ["-warp", self.map]
|
||||
if warp:
|
||||
args = args + ["-warp", self.map]
|
||||
args = args + self.options()
|
||||
return args
|
||||
|
||||
|
|
|
@ -21,12 +21,10 @@ class DSDA(dcc.doom_base.WadMap):
|
|||
command = [self.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 + self.dsda_preamble() + [
|
||||
"-fastdemo", dip, "-nosound", "-skiptic",
|
||||
"999999999", "-export_text_file"
|
||||
command + self.dsda_preamble(warp=False) + [
|
||||
"-fastdemo", dip, "-nosound",
|
||||
"-skiptic", "-1", "-export_text_file"
|
||||
]
|
||||
)
|
||||
editor = "nano"
|
||||
|
|
|
@ -59,6 +59,8 @@ class Fetch(dcc.config.Base):
|
|||
if fetcher_path is None:
|
||||
raise Exception(f"Fetch util {fetcher} not found on PATH.")
|
||||
|
||||
proc = subprocess.run([fetcher_path, url], capture_output=True, check = True)
|
||||
proc = subprocess.run(
|
||||
[fetcher_path, url],
|
||||
capture_output=True, check=True
|
||||
)
|
||||
return json.loads(proc.stdout)
|
||||
|
||||
|
|
44
dcc/rib.py
Normal file
44
dcc/rib.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
import dcc.doom_base
|
||||
import pathlib
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
|
||||
class RIB(dcc.doom_base.WadMap):
|
||||
def get_parser(self, prog_name):
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument("-s", "--secs_before", default=10)
|
||||
return parser
|
||||
|
||||
# TODO: the root path should probably be configurable.
|
||||
def take_action(self, parsed_args):
|
||||
demo = ""
|
||||
dt = 0
|
||||
demodir = (
|
||||
pathlib.Path.home() /
|
||||
".dsda-doom" /
|
||||
"dsda_doom_data" /
|
||||
self.iwad_path.stem.lower()
|
||||
)
|
||||
for w in self.load_order():
|
||||
demodir = demodir.joinpath(w.stem.lower())
|
||||
demodir = demodir / "failed_demos"
|
||||
|
||||
for f in demodir.glob(f"*map{self.map}*", case_sensitive=False):
|
||||
st = os.stat(f)
|
||||
if st.st_mtime > dt:
|
||||
demo = f
|
||||
dt = st.st_mtime
|
||||
|
||||
if demo == "":
|
||||
raise Exception(
|
||||
f"no failed demos found for wad {parsed_args.wad} "
|
||||
+ f"and map {parsed_args.map} (tried to look in {demodir})"
|
||||
)
|
||||
|
||||
subprocess.run(
|
||||
[self.dsda] + self.dsda_preamble(warp=False)
|
||||
+ ["-playdemo", demo]
|
||||
+ ["-skiptic", str(-35 * parsed_args.secs_before)]
|
||||
)
|
51
setup.py
51
setup.py
|
@ -1,41 +1,42 @@
|
|||
from setuptools import find_packages
|
||||
from setuptools import setup
|
||||
|
||||
PROJECT = 'dcc'
|
||||
PROJECT = "dcc"
|
||||
|
||||
VERSION = '0.0.1'
|
||||
VERSION = "0.0.1"
|
||||
|
||||
long_description = ''
|
||||
long_description = ""
|
||||
|
||||
setup(
|
||||
name=PROJECT,
|
||||
version=VERSION,
|
||||
description='Doom Command Center',
|
||||
description="Doom Command Center",
|
||||
long_description=long_description,
|
||||
author='yrriban',
|
||||
author_email='yrriban@gmail.com',
|
||||
platforms=['Any'],
|
||||
install_requires=['cliff'],
|
||||
author="yrriban",
|
||||
author_email="yrriban@gmail.com",
|
||||
platforms=["Any"],
|
||||
install_requires=["cliff"],
|
||||
packages=find_packages(),
|
||||
include_package_data=True,
|
||||
entry_points={
|
||||
'console_scripts': ['dcc=dcc.main:main'],
|
||||
'dcc': [
|
||||
'play = dcc.play:Play',
|
||||
'record = dcc.record:Record',
|
||||
'fabricate = dcc.fabricate:Fabricate',
|
||||
'put = dcc.put:Put',
|
||||
'pb = dcc.pb:PB',
|
||||
'ss = dcc.ss:SS',
|
||||
'extract = dcc.extract:Extract',
|
||||
'fetch = dcc.fetch:Fetch',
|
||||
'text = dcc.text:Text',
|
||||
'thumb = dcc.thumb:Thumb',
|
||||
'dsda = dcc.dsda:DSDA',
|
||||
'eureka = dcc.eureka:Eureka',
|
||||
'ls = dcc.ls:List',
|
||||
'configure = dcc.configure:Configure',
|
||||
'concat = dcc.concat:Concat',
|
||||
"console_scripts": ["dcc=dcc.main:main"],
|
||||
"dcc": [
|
||||
"play = dcc.play:Play",
|
||||
"record = dcc.record:Record",
|
||||
"rib = dcc.rib:RIB",
|
||||
"fabricate = dcc.fabricate:Fabricate",
|
||||
"put = dcc.put:Put",
|
||||
"pb = dcc.pb:PB",
|
||||
"ss = dcc.ss:SS",
|
||||
"extract = dcc.extract:Extract",
|
||||
"fetch = dcc.fetch:Fetch",
|
||||
"text = dcc.text:Text",
|
||||
"thumb = dcc.thumb:Thumb",
|
||||
"dsda = dcc.dsda:DSDA",
|
||||
"eureka = dcc.eureka:Eureka",
|
||||
"ls = dcc.ls:List",
|
||||
"configure = dcc.configure:Configure",
|
||||
"concat = dcc.concat:Concat",
|
||||
],
|
||||
},
|
||||
zip_safe=False,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue