Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose toggle-pause command, closes #51 #58

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "obs-cmd"
version = "0.17.7"
version = "0.17.8"
edition = "2021"
description = "A minimal command to control obs via obs-websocket"
authors = ["Luigi Maselli <[email protected]>"]
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ obs-cmd scene switch @cam-front
obs-cmd scene-collection switch <collection>
obs-cmd scene-item toggle <scene> <item>
obs-cmd toggle-mute Mic/Aux
obs-cmd recording start
obs-cmd recording stop
obs-cmd recording toggle
obs-cmd recording pause
obs-cmd recording resume
obs-cmd recording toggle-pause
obs-cmd recording status
obs-cmd streaming start
obs-cmd virtualcam start
Expand All @@ -30,7 +35,7 @@ obs-cmd --websocket obsws://localhost:4455/secret info # You can override the de

You can override the websocket URL, which can be found in OBS -> Tools -> WebSocket Server Settings. `localhost` for the hostname will work for most, instead of the full IP address. If you set the password as `secret` you can avoid to specify the `--websocket` argument.

### Installation
### Installation


### Using the provided Binaries
Expand Down Expand Up @@ -64,7 +69,7 @@ sudo cp target/release/obs-cmd /usr/local/bin/obs-cmd
```

### Installing on Arch Linux
The `obs-cmd` package is maintained on the [Arch User Repository](https://aur.archlinux.org/packages/obs-cmd).
The `obs-cmd` package is maintained on the [Arch User Repository](https://aur.archlinux.org/packages/obs-cmd).

Ensure that [rust](https://archlinux.org/packages/extra/x86_64/rust/) is installed for access to `cargo`.

Expand Down Expand Up @@ -96,10 +101,10 @@ sudo pacman -U obs-cmd-0.15.3-1-x86_64.pkg.tar.zst

### Example Usage
```
$ obs-cmd recording start
$ obs-cmd recording start
Recording started
Result: Ok(())
$ obs-cmd recording stop
$ obs-cmd recording stop

$ obs-cmd info
Version: Version { obs_version: Version { major: 29, minor: 1, patch: 1 }, obs_web_socket_version: Version { major: 5, minor: 2, patch: 2 }, rpc_version: 1, available_requests: ..
Expand Down
3 changes: 3 additions & 0 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ pub enum Recording {
Stop,
Toggle,
Status,
Pause,
Resume,
TogglePause,
}

#[derive(Parser)]
Expand Down
15 changes: 15 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,21 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Bytes: {:?}", status.bytes);
}
}
Pause => {
let res = client.recording().pause().await;
println!("Recording paused");
println!("Result: {:?}", res);
}
Resume => {
let res = client.recording().resume().await;
println!("Recording resumed");
println!("Result: {:?}", res);
}
TogglePause => {
let res = client.recording().toggle_pause().await;
println!("Recording pause toggled");
println!("Result: {:?}", res);
}
}
}

Expand Down