-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.rb
46 lines (35 loc) · 906 Bytes
/
server.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require 'osc-0.1.4/lib/osc'
include OSC
@ss = SimpleServer.new(5600)
def add_method(id)
@ss.add_method(id) do |msg|
yield msg if msg.to_a.first.nonzero?
end
end
%w{ up down left right }.each do |dir|
add_method("/wii/button/#{dir}") do
%x{osascript apple_scripts/#{dir}_arrow.scpt}
end
end
add_method("/wii/button/a") do
%x{osascript apple_scripts/enter_key.scpt}
end
add_method("/wii/button/b") do
%x{osascript apple_scripts/main_menu.scpt}
end
add_method("/wii/button/plus") do
%x{osascript apple_scripts/quit.scpt}
end
add_method("/wii/button/minus") do
%x{osascript apple_scripts/sleep.scpt}
end
add_method("/wii/button/home") do
%x{osascript apple_scripts/play_dvd.scpt}
end
add_method("/wii/button/one") do
%x{osascript apple_scripts/volume_up.scpt}
end
add_method("/wii/button/two") do
%x{osascript apple_scripts/volume_down.scpt}
end
@ss.run