mirror of
https://github.com/damp11113/IDRB.git
synced 2025-04-27 06:28:09 +00:00
update
This commit is contained in:
parent
118bb7aa72
commit
ed8ab5ef9f
@ -241,6 +241,7 @@ class App:
|
||||
|
||||
if len(data) == 0:
|
||||
dpg.configure_item("serverstatus", default_value='lost connected', color=(255, 0, 0))
|
||||
<<<<<<< Updated upstream
|
||||
socket.close()
|
||||
if self.cprotocol == "TCP":
|
||||
socket.close()
|
||||
@ -256,6 +257,23 @@ class App:
|
||||
break # No more messages
|
||||
else:
|
||||
raise
|
||||
=======
|
||||
if self.cprotocol == "TCP":
|
||||
socket.close()
|
||||
elif self.cprotocol == "ZeroMQ":
|
||||
while True:
|
||||
try:
|
||||
message = socket.recv(zmq.NOBLOCK)
|
||||
if message is None:
|
||||
break # No more messages
|
||||
# Process the received message if needed
|
||||
print(f"Received message: {message.decode()}")
|
||||
except zmq.error.ZMQError as e:
|
||||
if e.errno == zmq.EAGAIN:
|
||||
break # No more messages
|
||||
else:
|
||||
raise
|
||||
>>>>>>> Stashed changes
|
||||
socket.close()
|
||||
else:
|
||||
socket.close()
|
||||
@ -324,7 +342,11 @@ class App:
|
||||
data = datadecoded["channel"][self.readchannel]["Content"]
|
||||
|
||||
if len(data) == 0:
|
||||
<<<<<<< Updated upstream
|
||||
dpg.configure_item("serverstatus", default_value=f'connected but no audio', color=(255, 0, 0))
|
||||
=======
|
||||
dpg.configure_item("serverstatus", default_value=f'connected No audio', color=(255, 0, 0))
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
if self.ccisdecryptpassword and self.ccisencrypt:
|
||||
try:
|
||||
@ -378,6 +400,7 @@ class App:
|
||||
bytesconunt_frame += 1
|
||||
else:
|
||||
streamoutput.close()
|
||||
<<<<<<< Updated upstream
|
||||
if self.cprotocol == "TCP":
|
||||
socket.close()
|
||||
elif self.cprotocol == "ZeroMQ":
|
||||
@ -392,6 +415,24 @@ class App:
|
||||
break # No more messages
|
||||
else:
|
||||
raise
|
||||
=======
|
||||
socket.close()
|
||||
if self.cprotocol == "TCP":
|
||||
socket.close()
|
||||
elif self.cprotocol == "ZeroMQ":
|
||||
while True:
|
||||
try:
|
||||
message = socket.recv(zmq.NOBLOCK)
|
||||
if message is None:
|
||||
break # No more messages
|
||||
# Process the received message if needed
|
||||
print(f"Received message: {message.decode()}")
|
||||
except zmq.error.ZMQError as e:
|
||||
if e.errno == zmq.EAGAIN:
|
||||
break # No more messages
|
||||
else:
|
||||
raise
|
||||
>>>>>>> Stashed changes
|
||||
socket.close()
|
||||
else:
|
||||
socket.close()
|
||||
@ -406,6 +447,7 @@ class App:
|
||||
streamoutput.close()
|
||||
except:
|
||||
pass
|
||||
<<<<<<< Updated upstream
|
||||
socket.close()
|
||||
if self.cprotocol == "TCP":
|
||||
socket.close()
|
||||
@ -421,6 +463,23 @@ class App:
|
||||
break # No more messages
|
||||
else:
|
||||
raise
|
||||
=======
|
||||
if self.cprotocol == "TCP":
|
||||
socket.close()
|
||||
elif self.cprotocol == "ZeroMQ":
|
||||
while True:
|
||||
try:
|
||||
message = socket.recv(zmq.NOBLOCK)
|
||||
if message is None:
|
||||
break # No more messages
|
||||
# Process the received message if needed
|
||||
print(f"Received message: {message.decode()}")
|
||||
except zmq.error.ZMQError as e:
|
||||
if e.errno == zmq.EAGAIN:
|
||||
break # No more messages
|
||||
else:
|
||||
raise
|
||||
>>>>>>> Stashed changes
|
||||
socket.close()
|
||||
else:
|
||||
socket.close()
|
||||
|
@ -11,6 +11,9 @@ from Crypto.Cipher import AES
|
||||
from Crypto.Protocol.KDF import scrypt
|
||||
from Crypto.Random import get_random_bytes
|
||||
import zmq
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||
|
||||
def pad_message(message_bytes):
|
||||
block_size = AES.block_size
|
||||
@ -66,7 +69,7 @@ p = pyaudio.PyAudio()
|
||||
sample_rate = 48000
|
||||
bytes_per_sample = p.get_sample_size(pyaudio.paInt16)
|
||||
|
||||
|
||||
logging.info('init audio device')
|
||||
device_name_input = "Line 5 (Virtual Audio Cable)"
|
||||
device_index_input = 0
|
||||
for i in range(p.get_device_count()):
|
||||
@ -86,7 +89,7 @@ for i in range(p.get_device_count()):
|
||||
streaminput = p.open(format=pyaudio.paInt16, channels=2, rate=sample_rate, input=True, input_device_index=device_index_input)
|
||||
streaminput2 = p.open(format=pyaudio.paInt16, channels=2, rate=sample_rate, input=True, input_device_index=device_index_input2)
|
||||
|
||||
|
||||
logging.info('starting RDS')
|
||||
thread = threading.Thread(target=_RDS.update_RDS)
|
||||
thread.start()
|
||||
|
||||
@ -137,6 +140,8 @@ def encode_audio2():
|
||||
|
||||
#channel2.put(pcm2.tobytes()) # if you use pcm
|
||||
|
||||
logging.info('starting audio encoding')
|
||||
|
||||
audio_thread = threading.Thread(target=encode_audio)
|
||||
audio_thread.start()
|
||||
|
||||
@ -237,7 +242,7 @@ def handle_client():
|
||||
|
||||
# Your main server logic using threading for handling connections
|
||||
if __name__ == "__main__":
|
||||
print("server is running")
|
||||
logging.info('server is running')
|
||||
if protocol == "TCP":
|
||||
while True:
|
||||
print("Waiting for a connection...")
|
||||
|
Loading…
x
Reference in New Issue
Block a user