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