Adapted recorder.rb and generate_gifs.sh to websockets.
This commit is contained in:
26
src/tools/list_effects.rb
Executable file
26
src/tools/list_effects.rb
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env ruby
|
||||
require 'websocket-eventmachine-client'
|
||||
require 'json'
|
||||
|
||||
IP = ARGV[0] or raise "No IP given"
|
||||
uri = "ws://#{IP}:80/ws"
|
||||
|
||||
EM.run do
|
||||
ws = WebSocket::EventMachine::Client.connect(uri: uri)
|
||||
|
||||
ws.onopen do
|
||||
ws.send "effects?"
|
||||
end
|
||||
|
||||
ws.onmessage do |msg, type|
|
||||
if type==:text
|
||||
j = JSON.parse(msg)
|
||||
if j["effects"]
|
||||
j["effects"].each do |effect|
|
||||
puts effect
|
||||
end
|
||||
exit
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user