[archive] use defaults when 'prefix'/'format' are 'null'
This commit is contained in:
@@ -551,9 +551,15 @@ class DownloadJob(Job):
|
|||||||
archive_path = cfg("archive")
|
archive_path = cfg("archive")
|
||||||
if archive_path:
|
if archive_path:
|
||||||
archive_path = util.expand_path(archive_path)
|
archive_path = util.expand_path(archive_path)
|
||||||
archive_format = (cfg("archive-prefix", extr.category) +
|
|
||||||
cfg("archive-format", extr.archive_fmt))
|
archive_prefix = cfg("archive-prefix")
|
||||||
archive_pragma = (cfg("archive-pragma"))
|
if archive_prefix is None:
|
||||||
|
archive_prefix = extr.category
|
||||||
|
|
||||||
|
archive_format = cfg("archive-format")
|
||||||
|
if archive_format is None:
|
||||||
|
archive_format = extr.archive_fmt
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if "{" in archive_path:
|
if "{" in archive_path:
|
||||||
archive_path = formatter.parse(
|
archive_path = formatter.parse(
|
||||||
@@ -563,7 +569,10 @@ class DownloadJob(Job):
|
|||||||
else:
|
else:
|
||||||
archive_cls = archive.DownloadArchive
|
archive_cls = archive.DownloadArchive
|
||||||
self.archive = archive_cls(
|
self.archive = archive_cls(
|
||||||
archive_path, archive_format, archive_pragma)
|
archive_path,
|
||||||
|
archive_prefix + archive_format,
|
||||||
|
cfg("archive-pragma"),
|
||||||
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
extr.log.warning(
|
extr.log.warning(
|
||||||
"Failed to open download archive at '%s' (%s: %s)",
|
"Failed to open download archive at '%s' (%s: %s)",
|
||||||
|
|||||||
@@ -26,19 +26,27 @@ class PostProcessor():
|
|||||||
if archive_path:
|
if archive_path:
|
||||||
extr = job.extractor
|
extr = job.extractor
|
||||||
archive_path = util.expand_path(archive_path)
|
archive_path = util.expand_path(archive_path)
|
||||||
if not prefix:
|
|
||||||
prefix = "_" + self.name.upper() + "_"
|
archive_prefix = options.get("archive-prefix")
|
||||||
archive_format = (
|
if archive_prefix is None:
|
||||||
options.get("archive-prefix", extr.category) +
|
archive_prefix = extr.category
|
||||||
options.get("archive-format", prefix + extr.archive_fmt))
|
|
||||||
|
archive_format = options.get("archive-format")
|
||||||
|
if archive_format is None:
|
||||||
|
if prefix is None:
|
||||||
|
prefix = "_" + self.name.upper() + "_"
|
||||||
|
archive_format = prefix + extr.archive_fmt
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if "{" in archive_path:
|
if "{" in archive_path:
|
||||||
archive_path = formatter.parse(archive_path).format_map(
|
archive_path = formatter.parse(archive_path).format_map(
|
||||||
job.pathfmt.kwdict)
|
job.pathfmt.kwdict)
|
||||||
self.archive = archive.DownloadArchive(
|
self.archive = archive.DownloadArchive(
|
||||||
archive_path, archive_format,
|
archive_path,
|
||||||
|
archive_prefix + archive_format,
|
||||||
options.get("archive-pragma"),
|
options.get("archive-pragma"),
|
||||||
"_archive_" + self.name)
|
"_archive_" + self.name,
|
||||||
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self.log.warning(
|
self.log.warning(
|
||||||
"Failed to open %s archive at '%s' (%s: %s)",
|
"Failed to open %s archive at '%s' (%s: %s)",
|
||||||
|
|||||||
Reference in New Issue
Block a user