add 'kwdict' argument to PathFormat.build_filename()
This commit is contained in:
parent
fd00d47116
commit
2ca011dfa8
@ -89,7 +89,7 @@ class MetadataPP(PostProcessor):
|
|||||||
ext = kwdict.get("extension")
|
ext = kwdict.get("extension")
|
||||||
kwdict["extension"] = pathfmt.extension
|
kwdict["extension"] = pathfmt.extension
|
||||||
kwdict["extension"] = pathfmt.prefix + self._extension_fmt(kwdict)
|
kwdict["extension"] = pathfmt.prefix + self._extension_fmt(kwdict)
|
||||||
filename = pathfmt.build_filename()
|
filename = pathfmt.build_filename(kwdict)
|
||||||
kwdict["extension"] = ext
|
kwdict["extension"] = ext
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
|
@ -931,17 +931,15 @@ class PathFormat():
|
|||||||
self.temppath = self.realpath = self.realpath[:-1]
|
self.temppath = self.realpath = self.realpath[:-1]
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def build_filename(self):
|
def build_filename(self, kwdict):
|
||||||
"""Apply 'kwdict' to filename format string"""
|
"""Apply 'kwdict' to filename format string"""
|
||||||
try:
|
try:
|
||||||
return self.clean_path(self.clean_segment(
|
return self.clean_path(self.clean_segment(
|
||||||
self.filename_formatter(self.kwdict)))
|
self.filename_formatter(kwdict)))
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
raise exception.FilenameFormatError(exc)
|
raise exception.FilenameFormatError(exc)
|
||||||
|
|
||||||
def build_filename_conditional(self):
|
def build_filename_conditional(self, kwdict):
|
||||||
kwdict = self.kwdict
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for condition, formatter in self.filename_conditions:
|
for condition, formatter in self.filename_conditions:
|
||||||
if condition(kwdict):
|
if condition(kwdict):
|
||||||
@ -994,7 +992,7 @@ class PathFormat():
|
|||||||
if self._create_directory:
|
if self._create_directory:
|
||||||
os.makedirs(self.realdirectory, exist_ok=True)
|
os.makedirs(self.realdirectory, exist_ok=True)
|
||||||
self._create_directory = False
|
self._create_directory = False
|
||||||
self.filename = filename = self.build_filename()
|
self.filename = filename = self.build_filename(self.kwdict)
|
||||||
self.path = self.directory + filename
|
self.path = self.directory + filename
|
||||||
self.realpath = self.realdirectory + filename
|
self.realpath = self.realdirectory + filename
|
||||||
if not self.temppath:
|
if not self.temppath:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user