Do not append voices when reloading

This commit is contained in:
Nikolaj Olsson 2024-10-19 21:31:51 +02:00
parent 30ba6afdba
commit 740ac29f6b

View File

@ -1890,15 +1890,15 @@ namespace Nikse.SubtitleEdit.Forms.Tts
Directory.CreateDirectory(ttsPath);
}
var elevenLabsPath = Path.Combine(ttsPath, "Piper");
if (!Directory.Exists(elevenLabsPath))
var piperPath = Path.Combine(ttsPath, "Piper");
if (!Directory.Exists(piperPath))
{
Directory.CreateDirectory(elevenLabsPath);
Directory.CreateDirectory(piperPath);
}
var result = new List<PiperModel>();
var jsonFileName = Path.Combine(elevenLabsPath, "voices.json");
var jsonFileName = Path.Combine(piperPath, "voices.json");
if (!File.Exists(jsonFileName))
{
@ -1915,7 +1915,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts
if (!string.IsNullOrEmpty(fileName))
{
var name = entry.FilenameInZip;
var path = Path.Combine(elevenLabsPath, name.Replace('/', Path.DirectorySeparatorChar));
var path = Path.Combine(piperPath, name.Replace('/', Path.DirectorySeparatorChar));
zip.ExtractFile(entry, path);
}
}
@ -2403,6 +2403,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts
}
else if (engine.Id == TextToSpeechEngineId.ElevenLabs)
{
_elevenLabVoices.Clear();
GetElevenLabVoices(false);
nikseComboBoxEngine_SelectedIndexChanged(null, null);
}