Allow creation of avi video.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Mikaël Capelle
2024-12-15 13:37:17 +01:00
parent bc06f86fdc
commit 8308940674
6 changed files with 207 additions and 136 deletions

View File

@@ -1,3 +1,4 @@
import os
from pathlib import Path
from typing import Final
@@ -9,9 +10,14 @@ class FileHandlerAPI(FileHandler):
def __init__(self, folder: Path):
self.folder: Final = folder
def create(self, filename: str, content: bytes, text: bool = False):
self.folder.mkdir(exist_ok=True)
with open(self.folder.joinpath(filename), "wb") as fp:
fp.write(content)
dump_api_message("file", {"filename": filename, "size": len(content)})
def make_path(self, filename: str) -> Path:
return self.folder.joinpath(filename)
def notify_created(self, path: Path):
dump_api_message("file", {"filename": path.name, "size": os.stat(path).st_size})
def _create(self, path: Path, content: bytes, text: bool = False):
self.folder.mkdir(exist_ok=True)
with open(path, "wb") as fp:
fp.write(content)
return path