obsws-ruby/examples/scene_rotate/main.rb

25 lines
536 B
Ruby
Raw Normal View History

2023-07-21 06:37:14 +01:00
require_relative "../../lib/obsws"
2023-07-19 15:13:26 +01:00
require "yaml"
2022-10-25 00:05:12 +01:00
OBSWS::LOGGER.info!
2023-07-21 06:37:14 +01:00
class Main
def conn_from_yaml
YAML.load_file("obs.yml", symbolize_names: true)[:connection]
end
2022-10-25 00:05:12 +01:00
2023-07-21 06:37:14 +01:00
def run
OBSWS::Requests::Client.new(**conn_from_yaml).run do |client|
resp = client.get_scene_list
resp.scenes.reverse_each do |scene|
puts "Switching to scene #{scene[:sceneName]}"
client.set_current_program_scene(scene[:sceneName])
sleep(0.5)
end
2022-10-25 00:05:12 +01:00
end
end
end
2023-07-21 06:37:14 +01:00
Main.new.run if $PROGRAM_NAME == __FILE__