Initial commit
This commit is contained in:
commit
b22231c8b6
40 changed files with 2443 additions and 0 deletions
24
backend/services/manifest.py
Normal file
24
backend/services/manifest.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
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 {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue