fixes bug reading config file

upd Gemfile
This commit is contained in:
onyx-and-iris 2023-08-31 00:44:54 +01:00
parent 59cda8aca6
commit c4fb560e8c
2 changed files with 5 additions and 4 deletions

View File

@ -2,4 +2,4 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "obsws", "~> 0.5.8" gem "obsws", "~> 0.6.2"

View File

@ -8,7 +8,7 @@ class Main
@vm = vm @vm = vm
@obsws = OBSWS::Events::Client.new(**kwargs) @obsws = OBSWS::Events::Client.new(**kwargs)
@obsws.on :on_current_program_scene_changed do |data| @obsws.on :current_program_scene_changed do |data|
scene = data.scene_name scene = data.scene_name
puts "Switched to scene #{scene}" puts "Switched to scene #{scene}"
if respond_to?("on_#{scene.downcase}") if respond_to?("on_#{scene.downcase}")
@ -16,7 +16,7 @@ class Main
end end
end end
@obsws.on :on_exit_started do |data| @obsws.on :exit_started do |data|
puts "OBS closing!" puts "OBS closing!"
@obsws.close @obsws.close
@running = false @running = false
@ -54,7 +54,8 @@ class Main
end end
def conn_from_yml def conn_from_yml
YAML.load_file("config.yaml", symbolize_names: true)[:connection] pn = Pathname.new(__dir__).join("config.yaml")
YAML.load_file(pn, symbolize_names: true)[:connection]
end end
if $PROGRAM_NAME == __FILE__ if $PROGRAM_NAME == __FILE__