mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-14 07:04:27 -04:00
check for output existance when rendering files icons
This commit is contained in:
parent
15e87353bd
commit
54c5331693
1 changed files with 10 additions and 10 deletions
|
@ -140,22 +140,22 @@ def snapshot_icons(snapshot) -> str:
|
||||||
exclude = ["favicon", "title", "headers", "archive_org"]
|
exclude = ["favicon", "title", "headers", "archive_org"]
|
||||||
# Missing specific entry for WARC
|
# Missing specific entry for WARC
|
||||||
|
|
||||||
extractor_items = defaultdict(lambda: None)
|
extractor_outputs = defaultdict(lambda: None)
|
||||||
for extractor, _ in EXTRACTORS:
|
for extractor, _ in EXTRACTORS:
|
||||||
for result in archive_results:
|
for result in archive_results:
|
||||||
if result.extractor == extractor:
|
if result.extractor == extractor and result:
|
||||||
extractor_items[extractor] = result
|
extractor_outputs[extractor] = result
|
||||||
|
|
||||||
for extractor, _ in EXTRACTORS:
|
for extractor, _ in EXTRACTORS:
|
||||||
if extractor not in exclude:
|
if extractor not in exclude:
|
||||||
exists = False
|
outpath = extractor_outputs[extractor] and extractor_outputs[extractor].output
|
||||||
if extractor_items[extractor] is not None:
|
if outpath:
|
||||||
outpath = (Path(path) / canon[f"{extractor}_path"])
|
outpath = (Path(path) / outpath)
|
||||||
if outpath.is_dir():
|
if outpath.is_file():
|
||||||
|
exists = True
|
||||||
|
elif outpath.is_dir():
|
||||||
exists = any(outpath.glob('*.*'))
|
exists = any(outpath.glob('*.*'))
|
||||||
elif outpath.is_file():
|
output += format_html(output_template, path, canon[f"{extractor}_path"], str(bool(outpath)),
|
||||||
exists = outpath.stat().st_size > 100
|
|
||||||
output += format_html(output_template, path, canon[f"{extractor}_path"], str(exists),
|
|
||||||
extractor, icons.get(extractor, "?"))
|
extractor, icons.get(extractor, "?"))
|
||||||
if extractor == "wget":
|
if extractor == "wget":
|
||||||
# warc isn't technically it's own extractor, so we have to add it after wget
|
# warc isn't technically it's own extractor, so we have to add it after wget
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue