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:
|
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 av
|
||||||
import copy
|
import copy
|
||||||
import dcc.doom_base
|
import dcc.doom_base
|
||||||
|
import enum
|
||||||
import fractions
|
import fractions
|
||||||
import io
|
import io
|
||||||
import logging
|
import logging
|
||||||
|
@ -9,6 +10,11 @@ import numpy as np
|
||||||
import wand.image
|
import wand.image
|
||||||
|
|
||||||
|
|
||||||
|
class State(enum.Enum):
|
||||||
|
NOT_STARTED = 1
|
||||||
|
STARTED = 2
|
||||||
|
DONE = 3
|
||||||
|
|
||||||
class Concat(dcc.doom_base.Wad):
|
class Concat(dcc.doom_base.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)
|
||||||
|
@ -21,10 +27,7 @@ class Concat(dcc.doom_base.Wad):
|
||||||
logging.basicConfig()
|
logging.basicConfig()
|
||||||
av.logging.set_level(av.logging.VERBOSE)
|
av.logging.set_level(av.logging.VERBOSE)
|
||||||
av.logging.restore_default_callback()
|
av.logging.restore_default_callback()
|
||||||
videos = (
|
videodir = self.fabricate.joinpath(parsed_args.wad)
|
||||||
self.fabricate.joinpath(parsed_args.wad)
|
|
||||||
.glob(f"{parsed_args.wad}_map*.mp4")
|
|
||||||
)
|
|
||||||
fn_base = (
|
fn_base = (
|
||||||
f"{parsed_args.wad}_maps{parsed_args.start_map}"
|
f"{parsed_args.wad}_maps{parsed_args.start_map}"
|
||||||
+ f"to{parsed_args.end_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.
|
# unavailable" error when switching to inputs after the first.
|
||||||
# Presumably fixable, but it's easier to just make one graph per video
|
# Presumably fixable, but it's easier to just make one graph per video
|
||||||
# and mux everything together at the end.
|
# and mux everything together at the end.
|
||||||
for v in sorted(videos):
|
# TODO: Support UDoom in literally any way.
|
||||||
# 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)]
|
||||||
if not (
|
state = State.NOT_STARTED
|
||||||
v.name >= f"{parsed_args.wad}_map{parsed_args.start_map}.mp4"
|
for idx in d2maps:
|
||||||
and v.name <= f"{parsed_args.wad}_map{parsed_args.end_map}.mp4"
|
if idx == parsed_args.start_map:
|
||||||
):
|
state = State.STARTED
|
||||||
|
if idx == parsed_args.end_map:
|
||||||
|
state = State.DONE
|
||||||
|
if state == State.NOT_STARTED:
|
||||||
continue
|
continue
|
||||||
start_time = self._offset / 1000000
|
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(
|
list.append(
|
||||||
summary, f"{text} {math.floor(start_time / 60):02}:"
|
summary, f"{text} {math.floor(start_time / 60):02}:"
|
||||||
+ f"{math.floor(start_time % 60):02}"
|
+ f"{math.floor(start_time % 60):02}"
|
||||||
)
|
)
|
||||||
|
if state == State.DONE:
|
||||||
|
break
|
||||||
output.close()
|
output.close()
|
||||||
|
|
||||||
for line in summary:
|
for line in summary:
|
||||||
|
|
|
@ -2,7 +2,7 @@ import io
|
||||||
import pathlib
|
import pathlib
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import tomlkit
|
import tomlkit.toml_file
|
||||||
|
|
||||||
from cliff.command import Command
|
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.app import App
|
||||||
from cliff.commandmanager import CommandManager
|
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):
|
class DCC(App):
|
||||||
def __init__(self):
|
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__(
|
super().__init__(
|
||||||
description="Doom Command Center",
|
description="Doom Command Center",
|
||||||
version="0.0.1",
|
version="0.0.1",
|
||||||
command_manager=CommandManager("dcc"),
|
command_manager=cm,
|
||||||
deferred_help=True,
|
deferred_help=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,15 @@ class Text(dcc.doom_base.WadMap):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
parser.add_argument("--nomap", action="store_true")
|
parser.add_argument("--nomap", action="store_true")
|
||||||
parser.add_argument("--demotype", default="UV-Max Demo")
|
parser.add_argument("--demotype", default="UV-Max Demo")
|
||||||
|
parser.add_argument("--stdin", "--stdin-only", action="store_true")
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
text = None
|
text = None
|
||||||
map_names = self._config.get("map_names")
|
if not parsed_args.stdin:
|
||||||
if map_names is not None:
|
map_names = self._config.get("map_names")
|
||||||
text = map_names.get(f"map{parsed_args.map}")
|
if map_names is not None:
|
||||||
|
text = map_names.get(f"map{parsed_args.map}")
|
||||||
if text is None:
|
if text is None:
|
||||||
text = sys.stdin.read().rstrip()
|
text = sys.stdin.read().rstrip()
|
||||||
if not parsed_args.nomap:
|
if not parsed_args.nomap:
|
||||||
|
|
|
@ -28,6 +28,3 @@ dcc = "dcc.main:main"
|
||||||
|
|
||||||
[tool.poetry-pyinstaller-plugin.scripts]
|
[tool.poetry-pyinstaller-plugin.scripts]
|
||||||
dcc = { source = "dcc/main.py", type = "onefile" }
|
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