Browse Source

added more runtime files

Toastie 4 years ago
parent
commit
2a8c54196c
3 changed files with 4 additions and 28 deletions
  1. 2 0
      rfidac/.gitignore
  2. 2 0
      rfidac/docker-compose.yml
  3. 0 28
      rfidac/rfid-test.py

+ 2 - 0
rfidac/.gitignore

@@ -1 +1,3 @@
 data/.ash_history
+data/.bash_history
+[0-9]*

+ 2 - 0
rfidac/docker-compose.yml

@@ -11,3 +11,5 @@ services:
       - mpd_folder=${mpd_folder}
     volumes:
       - ../mopidy/data/mopidy/music:/music
+      - ./data:/opt
+    command: ["/usr/bin/python3","-u","/opt/rfidac.py"]

+ 0 - 28
rfidac/rfid-test.py

@@ -1,28 +0,0 @@
-#! /usr/bin/python3
-
-import os
-import subprocess
-import logging
-from shutil import copyfile
-from datetime import datetime
-from evdev import InputDevice, ecodes
-
-logging.basicConfig(level=logging.DEBUG)
-
-def read_rfid():
-    combined_string = ""
-    for event in InputDevice("/dev/input/event0").read_loop():
-        if event.type == ecodes.EV_KEY and event.value == 0:  # value 0 = release key
-            if event.code == 28:  # code 28 = KEY_ENTER
-                return combined_string
-            # [4:5]? .. KEY[] starts with 'KEY_' and we expect one char
-            combined_string += ecodes.KEY[event.code][4:5] 
-
-last_rfid = None
-last_ts = datetime.now()
-while True:
-    rfid = read_rfid()
-    seconds_gone = (datetime.now() - last_ts).total_seconds()
-    print(rfid)
-    last_ts = datetime.now()
-    last_rfid = rfid