YT_Video / packager.py
Shami96's picture
Create packager.py
d39e22c verified
raw
history blame contribute delete
507 Bytes
import json
import shutil
from pathlib import Path
def write_text(text: str, path: Path):
with open(path, "w", encoding="utf-8") as f:
f.write(text)
def write_manifest(run_dir: Path, meta: dict):
with open(run_dir / "manifest.json", "w", encoding="utf-8") as f:
json.dump(meta, f, indent=2)
def make_zip(run_dir: Path) -> Path:
zip_path = run_dir.with_suffix("") # base name
shutil.make_archive(str(zip_path), "zip", str(run_dir))
return Path(str(zip_path) + ".zip")