You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
obws/examples/iter_scenes.rs

27 lines
616 B
Rust

3 years ago
use std::{env, time::Duration};
use anyhow::Result;
use obws::Client;
3 years ago
#[tokio::main]
async fn main() -> Result<()> {
dotenvy::dotenv().ok();
3 years ago
env::set_var("RUST_LOG", "obws=debug");
tracing_subscriber::fmt::init();
3 years ago
let client = Client::connect("localhost", 4455, env::var("OBS_PASSWORD").ok()).await?;
3 years ago
let scene_list = client.scenes().list().await?;
3 years ago
for scene in scene_list.scenes.iter().cycle() {
client
.scenes()
.set_current_program_scene(&*scene.name)
.await?;
3 years ago
tokio::time::sleep(Duration::from_secs(1)).await;
}
Ok(())
}