Mikaël Capelle 8308940674
Some checks failed
continuous-integration/drone/push Build is failing
Allow creation of avi video.
2024-12-15 14:07:32 +01:00

27 lines
761 B
Python

import logging
from pathlib import Path
from typing import Final
from ..base import FileHandler
class SimpleFileHandler(FileHandler):
def __init__(self, logger: logging.Logger, folder: Path):
self.logger: Final = logger
self.folder: Final = folder
def make_path(self, filename: str) -> Path:
return self.folder.joinpath(filename)
def notify_created(self, path: Path): ...
def _create(self, path: Path, content: bytes, text: bool = False):
if text:
for line in content.decode("utf-8").splitlines():
self.logger.info(line)
else:
self.folder.mkdir(exist_ok=True)
with open(path, "wb") as fp:
fp.write(content)
return path