-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathhooks.forth
More file actions
43 lines (37 loc) · 1.27 KB
/
Copy pathhooks.forth
File metadata and controls
43 lines (37 loc) · 1.27 KB
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
: on-click ( -- ) \ Click hook
nil "time=" :: time-ms :: str-join \ payload
nil server-url @ :: "/hooks/click.php" :: str-join \ url
http-post
drop drop ;
: on-dbl-click ( -- ) \ Double click hook
play-midi-ack
nil "time=" :: time-ms :: str-join \ payload
nil server-url @ :: "/hooks/dblclick.php" :: str-join \ url
http-post
drop drop ;
: on-ears ( -- ) \ Ears hook
play-midi-acquired
nil "left=" :: left-ear-position :: "&right=" :: right-ear-position :: str-join \ payload
nil server-url @ :: "/hooks/ears.php" :: str-join \ url
http-post
drop drop ;
: on-time ( -- ) \ Hour hook
sleeping? invert if \ if not sleeping
nil server-url @ :: "/config/clock/" :: language @ :: "/" :: get-hour :: "/" :: 6 random 1 + :: ".mp3" :: str-join \ url
play-url
then ;
: on-halftime ( -- ) \ Half-hour hook
\ Disabled: there is no config/clockall/it directory in this resource set.
nil ;
: on-rfid ( rfid -- ) \ RFID hook
>r
nil "tag=" :: >r :: str-join \ payload
nil server-url @ :: "/hooks/rfid.php" :: str-join \ url
http-post
drop drop ;
: say ( text -- ) \ Text to speech
sleeping? invert if \ if not sleeping
url-encode >r
nil "http://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&textlen=32&client=tw-ob&tl=" :: language @ :: "&q=" :: r> :: str-join \ url
play-url
then ;