Final save
This commit is contained in:
1 parent
1ac196cb46
commit
afaf2e8474
9 files changed
+119
-23
No files matched your search
+1
-1
@@ -170,4 +170,4 @@ cython_debug/
|
||||
# PyPI configuration file
|
||||
.pypirc
|
||||
|
||||
|
||||
Sauvegarde-wav/
|
||||
@@ -19,3 +19,4 @@ To keep acces to the system, the RPI4 is set in AP mode.
|
||||
## Author
|
||||
|
||||
[Ange-Marie MAURIN](mailto://a-m.maurin@a2msystemes.fr)
|
||||
[Biscuit production](https://biscuit-production.fr)
|
||||
@@ -1,27 +1,45 @@
|
||||
import sys
|
||||
from enum import Enum
|
||||
from evdev import ecodes
|
||||
|
||||
|
||||
class EventTypes(Enum):
|
||||
|
||||
"""Keyboad event types"""
|
||||
PickUp = ecodes.KEY_F12
|
||||
Recording = ecodes.KEY_F11
|
||||
Playing = ecodes.KEY_F10
|
||||
FileSyn = ecodes.KEY_F9
|
||||
RecordTimeout = ecodes.KEY_F8
|
||||
if sys.platform != "win32":
|
||||
from evdev import ecodes
|
||||
class EventTypes(Enum):
|
||||
|
||||
"""Keyboad event types"""
|
||||
PickUp = ecodes.KEY_F12
|
||||
Recording = ecodes.KEY_F11
|
||||
Playing = ecodes.KEY_F10
|
||||
FileSyn = ecodes.KEY_F9
|
||||
RecordTimeout = ecodes.KEY_F8
|
||||
|
||||
class EventProducerType(Enum):
|
||||
Keyboard = ecodes.EV_KEY
|
||||
Timer = ecodes.EV_MAX
|
||||
Unknown = -1
|
||||
Player = 300
|
||||
Recorder = 301
|
||||
else:
|
||||
class EventTypes(Enum):
|
||||
|
||||
"""Keyboad event types"""
|
||||
PickUp = 12
|
||||
Recording = 11
|
||||
Playing = 10
|
||||
FileSyn = 9
|
||||
RecordTimeout = 8
|
||||
|
||||
class EventProducerType(Enum):
|
||||
Keyboard = 1
|
||||
Timer = 2
|
||||
Unknown = -1
|
||||
Player = 300
|
||||
Recorder = 301
|
||||
|
||||
|
||||
class EventVal(Enum):
|
||||
Pressed = 1
|
||||
Released = 0
|
||||
|
||||
class EventProducerType(Enum):
|
||||
Keyboard = ecodes.EV_KEY
|
||||
Timer = ecodes.EV_MAX
|
||||
Unknown = -1
|
||||
Player = 300
|
||||
Recorder = 301
|
||||
|
||||
|
||||
|
||||
class RayEventType(Enum):
|
||||
|
||||
@@ -9,7 +9,7 @@ from RayPonder import Events
|
||||
|
||||
|
||||
|
||||
class PhyEventLoop:
|
||||
class PhyEventLoopEvDev:
|
||||
def __init__(self, queue, config):
|
||||
self.device_path = config['phy-event']['gpio-dev-input']
|
||||
self.pickup_state = int(config["phy-event"]["pickup-state"])
|
||||
@@ -0,0 +1,51 @@
|
||||
# PhyEvents.py
|
||||
import keyboard
|
||||
import threading
|
||||
import queue
|
||||
# from RayPonder.Events import EventProducerType, RayEventType
|
||||
from RayPonder import Events
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class PhyEventLoopKeyboard:
|
||||
def __init__(self, queue, config):
|
||||
self.device_path = config['phy-event']['gpio-dev-input']
|
||||
self.pickup_state = int(config["phy-event"]["pickup-state"])
|
||||
# print(f"PhyEventLoop() : current state {self.pickup_state}")
|
||||
self.event_queue = queue
|
||||
self.running = False
|
||||
|
||||
def start(self):
|
||||
self.running = True
|
||||
self.thread = threading.Thread(target=self.read_events)
|
||||
self.thread.start()
|
||||
|
||||
def read_events(self):
|
||||
while self.running:
|
||||
try:
|
||||
event = keyboard.read_event()
|
||||
if event:
|
||||
print(event)
|
||||
if (event.event_type == keyboard.KEY_DOWN and event.name == "f12"):
|
||||
# print(f"PhyEventLoop() : Event received -> {event}")
|
||||
key_ev = Events.RayEvent(producer=self, producer_type=Events.EventProducerType.Keyboard, ray_event=Events.RayEventType.HangUp)
|
||||
if (event.event_type == self.pickup_state):
|
||||
key_ev.ray_event = Events.RayEventType.PickUp
|
||||
print(f"ending value {key_ev.ray_event.name}")
|
||||
# print(f"PhyEventLoop() : sending -> {key_ev.ray_event.name}")
|
||||
self.event_queue.put(key_ev)
|
||||
except queue.Empty:
|
||||
pass
|
||||
|
||||
def stop(self):
|
||||
self.running = False
|
||||
self.thread.join()
|
||||
|
||||
def get_event(self):
|
||||
try:
|
||||
return self.event_queue.get(timeout=1)
|
||||
except queue.Empty:
|
||||
return None
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
# RayPonder/__init__.py
|
||||
from .PhyEventLoop import PhyEventLoop
|
||||
import sys
|
||||
if sys.platform == "win32":
|
||||
from .PhyEventLoopKeyboard import PhyEventLoopKeyboard as PhyEventLoop
|
||||
else:
|
||||
from .PhyEventLoopEvdev import PhyEventLoopEvDev as PhyEventLoop
|
||||
# from .PhyEventLoop import PhyEventLoop
|
||||
from .EventTypes import EventTypes, EventVal, EventProducerType, RayEventType
|
||||
from .RayEvent import RayEvent
|
||||
@@ -0,0 +1,20 @@
|
||||
from paramiko import SSHClient, WarningPolicy
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(prog="N999", description="Download files in selected ssh directory", epilog="made with love, used with care")
|
||||
parser.add_argument("--host", type=str, default="coope-birthday2.local", help="The host to connect to")
|
||||
parser.add_argument("--user", type=str, default="coope", help="The user to connect as")
|
||||
parser.add_argument("--record-folder", type=str, default="/coope/", help="path to record folder")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
client = SSHClient()
|
||||
client.set_missing_host_key_policy(WarningPolicy())
|
||||
password = "C0op3r@tive"
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(f"{args.host}, {args.user}, {args.record_folder}")
|
||||
client.connect(args.host, username=args.user, password=password)
|
||||
stdin, stdout, stderr = client.exec_command(f"cd {args.record_folder}; ls -la")
|
||||
print(stdout.readlines())
|
||||
client.close()
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
[general]
|
||||
root= /mnt/coope_drive/
|
||||
root= ./
|
||||
[recorder]
|
||||
add-uuid = yes
|
||||
dest-dir = records/
|
||||
@@ -15,7 +15,7 @@ format = 32
|
||||
recode-timeout = 10
|
||||
[player]
|
||||
message-path = messages/
|
||||
start-message = message01.wav
|
||||
start-message = Cabine6.wav
|
||||
[phy-event]
|
||||
gpio-dev-input = /dev/input/event0
|
||||
pickup-state = 0
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
evdev==1.9.1
|
||||
evdev==1.9.1; sys.platform == 'linux'
|
||||
keyboard==0.13.5; sys.platform == 'win32'
|
||||
PyAudio==0.2.14
|
||||
uuid==1.30
|
||||
Reference in new issue
Block a user