From 262f2edc5d2ece0fd283fefa3606450bfef628d7 Mon Sep 17 00:00:00 2001 From: Joe Rayhawk Date: Sat, 9 Apr 2022 22:50:58 -0700 Subject: crystal/irc.cr: obs: minor improvements to exception and reporting logic --- crystal/irc.cr | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'crystal/irc.cr') diff --git a/crystal/irc.cr b/crystal/irc.cr index 391f2c8..5d2283c 100644 --- a/crystal/irc.cr +++ b/crystal/irc.cr @@ -142,7 +142,7 @@ end lastvoice = Array(String).new -# OBS +# obs-websocket spawn do loop do begin @@ -179,6 +179,8 @@ spawn do obsipc.send( request.to_json ) when "SourceFilterVisibilityChanged" ircipc.send( { "##{settings["channel"]}", "| obs: source #{json["sourceName"]} filter #{json["filterName"]} visibility is now #{json["filterEnabled"]}" } ) + when "SceneItemVisibilityChanged" + ircipc.send( { "##{settings["channel"]}", "| obs: source #{json["item-name"]} visibility is now #{json["item-visible"].as_bool}" } ) end print( "RECEIVED: ") print( json.to_pretty_json ) @@ -204,12 +206,15 @@ spawn do end end obs_pubsub.run + rescue ex : IO::Error + pp ex + ircipc.send( { "#" + settings["channel"], "obs.cr:obs: " + ex.to_s.gsub(/\r|\n/, ' ') + ": Maybe try again in 10 seconds?" } ) rescue ex : Socket::ConnectError # these are a bit noisy pp ex obs_pubsub && obs_pubsub.close rescue ex - ircmsg( settings["home"], settings["channel"], "irc.cr: " + ex.to_s.gsub(/\r|\n/, ' ') ) + ircmsg( settings["home"], settings["channel"], "irc.cr:obs: " + ex.to_s.gsub(/\r|\n/, ' ') ) puts ex obs_pubsub && obs_pubsub.close end -- cgit v1.2.3