diff --git a/dcc/extract.py b/dcc/extract.py index 95228f7..292bd39 100644 --- a/dcc/extract.py +++ b/dcc/extract.py @@ -12,7 +12,7 @@ class Extract(dcc.doom_base.Wad): return parser def take_action(self, parsed_args): - for w in self.load_order(): + for w in self.load_order() try: # TODO: handle anything other than graphics. wad = omg.WadIO(w) diff --git a/dcc/fetch.py b/dcc/fetch.py index fd53f55..ed2aaca 100644 --- a/dcc/fetch.py +++ b/dcc/fetch.py @@ -4,7 +4,6 @@ import json import pathlib import shutil import subprocess -import sys import urllib.request import zipfile @@ -41,8 +40,6 @@ class Fetch(dcc.config.Base): "https://www.doomworld.com/idgames/api/" + "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"] if type(files) is dict: # One result. return files["id"] diff --git a/dcc/text.py b/dcc/text.py index a93d72a..3a816f7 100644 --- a/dcc/text.py +++ b/dcc/text.py @@ -60,19 +60,21 @@ class Text(dcc.doom_base.WadMap): def get_parser(self, prog_name): parser = super().get_parser(prog_name) 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("--stdin", "--stdin-only", action="store_true") return parser def take_action(self, parsed_args): - text = "" - if not parsed_args.nomapname: - if not parsed_args.nomap: - text = f"MAP{parsed_args.map}: " - text += self.map_name(parsed_args.mapname, parsed_args.map) - text += "\n" - text = "{}{}".format(text, parsed_args.demotype) + text = None + 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: + text = "MAP{}: {}".format(parsed_args.map, text) + text = "{}\n{}".format(text, parsed_args.demotype) with wand.image.Image( height=self.thumbnail_height, width=self.thumbnail_width @@ -83,15 +85,3 @@ class Text(dcc.doom_base.WadMap): img.trim() img.reset_coords() 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? ")