-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
37 lines (30 loc) · 859 Bytes
/
main.py
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
import os
import sys
sys.path.append(os.path.abspath('.'))
from piclap import *
from bravia import tv_volume_up, hdmi_switch, tv_turn_on, tv_turn_off, tv_volume_up, tv_volume_down
class Config(Settings):
'''Describes custom configurations and action methods to be executed based
on the number of claps detected.
'''
def __init__(self):
Settings.__init__(self)
self.method.value = 10000
def on1Claps(self):
tv_turn_on()
def on2Claps(self):
tv_turn_off()
def on3Claps(self):
tv_volume_up()
def on4Claps(self):
tv_volume_down()
def on5Claps(self):
tv_volume_down()
def on6Claps(self):
tv_volume_down()
def main():
config = Config()
listener = Listener(config=config, calibrate=False)
listener.start()
if __name__ == '__main__':
main()