From b177a85ca2cc8143b0b3a5a477e85cddacdd03d3 Mon Sep 17 00:00:00 2001 From: VG Date: Tue, 29 Mar 2016 23:20:01 +0200 Subject: first commit --- vhs_recorder.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 vhs_recorder.py 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') -- cgit v1.2.3