24 lines
No EOL
742 B
Python
24 lines
No EOL
742 B
Python
import json
|
|
import time
|
|
from pathlib import Path
|
|
|
|
def save_manifest(out_dir: Path, data: dict):
|
|
manifest = {
|
|
"conversion_time": time.time(),
|
|
"format": data.get("format", "ept"), # était "version"
|
|
"entry_file": data.get("entry_file"),
|
|
"entry_type": data.get("entry_type"),
|
|
"ept_dir": data.get("ept_dir"),
|
|
}
|
|
with open(out_dir / "manifest.json", 'w', encoding='utf-8') as f:
|
|
json.dump(manifest, f, indent=2)
|
|
|
|
def read_manifest(out_dir: Path) -> dict:
|
|
manifest_file = out_dir / "manifest.json"
|
|
if not manifest_file.exists():
|
|
return {}
|
|
try:
|
|
with open(manifest_file, 'r', encoding='utf-8') as f:
|
|
return json.load(f)
|
|
except:
|
|
return {} |