Compare commits
No commits in common. "21bdcf3e1777213e2c52493ae70d85567f780c69" and "47133bdff738a4ddd7aae00a08c6a0729bea9df7" have entirely different histories.
21bdcf3e17
...
47133bdff7
3 changed files with 12 additions and 25 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,7 +4,6 @@ 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
|
||||||
|
|
||||||
|
|
@ -41,8 +40,6 @@ 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"]
|
||||||
|
|
|
||||||
30
dcc/text.py
30
dcc/text.py
|
|
@ -60,19 +60,21 @@ 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 = ""
|
text = None
|
||||||
if not parsed_args.nomapname:
|
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 = input("Map Name? ")
|
||||||
if not parsed_args.nomap:
|
if not parsed_args.nomap:
|
||||||
text = f"MAP{parsed_args.map}: "
|
text = "MAP{}: {}".format(parsed_args.map, text)
|
||||||
text += self.map_name(parsed_args.mapname, parsed_args.map)
|
text = "{}\n{}".format(text, parsed_args.demotype)
|
||||||
text += "\n"
|
|
||||||
text = "{}{}".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
|
||||||
|
|
@ -83,15 +85,3 @@ 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