File size: 614 Bytes
1425afc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from __future__ import annotations

import shutil
from pathlib import Path

from renderer.core.utils import safe_filename


class ExportManager:
    def __init__(self, exports_dir: Path) -> None:
        self.exports_dir = exports_dir
        self.exports_dir.mkdir(parents=True, exist_ok=True)

    def save(self, source: Path, job_id: str, output_name: str) -> Path:
        filename = safe_filename(output_name)
        if not filename.lower().endswith(".mp4"):
            filename += ".mp4"
        target = self.exports_dir / f"{job_id}_{filename}"
        shutil.copy2(source, target)
        return target