diff options
-rwxr-xr-x | vhs_recorder.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vhs_recorder.py b/vhs_recorder.py new file mode 100755 index 0000000..574a7ff --- /dev/null +++ b/vhs_recorder.py @@ -0,0 +1,20 @@ +#!/usr/bin/python3 + +import evdev +import time + +dev = evdev.InputDevice('/dev/input/by-path/pci-0000:00:12.2-usb-0:4.4:1.0-event-mouse') + +dev.grab() + +for event in dev.read_loop(): + if not event.code: + continue + print('event code: ', event.code) + if event.code == 274 and event.value == 1: + print("2h record requested") + time.sleep(3) + # remove pending event after job before waiting for a new one + while dev.read_one(): + pass + print('iteration done') |