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