Skip to content

Commit

Permalink
Merge pull request #7 from xNicklaj/main
Browse files Browse the repository at this point in the history
  • Loading branch information
pschmitt authored Feb 17, 2024
2 parents 57f59bf + b8ed415 commit f1a849f
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions obs_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ def parse_args():
help="status/start/stop/toggle",
)

replay_parser = subparsers.add_parser("replay")
replay_parser.add_argument(
"action",
choices=["status", "start", "stop", "toggle", "save"],
default="status",
help="status/start/stop/toggle",
)

return parser.parse_args()


Expand Down Expand Up @@ -327,6 +335,26 @@ def stream_toggle(cl):
return cl.toggle_stream()


def replay_start(cl):
return cl.start_replay_buffer()


def replay_stop(cl):
return cl.stop_replay_buffer()


def replay_save(cl):
return cl.save_replay_buffer()


def replay_toggle(cl):
return cl.toggle_replay_buffer()


def replay_status(cl):
return cl.get_replay_buffer_status().output_active


def record_status(cl):
return cl.get_record_status().output_active

Expand Down Expand Up @@ -550,6 +578,26 @@ def main():
res = record_toggle(cl)
LOGGER.debug(res)

elif cmd == "replay":
if args.action == "status":
res = replay_status(cl)
LOGGER.debug(res)
if args.quiet:
sys.exit(0 if res else 1)
print("started" if res else "stopped")
elif args.action == "start":
res = replay_start(cl)
LOGGER.debug(res)
elif args.action == "stop":
res = replay_stop(cl)
LOGGER.debug(res)
elif args.action == "toggle":
res = replay_toggle(cl)
LOGGER.debug(res)
elif args.action == "save":
res = replay_save(cl)
LOGGER.debug(res)

return 0
except ObsItemNotFoundException as ecp:
print(f"ERROR {ecp}", file=sys.stderr)
Expand Down

0 comments on commit f1a849f

Please sign in to comment.