mirror of
https://github.com/onyx-and-iris/simple-recorder.git
synced 2025-07-27 06:11:59 +00:00
- CLI command added - GUI button mouse/keyboard events implemented. closes #1
29 lines
895 B
Python
29 lines
895 B
Python
import obsws_python as obsws
|
|
from clypi import Command, arg
|
|
from typing_extensions import override
|
|
|
|
from .errors import SimpleRecorderError
|
|
|
|
|
|
class Stop(Command):
|
|
"""Stop recording."""
|
|
|
|
host: str = arg(inherited=True)
|
|
port: int = arg(inherited=True)
|
|
password: str = arg(inherited=True)
|
|
|
|
@override
|
|
async def run(self):
|
|
try:
|
|
with obsws.ReqClient(
|
|
host=self.host, port=self.port, password=self.password, timeout=3
|
|
) as client:
|
|
resp = client.get_record_status()
|
|
if not resp.output_active:
|
|
raise SimpleRecorderError("Recording is not active.")
|
|
|
|
client.stop_record()
|
|
print("Recording stopped successfully.")
|
|
except (ConnectionRefusedError, TimeoutError):
|
|
raise SimpleRecorderError("Failed to connect to OBS. Is it running?")
|