Compare commits
6 commits
a3da884eee
...
16eb67c797
Author | SHA1 | Date | |
---|---|---|---|
16eb67c797 | |||
789064aa0d | |||
8e48915a27 | |||
fb61d3d935 | |||
6815545da4 | |||
026128473c |
6 changed files with 68 additions and 20 deletions
2
Makefile
2
Makefile
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -2,7 +2,7 @@ import io
|
|||
import pathlib
|
||||
import os
|
||||
import re
|
||||
import tomlkit
|
||||
import tomlkit.toml_file
|
||||
|
||||
from cliff.command import Command
|
||||
|
||||
|
|
40
dcc/main.py
40
dcc/main.py
|
@ -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,
|
||||
)
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue