Yet another attempt and handling charsets.
This commit is contained in:
parent
a0e539d3ce
commit
78f7ae506d
@ -248,26 +248,33 @@ class SpeechHandler:
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
line = process.stdout.readline()
|
line = process.stdout.readline()
|
||||||
# Keep gzdoom's existing functionality of lines being printed to the console.
|
if not isinstance(line, str):
|
||||||
print(line, end='')
|
line = line.decode('utf-8', errors='replace')
|
||||||
|
|
||||||
if not line:
|
if not line:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
# Keep gzdoom's existing functionality of lines being printed to the console
|
||||||
|
print(line, end='', flush=True)
|
||||||
|
|
||||||
lineStr = line.strip()
|
lineStr = line.strip()
|
||||||
|
if not lineStr:
|
||||||
|
continue
|
||||||
|
|
||||||
# Wait for the initial separator before starting speech
|
# Wait for the initial separator before starting speech
|
||||||
if not startSpeech:
|
if not startSpeech:
|
||||||
if lineStr and all(c == '-' for c in lineStr):
|
if all(c == '-' for c in lineStr):
|
||||||
startSpeech = True
|
startSpeech = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
processedLine = self.process_line(lineStr)
|
if startSpeech:
|
||||||
if processedLine:
|
processedLine = self.process_line(lineStr)
|
||||||
self.speak(processedLine)
|
if processedLine:
|
||||||
|
self.speak(processedLine)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error processing game output: {e}", file=sys.stderr)
|
print(f"Error processing game output: {e}", file=sys.stderr)
|
||||||
break
|
continue
|
||||||
|
|
||||||
|
|
||||||
class MenuDialog(QDialog):
|
class MenuDialog(QDialog):
|
||||||
|
Loading…
Reference in New Issue
Block a user