feat: mumble instead of parole
This commit is contained in:
@@ -10,16 +10,24 @@ OP_PING = 'PING'.encode()
|
||||
OP_OK = 'OK'.encode()
|
||||
OP_ERROR = 'ERROR'.encode()
|
||||
|
||||
def exec_mumble(deaf: bool):
|
||||
subprocess.Popen(['mumble', 'rpc', 'deaf' if deaf else 'undeaf'])
|
||||
|
||||
def deaf_mumble():
|
||||
exec_mumble(true)
|
||||
|
||||
def undeaf_mumble():
|
||||
exec_mumble(false)
|
||||
|
||||
class CallManager:
|
||||
def __init__(self, config):
|
||||
self.config = config
|
||||
self.state = NO_CALL
|
||||
self.station = None
|
||||
self.call_process = None
|
||||
|
||||
def call(self, station):
|
||||
try:
|
||||
self.call_process = subprocess.Popen(['parole', '-c', station['host'], '-d', self.config['audio device']])
|
||||
undeaf_mumble()
|
||||
s = socket.socket()
|
||||
print('host=', station['host'])
|
||||
print('port=', station['port'])
|
||||
@@ -34,10 +42,9 @@ class CallManager:
|
||||
except Exception as e:
|
||||
print('Error al realizar la llamada: ', e)
|
||||
station['green'].off()
|
||||
self.call_process.terminate()
|
||||
self.call_process.communicate()
|
||||
|
||||
def incoming_call(self, station):
|
||||
undeaf_mumble()
|
||||
self.state = INCOMING_CALL
|
||||
self.station = station
|
||||
station['red'].on()
|
||||
@@ -46,9 +53,7 @@ class CallManager:
|
||||
print('Hang! self.station', self.station)
|
||||
if self.station is not None:
|
||||
self.station['red'].off()
|
||||
if self.call_process is not None:
|
||||
self.call_process.terminate()
|
||||
self.call_process.communicate()
|
||||
deaf_mumble()
|
||||
self.state = NO_CALL
|
||||
self.station = None
|
||||
|
||||
|
||||
@@ -102,9 +102,7 @@ for _station in stations:
|
||||
try:
|
||||
while True:
|
||||
for _station in stations:
|
||||
# new_input_state = GPIO.input(_station['button'])
|
||||
new_input_state = _station['btn'].is_pressed
|
||||
# print('new_input_state ', new_input_state)
|
||||
# Al pulsar el interruptor cambia el estado.
|
||||
elapsed_time = time.clock_gettime(time.CLOCK_MONOTONIC) - _station['button state changed time']
|
||||
if new_input_state != _station['old button state'] and elapsed_time > 0.2:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
[Unit]
|
||||
Description=Parole
|
||||
Description=Mumble
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/parole -la -d plughw:1,0
|
||||
ExecStart=xvfb-run mumble mumble://uli@miki
|
||||
WorkingDirectory=/home/pi
|
||||
StandardOutput=inherit
|
||||
StandardError=inherit
|
||||
Reference in New Issue
Block a user