Files
ETPlot/orchestration/backup.py
T
Kylian Schmidt 72ebc5e103 feat: Implement metadata system and reorganize project structure
 Features:
- Add comprehensive metadata system with YAML/JSON support
- Implement hierarchical metadata inheritance from parent folders
- Support plot-specific metadata overrides
- Add metadata caching for performance optimization

🗂️ Code Organization:
- Move Python orchestration code to orchestration/ folder
- Move validation utilities to tests/ folder
- Move documentation to docs/ folder
- Separate metadata functionality into dedicated module

🔧 Infrastructure:
- Add automatic asset copying to web directory
- Fix asset path resolution for nested directories
- Update template to use dynamic asset paths
- Add MetadataConfig class with inheritance options

📚 Documentation:
- Add comprehensive metadata usage guide (METADATA_USAGE.md)
- Add implementation documentation (METADATA_IMPLEMENTATION.md)
- Include example metadata files in examples/
- Add metadata validation utility script

🐛 Bug Fixes:
- Fix breadcrumb navigation and JavaScript functionality
- Resolve asset path issues in nested directories
- Update template imports for modular CSS/JS structure

This commit introduces a flexible metadata system that allows users to add
rich metadata to plots and folders using YAML or JSON files, with full
hierarchical inheritance and plot-specific overrides. The project structure
is now better organized with clear separation of concerns.
2025-07-08 12:33:49 +02:00

24 lines
708 B
Python

import zipfile
import datetime
from pathlib import Path
WEB_FOLDER = Path("plots")
BACKUP_FOLDER = Path("backups")
today = datetime.date.today().strftime("%Y%m%d")
backup_name = f"backup-{today}.zip"
backup_path = BACKUP_FOLDER / backup_name
BACKUP_FOLDER.mkdir(parents=True, exist_ok=True)
if backup_path.exists():
print(f"Backup already exists: {backup_path}")
else:
print(f"Creating backup: {backup_path}")
with zipfile.ZipFile(backup_path, "w", zipfile.ZIP_DEFLATED) as zipf:
for path in WEB_FOLDER.rglob("*"):
if path.is_file():
arcname = path.relative_to(WEB_FOLDER.parent)
zipf.write(path, arcname)
print("✅ Backup complete.")