PEP 8 compliance.
This commit is contained in:
parent
d539490898
commit
6baacd9b89
1 changed files with 40 additions and 12 deletions
|
@ -6,6 +6,7 @@ import os
|
||||||
import re
|
import re
|
||||||
import tomlkit
|
import tomlkit
|
||||||
|
|
||||||
|
|
||||||
class Wad(dcc.config.Base):
|
class Wad(dcc.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)
|
||||||
|
@ -33,7 +34,7 @@ class WadMap(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('map')
|
parser.add_argument('map')
|
||||||
parser.add_argument('-n','--name','--demo_name')
|
parser.add_argument('-n', '--name', '--demo_name')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def run(self, parsed_args):
|
def run(self, parsed_args):
|
||||||
|
@ -46,7 +47,7 @@ class WadMap(Wad):
|
||||||
@property
|
@property
|
||||||
def map(self):
|
def map(self):
|
||||||
return self._map
|
return self._map
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name_string(self):
|
def name_string(self):
|
||||||
return "" if self._name is None else "_" + self._name
|
return "" if self._name is None else "_" + self._name
|
||||||
|
@ -80,36 +81,63 @@ class WadMap(Wad):
|
||||||
return f.read().strip()
|
return f.read().strip()
|
||||||
|
|
||||||
def demo_in_path(self):
|
def demo_in_path(self):
|
||||||
candidates = [x for x in self.demos.joinpath(self.wad).glob(self._file_base("*.lmp"))]
|
candidates = [
|
||||||
|
x for x in self.demos.joinpath(self.wad)
|
||||||
|
.glob(self._file_base("*.lmp"))
|
||||||
|
]
|
||||||
if len(candidates) == 0:
|
if len(candidates) == 0:
|
||||||
raise Exception("no suitable demo candidates for WAD {} MAP {} name {}.".format(self.wad, self.map, self.name_string))
|
raise Exception(
|
||||||
|
"no suitable demo candidates for WAD {} MAP {} name {}."
|
||||||
|
.format(self.wad, self.map, self.name_string)
|
||||||
|
)
|
||||||
if len(candidates) == 1:
|
if len(candidates) == 1:
|
||||||
return candidates[0]
|
return candidates[0]
|
||||||
return sorted(filter(lambda s : re.search("-", str(s)), candidates))[-1]
|
return sorted(filter(lambda s: re.search("-", str(s)), candidates))[-1]
|
||||||
|
|
||||||
def dsda_text_path(self):
|
def dsda_text_path(self):
|
||||||
return self._ensure(self.demos.joinpath(self.wad)).joinpath(self._file_base(".txt"))
|
return (
|
||||||
|
self._ensure(self.demos.joinpath(self.wad))
|
||||||
|
.joinpath(self._file_base(".txt"))
|
||||||
|
)
|
||||||
|
|
||||||
def video_path(self):
|
def video_path(self):
|
||||||
return self._ensure(self.fabricate.joinpath(self.wad)).joinpath(self._file_base(".mp4"))
|
return (
|
||||||
|
self._ensure(self.fabricate.joinpath(self.wad))
|
||||||
|
.joinpath(self._file_base(".mp4"))
|
||||||
|
)
|
||||||
|
|
||||||
def demo_out_path(self):
|
def demo_out_path(self):
|
||||||
return self._ensure(self.demos.joinpath(self.wad)).joinpath(self._file_base(".lmp"))
|
return (
|
||||||
|
self._ensure(self.demos.joinpath(self.wad))
|
||||||
|
.joinpath(self._file_base(".lmp"))
|
||||||
|
)
|
||||||
|
|
||||||
def target_bucket(self):
|
def target_bucket(self):
|
||||||
return "doom/" + self._file_base(".lmp")
|
return "doom/" + self._file_base(".lmp")
|
||||||
|
|
||||||
def base_thumb_path(self):
|
def base_thumb_path(self):
|
||||||
return self._ensure(self.fabricate.joinpath(self.wad)).joinpath(self._file_base("_base.png"))
|
return (
|
||||||
|
self._ensure(self.fabricate.joinpath(self.wad))
|
||||||
|
.joinpath(self._file_base("_base.png"))
|
||||||
|
)
|
||||||
|
|
||||||
def m_doom_path(self):
|
def m_doom_path(self):
|
||||||
return self._ensure(self.fabricate.joinpath(self.wad)).joinpath("M_DOOM_scaled.png")
|
return (
|
||||||
|
self._ensure(self.fabricate.joinpath(self.wad))
|
||||||
|
.joinpath("M_DOOM_scaled.png")
|
||||||
|
)
|
||||||
|
|
||||||
def text_thumb_path(self):
|
def text_thumb_path(self):
|
||||||
return self._ensure(self.fabricate.joinpath(self.wad)).joinpath(self._file_base("_text.png"))
|
return (
|
||||||
|
self._ensure(self.fabricate.joinpath(self.wad))
|
||||||
|
.joinpath(self._file_base("_text.png"))
|
||||||
|
)
|
||||||
|
|
||||||
def thumb_path(self):
|
def thumb_path(self):
|
||||||
return self._ensure(self.fabricate.joinpath(self.wad)).joinpath(self._file_base("_thumb.png"))
|
return (
|
||||||
|
self._ensure(self.fabricate.joinpath(self.wad))
|
||||||
|
.joinpath(self._file_base("_thumb.png"))
|
||||||
|
)
|
||||||
|
|
||||||
def _file_base(self, ext):
|
def _file_base(self, ext):
|
||||||
return "{}_map{}{}{}".format(self.wad, self.map, self.name_string, ext)
|
return "{}_map{}{}{}".format(self.wad, self.map, self.name_string, ext)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue