Compare commits
3 commits
47133bdff7
...
21bdcf3e17
| Author | SHA1 | Date | |
|---|---|---|---|
| 21bdcf3e17 | |||
| a3a970a22f | |||
| 081b7e2dee |
3 changed files with 25 additions and 12 deletions
|
|
@ -12,7 +12,7 @@ class Extract(dcc.doom_base.Wad):
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
for w in self.load_order()
|
for w in self.load_order():
|
||||||
try:
|
try:
|
||||||
# TODO: handle anything other than graphics.
|
# TODO: handle anything other than graphics.
|
||||||
wad = omg.WadIO(w)
|
wad = omg.WadIO(w)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import json
|
||||||
import pathlib
|
import pathlib
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
|
|
@ -40,6 +41,8 @@ class Fetch(dcc.config.Base):
|
||||||
"https://www.doomworld.com/idgames/api/" +
|
"https://www.doomworld.com/idgames/api/" +
|
||||||
"api.php?action=search&query={}&out=json".format(wad)
|
"api.php?action=search&query={}&out=json".format(wad)
|
||||||
)
|
)
|
||||||
|
if "content" not in reply:
|
||||||
|
sys.exit(f"No WAD named {wad} found on idgames.")
|
||||||
files = reply["content"]["file"]
|
files = reply["content"]["file"]
|
||||||
if type(files) is dict: # One result.
|
if type(files) is dict: # One result.
|
||||||
return files["id"]
|
return files["id"]
|
||||||
|
|
|
||||||
32
dcc/text.py
32
dcc/text.py
|
|
@ -60,21 +60,19 @@ class Text(dcc.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")
|
||||||
|
parser.add_argument("--nomapname", action="store_true")
|
||||||
|
parser.add_argument("--mapname", "-m", default="")
|
||||||
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 = ""
|
||||||
if not parsed_args.stdin:
|
if not parsed_args.nomapname:
|
||||||
map_names = self._config.get("map_names")
|
if not parsed_args.nomap:
|
||||||
if map_names is not None:
|
text = f"MAP{parsed_args.map}: "
|
||||||
text = map_names.get(f"map{parsed_args.map}")
|
text += self.map_name(parsed_args.mapname, parsed_args.map)
|
||||||
if text is None:
|
text += "\n"
|
||||||
text = input("Map Name? ")
|
text = "{}{}".format(text, parsed_args.demotype)
|
||||||
if not parsed_args.nomap:
|
|
||||||
text = "MAP{}: {}".format(parsed_args.map, text)
|
|
||||||
text = "{}\n{}".format(text, parsed_args.demotype)
|
|
||||||
with wand.image.Image(
|
with wand.image.Image(
|
||||||
height=self.thumbnail_height,
|
height=self.thumbnail_height,
|
||||||
width=self.thumbnail_width
|
width=self.thumbnail_width
|
||||||
|
|
@ -85,3 +83,15 @@ class Text(dcc.doom_base.WadMap):
|
||||||
img.trim()
|
img.trim()
|
||||||
img.reset_coords()
|
img.reset_coords()
|
||||||
img.save(filename=self.text_thumb_path())
|
img.save(filename=self.text_thumb_path())
|
||||||
|
|
||||||
|
def map_name(self, mapname, mapnum):
|
||||||
|
if mapname != "":
|
||||||
|
return mapname
|
||||||
|
|
||||||
|
map_names = self._config.get("map_names")
|
||||||
|
if map_names is not None:
|
||||||
|
text = map_names.get(f"map{mapnum}")
|
||||||
|
if text != "":
|
||||||
|
return text
|
||||||
|
|
||||||
|
return input("Map Name? ")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue