mirror of
https://github.com/onyx-and-iris/obsws-ruby.git
synced 2026-04-18 13:33:31 +00:00
raekfile updated
rework examples
This commit is contained in:
@@ -1,21 +1,24 @@
|
||||
require "obsws"
|
||||
require_relative "../../lib/obsws"
|
||||
require "yaml"
|
||||
|
||||
OBSWS::LOGGER.info!
|
||||
|
||||
def conn_from_yaml
|
||||
YAML.load_file("obs.yml", symbolize_names: true)[:connection]
|
||||
end
|
||||
class Main
|
||||
def conn_from_yaml
|
||||
YAML.load_file("obs.yml", symbolize_names: true)[:connection]
|
||||
end
|
||||
|
||||
def main
|
||||
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)
|
||||
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
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
main if $0 == __FILE__
|
||||
|
||||
Main.new.run if $PROGRAM_NAME == __FILE__
|
||||
|
||||
Reference in New Issue
Block a user