diff --git a/pyproject.toml b/pyproject.toml index 4886f84..aeefdfd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "simple-recorder" -version = "0.1.0" +version = "0.1.1" description = "A simple OBS recorder" authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }] dependencies = [ diff --git a/src/simple_recorder/app.py b/src/simple_recorder/app.py index 6515d39..f1301be 100644 --- a/src/simple_recorder/app.py +++ b/src/simple_recorder/app.py @@ -1,6 +1,7 @@ import logging from datetime import datetime +import clypi import FreeSimpleGUI as fsg import obsws_python as obsws from clypi import ClypiConfig, ClypiException, Command, Positional, arg, configure @@ -13,6 +14,9 @@ config = ClypiConfig( ) configure(config) +highlight = clypi.Styler(fg="green") +error = clypi.Styler(fg="red", bold=True) + class Start(Command): """Start recording.""" @@ -33,21 +37,23 @@ class Start(Command): @override async def run(self): if not self.filename: - raise ClypiException("Recording name cannot be empty.") + raise ClypiException(error("Recording name cannot be empty.")) with obsws.ReqClient( host=self.host, port=self.port, password=self.password ) as client: resp = client.get_record_status() if resp.output_active: - raise ClypiException("Recording is already active.") + raise ClypiException(error("Recording is already active.")) + filename = f"{self.filename} {self.get_timestamp()}" client.set_profile_parameter( "Output", "FilenameFormatting", - f"{self.filename} {self.get_timestamp()}", + filename, ) client.start_record() + print(f"Recording started with filename: {highlight(filename)}") class Stop(Command): @@ -64,9 +70,10 @@ class Stop(Command): ) as client: resp = client.get_record_status() if not resp.output_active: - raise ClypiException("Recording is not active.") + raise ClypiException(error("Recording is not active.")) client.stop_record() + print("Recording stopped successfully.") def theme_parser(value: str) -> str: