Răsfoiți Sursa

feat: Add specific logic for archive_org icon

Cristian 5 ani în urmă
părinte
comite
8cfad64271
1 a modificat fișierele cu 9 adăugiri și 1 ștergeri
  1. 9 1
      archivebox/core/utils.py

+ 9 - 1
archivebox/core/utils.py

@@ -23,7 +23,7 @@ def get_icons(snapshot: Snapshot) -> str:
         "mercury": "🅼",
         "warc": "📦"
     }
-    exclude = ["favicon"]
+    exclude = ["favicon", "archive_org"]
     # Missing specific entry for WARC
 
     for extractor, _ in EXTRACTORS:
@@ -40,6 +40,14 @@ def get_icons(snapshot: Snapshot) -> str:
                     output += output_template.format(exists[0], "",
                                                      True, "warc", icons.get("warc", "?"))
 
+            if extractor == "archive_org" and exists:
+                # The check for archive_org is different, so it has to be handled separately
+                target_path = Path(path) / "archive.org.txt"
+                exists = target_path.exists()
+                if exists:
+                    output += '<a href="{}" class="exists-{}" title="{}">{} </a>'.format(canon["archive_org_path"],
+                                                                                         True, "archive_org", icons.get("archive_org", "?"))
+
         except Exception as e:
             print(e)