Initial commit

This commit is contained in:
dev
2025-06-12 22:55:04 +02:00
commit ecb089ea79
53 changed files with 3265 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
"""Exiftool Analyzer for Image Submissions."""
import subprocess
from pathlib import Path
from .utils import update_data
def analyze_exiftool(input_img: Path, output_dir: Path) -> None:
"""Analyze an image submission using exiftool."""
try:
data = subprocess.run(
["exiftool", input_img], capture_output=True, text=True, check=True
)
if data.stderr:
update_data(
output_dir, {"strings": {"status": "error", "error": data.stderr}}
)
return
metadata: dict[str, str] = {}
for line in data.stdout.split("\n"):
if ":" in line:
key, value = line.split(":", 1)
metadata[key.strip()] = value.strip()
# exiftool_dir = output_dir / "exiftool"
# exiftool_dir.mkdir(parents=True, exist_ok=True)
# update_data(exiftool_dir, metadata, "data.json")
update_data(
output_dir,
{"exiftool": {"status": "ok", "output": metadata}},
)
except Exception as e:
update_data(output_dir, {"exiftool": {"status": "error", "error": str(e)}})