Compare commits

...

6 commits

Author SHA1 Message Date
16eb67c797 PEP 8 compliance. 2025-08-30 02:14:52 -04:00
789064aa0d List commands in main.py; stop depending on entry points.
Entry points are a major hassle to deal with during distribution and
this really isn't any worse than that.  Could probably be automated
further but I'd rather have something that works consistently.
2025-08-29 19:20:53 -04:00
8e48915a27 Fix import. 2025-08-29 19:20:28 -04:00
fb61d3d935 Be more particular about the ordering of videos.
This just hardcodes the default Doom 2 ordering of videos; this will
likely need further expansion in the future.
2025-08-29 19:19:36 -04:00
6815545da4 Update stub makefile. 2025-08-26 01:58:15 -04:00
026128473c Add a --stdin-only flag for text.py.
Typically this is for when we have configured map names but are making a
concatenated video and aren't using them.
2025-08-26 01:49:52 -04:00
6 changed files with 68 additions and 20 deletions

View file

@ -1,2 +1,2 @@
install:
cp venv/bin/dcc /home/tynan/.local/bin/dcc
cp dist/pyinstaller/manylinux_2_39_x86_64/dcc /home/tynan/.local/bin/dcc

View file

@ -1,6 +1,7 @@
import av
import copy
import dcc.doom_base
import enum
import fractions
import io
import logging
@ -9,6 +10,11 @@ import numpy as np
import wand.image
class State(enum.Enum):
NOT_STARTED = 1
STARTED = 2
DONE = 3
class Concat(dcc.doom_base.Wad):
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
@ -21,10 +27,7 @@ class Concat(dcc.doom_base.Wad):
logging.basicConfig()
av.logging.set_level(av.logging.VERBOSE)
av.logging.restore_default_callback()
videos = (
self.fabricate.joinpath(parsed_args.wad)
.glob(f"{parsed_args.wad}_map*.mp4")
)
videodir = self.fabricate.joinpath(parsed_args.wad)
fn_base = (
f"{parsed_args.wad}_maps{parsed_args.start_map}"
+ f"to{parsed_args.end_map}"
@ -45,19 +48,27 @@ class Concat(dcc.doom_base.Wad):
# unavailable" error when switching to inputs after the first.
# Presumably fixable, but it's easier to just make one graph per video
# and mux everything together at the end.
for v in sorted(videos):
# TODO: Support UDoom in literally any way.
if not (
v.name >= f"{parsed_args.wad}_map{parsed_args.start_map}.mp4"
and v.name <= f"{parsed_args.wad}_map{parsed_args.end_map}.mp4"
):
# TODO: Support UDoom in literally any way.
d2maps = [str(x).zfill(2) for x in range(1,16)] + ["31","32"] + [str(x) for x in range(16,31)]
state = State.NOT_STARTED
for idx in d2maps:
if idx == parsed_args.start_map:
state = State.STARTED
if idx == parsed_args.end_map:
state = State.DONE
if state == State.NOT_STARTED:
continue
start_time = self._offset / 1000000
text = self._add_chunk(v, output, not parsed_args.nooverlay)
text = self._add_chunk(
videodir.joinpath(f"{parsed_args.wad}_map{idx}.mp4"),
output, not parsed_args.nooverlay
)
list.append(
summary, f"{text} {math.floor(start_time / 60):02}:"
+ f"{math.floor(start_time % 60):02}"
)
if state == State.DONE:
break
output.close()
for line in summary:

View file

@ -2,7 +2,7 @@ import io
import pathlib
import os
import re
import tomlkit
import tomlkit.toml_file
from cliff.command import Command

View file

@ -3,13 +3,51 @@ import sys
from cliff.app import App
from cliff.commandmanager import CommandManager
import dcc.concat
import dcc.configure
import dcc.dsda
import dcc.eureka
import dcc.extract
import dcc.fabricate
import dcc.fetch
import dcc.ls
import dcc.pb
import dcc.play
import dcc.put
import dcc.record
import dcc.rib
import dcc.ss
import dcc.text
import dcc.thumb
class DCC(App):
def __init__(self):
cm = CommandManager(None)
commands = {
"concat": dcc.concat.Concat,
"configure": dcc.configure.Configure,
"dsda": dcc.dsda.DSDA,
"eureka": dcc.eureka.Eureka,
"extract": dcc.extract.Extract,
"fabricate": dcc.fabricate.Fabricate,
"fetch": dcc.fetch.Fetch,
"ls": dcc.ls.List,
"pb": dcc.pb.PB,
"play": dcc.play.Play,
"put": dcc.put.Put,
"record": dcc.record.Record,
"rib": dcc.rib.RIB,
"ss": dcc.ss.SS,
"text": dcc.text.Text,
"thumb": dcc.thumb.Thumb,
}
for n, c in commands.items():
cm.add_command(n, c)
super().__init__(
description="Doom Command Center",
version="0.0.1",
command_manager=CommandManager("dcc"),
command_manager=cm,
deferred_help=True,
)

View file

@ -29,13 +29,15 @@ class Text(dcc.doom_base.WadMap):
parser = super().get_parser(prog_name)
parser.add_argument("--nomap", action="store_true")
parser.add_argument("--demotype", default="UV-Max Demo")
parser.add_argument("--stdin", "--stdin-only", action="store_true")
return parser
def take_action(self, parsed_args):
text = None
map_names = self._config.get("map_names")
if map_names is not None:
text = map_names.get(f"map{parsed_args.map}")
if not parsed_args.stdin:
map_names = self._config.get("map_names")
if map_names is not None:
text = map_names.get(f"map{parsed_args.map}")
if text is None:
text = sys.stdin.read().rstrip()
if not parsed_args.nomap:

View file

@ -28,6 +28,3 @@ dcc = "dcc.main:main"
[tool.poetry-pyinstaller-plugin.scripts]
dcc = { source = "dcc/main.py", type = "onefile" }
[tool.poetry-pyinstaller-plugin.collect]
all = ["dcc"]