Compare commits
No commits in common. "e4c5c8b475d7da11d7eb7ab089b70d9d58e18f3c" and "6aaa3ea15f9ed6c004f64b9a327bb122169b2a11" have entirely different histories.
e4c5c8b475
...
6aaa3ea15f
6 changed files with 42 additions and 88 deletions
|
@ -11,8 +11,8 @@ class Base(Command):
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--doom", default=pathlib.Path.home().joinpath("doom"))
|
'--doom', default=pathlib.Path.home().joinpath("doom"))
|
||||||
parser.add_argument("--config-name", default="config.toml")
|
parser.add_argument('--config-name', default='config.toml')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def init_base(self, parsed_args):
|
def init_base(self, parsed_args):
|
||||||
|
|
|
@ -10,7 +10,7 @@ import tomlkit
|
||||||
class Wad(dcc.config.Base):
|
class Wad(dcc.config.Base):
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
parser.add_argument("wad")
|
parser.add_argument('wad')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def wad_init(self, parsed_args):
|
def wad_init(self, parsed_args):
|
||||||
|
@ -53,7 +53,7 @@ class Wad(dcc.config.Base):
|
||||||
def load_order(self):
|
def load_order(self):
|
||||||
wads = self._config.get("load_order")
|
wads = self._config.get("load_order")
|
||||||
if wads is None:
|
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:
|
else:
|
||||||
wads = [self.pwad_path.joinpath(wad) for wad in wads]
|
wads = [self.pwad_path.joinpath(wad) for wad in wads]
|
||||||
return wads
|
return wads
|
||||||
|
@ -73,8 +73,8 @@ class Wad(dcc.config.Base):
|
||||||
class WadMap(Wad):
|
class WadMap(Wad):
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
parser.add_argument("map")
|
parser.add_argument('map')
|
||||||
parser.add_argument("-n", "--name", "--demo_name")
|
parser.add_argument('-n', '--name', '--demo_name')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def run(self, parsed_args):
|
def run(self, parsed_args):
|
||||||
|
@ -92,21 +92,20 @@ class WadMap(Wad):
|
||||||
def name_string(self):
|
def name_string(self):
|
||||||
return "" if self._name is None else "_" + self._name
|
return "" if self._name is None else "_" + self._name
|
||||||
|
|
||||||
def dsda_preamble(self, warp=True):
|
def dsda_preamble(self):
|
||||||
args = ["-iwad", self.iwad_path]
|
args = ["-iwad", self.iwad_path]
|
||||||
|
|
||||||
wads = self.load_order()
|
wads = self.load_order()
|
||||||
if len(wads) > 0:
|
if len(wads) > 0:
|
||||||
args = args + ["-file"] + wads
|
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:
|
if len(dehs) > 0:
|
||||||
args = args + ["-deh"] + dehs
|
args = args + ["-deh"] + dehs
|
||||||
|
|
||||||
args = args + ["-complevel", str(self.complevel())]
|
args = args + ["-complevel", str(self.complevel())]
|
||||||
args = args + ["-skill", "4"]
|
args = args + ["-skill", "4"]
|
||||||
if warp:
|
args = args + ["-warp", self.map]
|
||||||
args = args + ["-warp", self.map]
|
|
||||||
args = args + self.options()
|
args = args + self.options()
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,12 @@ class DSDA(dcc.doom_base.WadMap):
|
||||||
command = [self.dsda]
|
command = [self.dsda]
|
||||||
if shutil.which("xvfb-run") is not None:
|
if shutil.which("xvfb-run") is not None:
|
||||||
command = ["xvfb-run"] + command
|
command = ["xvfb-run"] + command
|
||||||
|
# TODO: negative tics should seek from the end, but this doesn't
|
||||||
|
# seem to work.
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
command + self.dsda_preamble(warp=False) + [
|
command + self.dsda_preamble() + [
|
||||||
"-fastdemo", dip, "-nosound",
|
"-fastdemo", dip, "-nosound", "-skiptic",
|
||||||
"-skiptic", "-1", "-export_text_file"
|
"999999999", "-export_text_file"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
editor = "nano"
|
editor = "nano"
|
||||||
|
|
|
@ -59,8 +59,6 @@ class Fetch(dcc.config.Base):
|
||||||
if fetcher_path is None:
|
if fetcher_path is None:
|
||||||
raise Exception(f"Fetch util {fetcher} not found on PATH.")
|
raise Exception(f"Fetch util {fetcher} not found on PATH.")
|
||||||
|
|
||||||
proc = subprocess.run(
|
proc = subprocess.run([fetcher_path, url], capture_output=True, check = True)
|
||||||
[fetcher_path, url],
|
|
||||||
capture_output=True, check=True
|
|
||||||
)
|
|
||||||
return json.loads(proc.stdout)
|
return json.loads(proc.stdout)
|
||||||
|
|
||||||
|
|
44
dcc/rib.py
44
dcc/rib.py
|
@ -1,44 +0,0 @@
|
||||||
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,42 +1,41 @@
|
||||||
from setuptools import find_packages
|
from setuptools import find_packages
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
PROJECT = "dcc"
|
PROJECT = 'dcc'
|
||||||
|
|
||||||
VERSION = "0.0.1"
|
VERSION = '0.0.1'
|
||||||
|
|
||||||
long_description = ""
|
long_description = ''
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name=PROJECT,
|
name=PROJECT,
|
||||||
version=VERSION,
|
version=VERSION,
|
||||||
description="Doom Command Center",
|
description='Doom Command Center',
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
author="yrriban",
|
author='yrriban',
|
||||||
author_email="yrriban@gmail.com",
|
author_email='yrriban@gmail.com',
|
||||||
platforms=["Any"],
|
platforms=['Any'],
|
||||||
install_requires=["cliff"],
|
install_requires=['cliff'],
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
entry_points={
|
entry_points={
|
||||||
"console_scripts": ["dcc=dcc.main:main"],
|
'console_scripts': ['dcc=dcc.main:main'],
|
||||||
"dcc": [
|
'dcc': [
|
||||||
"play = dcc.play:Play",
|
'play = dcc.play:Play',
|
||||||
"record = dcc.record:Record",
|
'record = dcc.record:Record',
|
||||||
"rib = dcc.rib:RIB",
|
'fabricate = dcc.fabricate:Fabricate',
|
||||||
"fabricate = dcc.fabricate:Fabricate",
|
'put = dcc.put:Put',
|
||||||
"put = dcc.put:Put",
|
'pb = dcc.pb:PB',
|
||||||
"pb = dcc.pb:PB",
|
'ss = dcc.ss:SS',
|
||||||
"ss = dcc.ss:SS",
|
'extract = dcc.extract:Extract',
|
||||||
"extract = dcc.extract:Extract",
|
'fetch = dcc.fetch:Fetch',
|
||||||
"fetch = dcc.fetch:Fetch",
|
'text = dcc.text:Text',
|
||||||
"text = dcc.text:Text",
|
'thumb = dcc.thumb:Thumb',
|
||||||
"thumb = dcc.thumb:Thumb",
|
'dsda = dcc.dsda:DSDA',
|
||||||
"dsda = dcc.dsda:DSDA",
|
'eureka = dcc.eureka:Eureka',
|
||||||
"eureka = dcc.eureka:Eureka",
|
'ls = dcc.ls:List',
|
||||||
"ls = dcc.ls:List",
|
'configure = dcc.configure:Configure',
|
||||||
"configure = dcc.configure:Configure",
|
'concat = dcc.concat:Concat',
|
||||||
"concat = dcc.concat:Concat",
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue