Compare commits
3 commits
07d079f204
...
f3db413a3f
| Author | SHA1 | Date | |
|---|---|---|---|
| f3db413a3f | |||
| 6c17ae717b | |||
| 5b2528831d |
25 changed files with 129 additions and 129 deletions
2
Makefile
2
Makefile
|
|
@ -1,2 +1,2 @@
|
||||||
install:
|
install:
|
||||||
cp dist/pyinstaller/manylinux_2_39_x86_64/dcc /home/tynan/.local/bin/dcc
|
cp dist/pyinstaller/manylinux_2_39_x86_64/doomcc /home/tynan/.local/bin/dcc
|
||||||
|
|
|
||||||
72
dcc/main.py
72
dcc/main.py
|
|
@ -1,72 +0,0 @@
|
||||||
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,
|
|
||||||
"ls demos": dcc.ls.ListDemos,
|
|
||||||
"ls videos": dcc.ls.ListVideos,
|
|
||||||
"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=cm,
|
|
||||||
deferred_help=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
def initialize_app(self, argv):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def prepare_to_run_command(self, cmd):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def clean_up(self, cmd, result, err):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def main(argv=sys.argv[1:]):
|
|
||||||
dcc = DCC()
|
|
||||||
return dcc.run(argv)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(main())
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import sys
|
import sys
|
||||||
from dcc.main import main
|
from doomcc.main import main
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(main(sys.argv[1:]))
|
sys.exit(main(sys.argv[1:]))
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import av
|
import av
|
||||||
import copy
|
import copy
|
||||||
import dcc.doom_base
|
import doomcc.doom_base
|
||||||
import enum
|
import enum
|
||||||
import fractions
|
import fractions
|
||||||
import io
|
import io
|
||||||
|
|
@ -16,7 +16,7 @@ class State(enum.Enum):
|
||||||
DONE = 3
|
DONE = 3
|
||||||
|
|
||||||
|
|
||||||
class Concat(dcc.doom_base.Wad):
|
class Concat(doomcc.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)
|
||||||
parser.add_argument("start_map")
|
parser.add_argument("start_map")
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import dcc.doom_base
|
import doomcc.doom_base
|
||||||
import omg
|
import omg
|
||||||
import tomlkit.toml_file
|
import tomlkit.toml_file
|
||||||
|
|
||||||
|
|
||||||
class Configure(dcc.doom_base.Wad):
|
class Configure(doomcc.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)
|
||||||
parser.add_argument("--complevel", "--cl")
|
parser.add_argument("--complevel", "--cl")
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
from cliff.command import Command
|
from cliff.command import Command
|
||||||
import dcc.config
|
import doomcc.config
|
||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import tomlkit
|
import tomlkit
|
||||||
|
|
||||||
|
|
||||||
class Wad(dcc.config.Base):
|
class Wad(doomcc.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")
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import dcc.config
|
import doomcc.config
|
||||||
import dcc.doom_base
|
import doomcc.doom_base
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
|
@ -7,7 +7,7 @@ import subprocess
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
|
|
||||||
class DSDA(dcc.doom_base.WadMap):
|
class DSDA(doomcc.doom_base.WadMap):
|
||||||
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("-s", "--single", action="store_true")
|
parser.add_argument("-s", "--single", action="store_true")
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import dcc.doom_base
|
import doomcc.doom_base
|
||||||
import dcc.config
|
import doomcc.config
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class Eureka(dcc.doom_base.WadMap):
|
class Eureka(doomcc.doom_base.WadMap):
|
||||||
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("--main")
|
parser.add_argument("--main")
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import dcc.doom_base
|
import doomcc.doom_base
|
||||||
import omg
|
import omg
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import wand.color
|
import wand.color
|
||||||
import wand.image
|
import wand.image
|
||||||
|
|
||||||
|
|
||||||
class Extract(dcc.doom_base.Wad):
|
class Extract(doomcc.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)
|
||||||
parser.add_argument("lump")
|
parser.add_argument("lump")
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import contextlib
|
import contextlib
|
||||||
import dcc.config
|
import doomcc.config
|
||||||
import dcc.doom_base
|
import doomcc.doom_base
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
class Fabricate(dcc.doom_base.WadMap):
|
class Fabricate(doomcc.doom_base.WadMap):
|
||||||
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("--fg", action="store_true")
|
parser.add_argument("--fg", action="store_true")
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import dcc.config
|
import doomcc.config
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
@ -9,7 +9,7 @@ import urllib.request
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
|
|
||||||
class Fetch(dcc.config.Base):
|
class Fetch(doomcc.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("id_or_name")
|
parser.add_argument("id_or_name")
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import dcc.config
|
import doomcc.config
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class List(dcc.config.ListerBase):
|
class List(doomcc.config.ListerBase):
|
||||||
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("target")
|
parser.add_argument("target")
|
||||||
|
|
@ -24,7 +24,7 @@ class List(dcc.config.ListerBase):
|
||||||
raise Exception(f"unknown target {parsed_args.target}")
|
raise Exception(f"unknown target {parsed_args.target}")
|
||||||
|
|
||||||
|
|
||||||
class WadList(dcc.config.ListerBase):
|
class WadList(doomcc.config.ListerBase):
|
||||||
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")
|
||||||
72
doomcc/main.py
Normal file
72
doomcc/main.py
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from cliff.app import App
|
||||||
|
from cliff.commandmanager import CommandManager
|
||||||
|
|
||||||
|
import doomcc.concat
|
||||||
|
import doomcc.configure
|
||||||
|
import doomcc.dsda
|
||||||
|
import doomcc.eureka
|
||||||
|
import doomcc.extract
|
||||||
|
import doomcc.fabricate
|
||||||
|
import doomcc.fetch
|
||||||
|
import doomcc.ls
|
||||||
|
import doomcc.pb
|
||||||
|
import doomcc.play
|
||||||
|
import doomcc.put
|
||||||
|
import doomcc.record
|
||||||
|
import doomcc.rib
|
||||||
|
import doomcc.ss
|
||||||
|
import doomcc.text
|
||||||
|
import doomcc.thumb
|
||||||
|
|
||||||
|
|
||||||
|
class DoomCC(App):
|
||||||
|
def __init__(self):
|
||||||
|
cm = CommandManager(None)
|
||||||
|
commands = {
|
||||||
|
"concat": doomcc.concat.Concat,
|
||||||
|
"configure": doomcc.configure.Configure,
|
||||||
|
"dsda": doomcc.dsda.DSDA,
|
||||||
|
"eureka": doomcc.eureka.Eureka,
|
||||||
|
"extract": doomcc.extract.Extract,
|
||||||
|
"fabricate": doomcc.fabricate.Fabricate,
|
||||||
|
"fetch": doomcc.fetch.Fetch,
|
||||||
|
"ls": doomcc.ls.List,
|
||||||
|
"ls demos": doomcc.ls.ListDemos,
|
||||||
|
"ls videos": doomcc.ls.ListVideos,
|
||||||
|
"pb": doomcc.pb.PB,
|
||||||
|
"play": doomcc.play.Play,
|
||||||
|
"put": doomcc.put.Put,
|
||||||
|
"record": doomcc.record.Record,
|
||||||
|
"rib": doomcc.rib.RIB,
|
||||||
|
"ss": doomcc.ss.SS,
|
||||||
|
"text": doomcc.text.Text,
|
||||||
|
"thumb": doomcc.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=cm,
|
||||||
|
deferred_help=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
def initialize_app(self, argv):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def prepare_to_run_command(self, cmd):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def clean_up(self, cmd, result, err):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv=sys.argv[1:]):
|
||||||
|
doomcc = DoomCC()
|
||||||
|
return doomcc.run(argv)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import dcc.config
|
import doomcc.config
|
||||||
import dcc.doom_base
|
import doomcc.doom_base
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class PB(dcc.doom_base.WadMap):
|
class PB(doomcc.doom_base.WadMap):
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
os.execvp("ffplay", ["ffplay", self.video_path()])
|
os.execvp("ffplay", ["ffplay", self.video_path()])
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import dcc.config
|
import doomcc.config
|
||||||
import dcc.doom_base
|
import doomcc.doom_base
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class Play(dcc.doom_base.WadMap):
|
class Play(doomcc.doom_base.WadMap):
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
os.execv(self.dsda, [self.dsda] + self.dsda_preamble())
|
os.execv(self.dsda, [self.dsda] + self.dsda_preamble())
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import boto3
|
import boto3
|
||||||
import dcc.config
|
import doomcc.config
|
||||||
import dcc.doom_base
|
import doomcc.doom_base
|
||||||
|
|
||||||
|
|
||||||
class Put(dcc.doom_base.WadMap):
|
class Put(doomcc.doom_base.WadMap):
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
return parser
|
return parser
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import dcc.config
|
import doomcc.config
|
||||||
import dcc.doom_base
|
import doomcc.doom_base
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class Record(dcc.doom_base.WadMap):
|
class Record(doomcc.doom_base.WadMap):
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
os.execv(
|
os.execv(
|
||||||
self.dsda,
|
self.dsda,
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import dcc.doom_base
|
import doomcc.doom_base
|
||||||
import pathlib
|
import pathlib
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
class RIB(dcc.doom_base.WadMap):
|
class RIB(doomcc.doom_base.WadMap):
|
||||||
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("-s", "--secs_before", type=int, default=10)
|
parser.add_argument("-s", "--secs_before", type=int, default=10)
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
from tkinter import messagebox
|
from tkinter import messagebox
|
||||||
import dcc.config
|
import doomcc.config
|
||||||
import dcc.doom_base
|
import doomcc.doom_base
|
||||||
import sys
|
import sys
|
||||||
import wand.display
|
import wand.display
|
||||||
import wand.image
|
import wand.image
|
||||||
|
|
||||||
|
|
||||||
class SS(dcc.doom_base.WadMap):
|
class SS(doomcc.doom_base.WadMap):
|
||||||
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("-g", "--gravity", default="center")
|
parser.add_argument("-g", "--gravity", default="center")
|
||||||
|
|
@ -24,7 +24,7 @@ class SS(dcc.doom_base.WadMap):
|
||||||
img.reset_coords()
|
img.reset_coords()
|
||||||
if img.width < width or img.height < height:
|
if img.width < width or img.height < height:
|
||||||
if not messagebox.askretrycancel(
|
if not messagebox.askretrycancel(
|
||||||
title="DCC",
|
title="Doom Command Center",
|
||||||
message=f"Image too small ({img.width}x{img.height})."
|
message=f"Image too small ({img.width}x{img.height})."
|
||||||
+ "Try again?",
|
+ "Try again?",
|
||||||
):
|
):
|
||||||
|
|
@ -35,7 +35,7 @@ class SS(dcc.doom_base.WadMap):
|
||||||
if not yolo:
|
if not yolo:
|
||||||
wand.display.display(img)
|
wand.display.display(img)
|
||||||
accepted = messagebox.askyesnocancel(
|
accepted = messagebox.askyesnocancel(
|
||||||
title="DCC", message="Is this image acceptable?"
|
title="Doom Command Center", message="Is this image acceptable?"
|
||||||
)
|
)
|
||||||
if accepted is None:
|
if accepted is None:
|
||||||
sys.exit("Gave up on image verification")
|
sys.exit("Gave up on image verification")
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import dcc.config
|
import doomcc.config
|
||||||
import dcc.doom_base
|
import doomcc.doom_base
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
import wand.drawing
|
import wand.drawing
|
||||||
|
|
@ -51,10 +51,10 @@ def draw_text(self, img, text, font_size=64, wrap_dist=0.75):
|
||||||
draw(img)
|
draw(img)
|
||||||
|
|
||||||
|
|
||||||
dcc.config.Base.draw_text = draw_text
|
doomcc.config.Base.draw_text = draw_text
|
||||||
|
|
||||||
|
|
||||||
class Text(dcc.doom_base.WadMap):
|
class Text(doomcc.doom_base.WadMap):
|
||||||
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("--nomap", action="store_true")
|
parser.add_argument("--nomap", action="store_true")
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import dcc.config
|
import doomcc.config
|
||||||
import dcc.doom_base
|
import doomcc.doom_base
|
||||||
import wand.color
|
import wand.color
|
||||||
import wand.image
|
import wand.image
|
||||||
|
|
||||||
|
|
||||||
class Thumb(dcc.doom_base.WadMap):
|
class Thumb(doomcc.doom_base.WadMap):
|
||||||
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("--index", action="store_true")
|
parser.add_argument("--index", action="store_true")
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
[project]
|
[project]
|
||||||
name = "dcc"
|
name = "doomcc"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Doom Command Center"
|
description = "Doom Command Center"
|
||||||
authors = [
|
authors = [
|
||||||
|
|
@ -27,10 +27,10 @@ requires = ["poetry-core>=2.0.0,<3.0.0"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
dcc = "dcc.main:main"
|
doomcc = "doomcc.main:main"
|
||||||
|
|
||||||
[tool.poetry-pyinstaller-plugin.scripts]
|
[tool.poetry-pyinstaller-plugin.scripts]
|
||||||
dcc = { source = "dcc/main.py", type = "onefile" }
|
doomcc = { source = "doomcc/main.py", type = "onefile" }
|
||||||
|
|
||||||
[tool.poetry-pyinstaller-plugin.collect]
|
[tool.poetry-pyinstaller-plugin.collect]
|
||||||
all = ["cliff"]
|
all = ["cliff"]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import cliff.app
|
import cliff.app
|
||||||
import dcc.play
|
import doomcc.play
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import mockito.matchers
|
import mockito.matchers
|
||||||
|
|
@ -26,9 +26,9 @@ def test_play(expect):
|
||||||
scp.mkdir()
|
scp.mkdir()
|
||||||
scp.joinpath("config.toml").touch()
|
scp.joinpath("config.toml").touch()
|
||||||
scp.joinpath("scythe.wad").touch()
|
scp.joinpath("scythe.wad").touch()
|
||||||
dcc.play.Play.__init__ = lambda self: None
|
doomcc.play.Play.__init__ = lambda self: None
|
||||||
dcc.play.Play.get_epilog = lambda self: ""
|
doomcc.play.Play.get_epilog = lambda self: ""
|
||||||
rig = dcc.play.Play()
|
rig = doomcc.play.Play()
|
||||||
rig._hooks = []
|
rig._hooks = []
|
||||||
parser = rig.get_parser("test_play")
|
parser = rig.get_parser("test_play")
|
||||||
parsed_args = parser.parse_args(args=["--doom", td, "scythe", "01"])
|
parsed_args = parser.parse_args(args=["--doom", td, "scythe", "01"])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue