Skip to content

Commit

Permalink
fixing values to unpack
Browse files Browse the repository at this point in the history
  • Loading branch information
willwade committed Sep 14, 2024
1 parent 34fe192 commit 6291110
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions VoiceServer/RegisterVoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ def register_selected_voices(self):
QMessageBox.warning(self, "Warning", "Please select at least one voice to register.")
return

# Extract the selected voices from the list
selected_voices = [item.data(Qt.UserRole)['name'] for item in selected_items]
engine_name = self.engine_combo.currentText() # Extract the engine name from the combo box
selected_voices = [f"{engine_name}-{item.data(Qt.UserRole)['name']}" for item in selected_items]

# Send registration request to the pipe service for each selected voice
# Send registration request to the pipe service
for voice_iso_code in selected_voices:
request = {
"action": "set_voice",
"voice_iso_code": voice_iso_code # Voice ISO code now includes both engine and voice
"voice_iso_code": voice_iso_code # Now includes both engine and voice
}
response = send_pipe_request(request)
if response and response.get("status") == "success":
Expand Down
9 changes: 5 additions & 4 deletions VoiceServer/VoiceServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,15 @@ def speak_text_streamed(self, pipe, tts_engine, text, voice):

def register_voice(self, voice_iso_code):
try:
# Check if the voice_iso_code contains both engine and voice
if "-" not in voice_iso_code:
raise ValueError(f"Invalid voice_iso_code format: {voice_iso_code}")

# Split the voice_iso_code to get engine and voice name
engine_name, voice_name = voice_iso_code.split("-", 1)

# Log the registration process
logging.info(f"Registering voice: {voice_name} for engine: {engine_name}")

# Register the engine DLL
engine_dll = os.path.join(self.libs_directory, 'pysapittsengine.dll')
self.run_command(["regsvr32.exe", "/s", engine_dll])
Expand All @@ -293,8 +296,6 @@ def register_voice(self, voice_iso_code):
'--module', 'voices',
'--class', f"{engine_name}Voice"
]

# Run the registration command
self.run_command(register_command)

logging.info(f"Successfully registered voice: {voice_iso_code}")
Expand Down

0 comments on commit 6291110

Please sign in to comment.