mirror of
https://github.com/FAUSheppy/ths-speech
synced 2025-12-09 12:18:34 +01:00
Server fixes
This commit is contained in:
@@ -1,3 +1,31 @@
|
||||
def parse_request(data):
|
||||
''' parse request and call correct function '''
|
||||
|
||||
# echo/test connection
|
||||
cleared_data = is_data_type(b"ECHOREQUEST,",data)
|
||||
if cleared_data:
|
||||
return cleared_data
|
||||
cleared_data = is_data_type(b"AUDIO_TRANSMISSION,",data)
|
||||
if cleared_data:
|
||||
with open("test.wav","wb") as f:
|
||||
f.write(cleared_data)
|
||||
return b"SUCCESS"
|
||||
|
||||
# other shit
|
||||
return b"UNRECOGNIZED_SERVER_OPTION\n"
|
||||
|
||||
|
||||
|
||||
def is_data_type(tag,data):
|
||||
data = data.strip(b"\n")
|
||||
if data.startswith(tag):
|
||||
ret = data.split(tag)[1]
|
||||
if not ret:
|
||||
ret = b"NULL\n"
|
||||
return ret
|
||||
return None
|
||||
|
||||
|
||||
def reply_logs(loglevel=0,lines=100):
|
||||
''' replies with recent logs '''
|
||||
pass
|
||||
@@ -21,3 +49,5 @@ def recive_transcribe_request(audiofile):
|
||||
''' saves and transcribes and audiofile '''
|
||||
pass
|
||||
|
||||
def android_unittest_transcribe_request(audiofile):
|
||||
''' the android unittests append a special keyword, requests are dummy handled '''
|
||||
|
||||
Reference in New Issue
Block a user