|
|
@ -849,6 +849,15 @@ class PathFormat():
|
|
|
|
remove = config("path-remove", "\x00-\x1f\x7f")
|
|
|
|
remove = config("path-remove", "\x00-\x1f\x7f")
|
|
|
|
self.clean_path = self._build_cleanfunc(remove, "")
|
|
|
|
self.clean_path = self._build_cleanfunc(remove, "")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strip = config("path-strip", "auto")
|
|
|
|
|
|
|
|
if strip == "auto":
|
|
|
|
|
|
|
|
strip = ". " if WINDOWS else ""
|
|
|
|
|
|
|
|
elif strip == "unix":
|
|
|
|
|
|
|
|
strip = ""
|
|
|
|
|
|
|
|
elif strip == "windows":
|
|
|
|
|
|
|
|
strip = ". "
|
|
|
|
|
|
|
|
self.strip = strip
|
|
|
|
|
|
|
|
|
|
|
|
basedir = extractor._parentdir
|
|
|
|
basedir = extractor._parentdir
|
|
|
|
if not basedir:
|
|
|
|
if not basedir:
|
|
|
|
basedir = config("base-directory")
|
|
|
|
basedir = config("base-directory")
|
|
|
@ -982,13 +991,14 @@ class PathFormat():
|
|
|
|
"""Apply 'kwdict' to directory format strings"""
|
|
|
|
"""Apply 'kwdict' to directory format strings"""
|
|
|
|
segments = []
|
|
|
|
segments = []
|
|
|
|
append = segments.append
|
|
|
|
append = segments.append
|
|
|
|
|
|
|
|
strip = self.strip
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
for formatter in self.directory_formatters:
|
|
|
|
for formatter in self.directory_formatters:
|
|
|
|
segment = formatter(kwdict).strip()
|
|
|
|
segment = formatter(kwdict).strip()
|
|
|
|
if WINDOWS:
|
|
|
|
if strip:
|
|
|
|
# remove trailing dots and spaces (#647)
|
|
|
|
# remove trailing dots and spaces (#647)
|
|
|
|
segment = segment.rstrip(". ")
|
|
|
|
segment = segment.rstrip(strip)
|
|
|
|
if segment:
|
|
|
|
if segment:
|
|
|
|
append(self.clean_segment(segment))
|
|
|
|
append(self.clean_segment(segment))
|
|
|
|
return segments
|
|
|
|
return segments
|
|
|
@ -998,6 +1008,7 @@ class PathFormat():
|
|
|
|
def build_directory_conditional(self, kwdict):
|
|
|
|
def build_directory_conditional(self, kwdict):
|
|
|
|
segments = []
|
|
|
|
segments = []
|
|
|
|
append = segments.append
|
|
|
|
append = segments.append
|
|
|
|
|
|
|
|
strip = self.strip
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
for condition, formatters in self.directory_conditions:
|
|
|
|
for condition, formatters in self.directory_conditions:
|
|
|
@ -1007,8 +1018,8 @@ class PathFormat():
|
|
|
|
formatters = self.directory_formatters
|
|
|
|
formatters = self.directory_formatters
|
|
|
|
for formatter in formatters:
|
|
|
|
for formatter in formatters:
|
|
|
|
segment = formatter(kwdict).strip()
|
|
|
|
segment = formatter(kwdict).strip()
|
|
|
|
if WINDOWS:
|
|
|
|
if strip:
|
|
|
|
segment = segment.rstrip(". ")
|
|
|
|
segment = segment.rstrip(strip)
|
|
|
|
if segment:
|
|
|
|
if segment:
|
|
|
|
append(self.clean_segment(segment))
|
|
|
|
append(self.clean_segment(segment))
|
|
|
|
return segments
|
|
|
|
return segments
|
|
|
|