Add tts shortcut

This commit is contained in:
Nikolaj Olsson 2024-04-14 16:53:51 +02:00
parent 6f697a4857
commit 1ed5217fda
5 changed files with 20 additions and 4 deletions

View File

@ -2567,6 +2567,7 @@ $HorzAlign = Center
public string MainVideoAudioToTextVosk { get; set; }
public string MainVideoAudioToTextWhisper { get; set; }
public string MainVideoAudioExtractAudioSelectedLines { get; set; }
public string MainVideoTextToSpeech { get; set; }
// spell check
public string MainSpellCheck { get; set; }
@ -10282,6 +10283,12 @@ $HorzAlign = Center
shortcuts.MainVideoAudioExtractAudioSelectedLines = subNode.InnerText;
}
subNode = node.SelectSingleNode("MainVideoTextToSpeech");
if (subNode != null)
{
shortcuts.MainVideoTextToSpeech = subNode.InnerText;
}
subNode = node.SelectSingleNode("MainSpellCheck");
if (subNode != null)
{
@ -12963,6 +12970,7 @@ $HorzAlign = Center
textWriter.WriteElementString("MainVideoAudioToTextVosk", shortcuts.MainVideoAudioToTextVosk);
textWriter.WriteElementString("MainVideoAudioToTextWhisper", shortcuts.MainVideoAudioToTextWhisper);
textWriter.WriteElementString("MainVideoAudioExtractAudioSelectedLines", shortcuts.MainVideoAudioExtractAudioSelectedLines);
textWriter.WriteElementString("MainVideoTextToSpeech", shortcuts.MainVideoTextToSpeech);
textWriter.WriteElementString("MainSpellCheck", shortcuts.MainSpellCheck);
textWriter.WriteElementString("MainSpellCheckFindDoubleWords", shortcuts.MainSpellCheckFindDoubleWords);
textWriter.WriteElementString("MainSpellCheckAddWordToNames", shortcuts.MainSpellCheckAddWordToNames);

View File

@ -18678,6 +18678,11 @@ namespace Nikse.SubtitleEdit.Forms
e.SuppressKeyPress = true;
ExtractAudioSelectedLines();
}
else if (e.KeyData == _shortcuts.MainVideoTextToSpeech)
{
e.SuppressKeyPress = true;
TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(10), () => textToSpeechAndAddToVideoToolStripMenuItem_Click(null, null));
}
else if (e.KeyData == _shortcuts.MainVideoToggleBrightness)
{
if (mediaPlayer.VideoPlayer is LibMpvDynamic libMpv)

View File

@ -1701,6 +1701,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
AddNode(videoNode, language.MainToggleVideoControls, nameof(Configuration.Settings.Shortcuts.MainVideoToggleControls));
AddNode(videoNode, string.Format(language.AudioToTextX, "Vosk"), nameof(Configuration.Settings.Shortcuts.MainVideoAudioToTextVosk));
AddNode(videoNode, string.Format(language.AudioToTextX, "Whisper"), nameof(Configuration.Settings.Shortcuts.MainVideoAudioToTextWhisper));
AddNode(videoNode, LanguageSettings.Current.TextToSpeech.Title, nameof(Configuration.Settings.Shortcuts.MainVideoTextToSpeech));
AddNode(videoNode, language.AudioExtractSelectedLines, nameof(Configuration.Settings.Shortcuts.MainVideoAudioExtractAudioSelectedLines));
AddNode(videoNode, language.VideoToggleContrast, nameof(Configuration.Settings.Shortcuts.MainVideoToggleContrast));
AddNode(videoNode, language.VideoToggleBrightness, nameof(Configuration.Settings.Shortcuts.MainVideoToggleBrightness));

View File

@ -40,20 +40,20 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxLanguage.BeginUpdate();
comboBoxLanguage.Items.Clear();
int selctedIndex = 0;
for (int i = 0; i < moreLanguages.Count; i++)
var selectedIndex = 0;
for (var i = 0; i < moreLanguages.Count; i++)
{
var language = moreLanguages[i];
var code = language.TwoLetterISOLanguageName.ToLowerInvariant();
comboBoxLanguage.Items.Add(new LanguageComboBoxItem(code, language.EnglishName + " / " + language.NativeName));
if (code == currentLanguage)
{
selctedIndex = i;
selectedIndex = i;
}
}
if (comboBoxLanguage.Items.Count > 0)
{
comboBoxLanguage.SelectedIndex = selctedIndex;
comboBoxLanguage.SelectedIndex = selectedIndex;
}
comboBoxLanguage.EndUpdate();
}

View File

@ -97,6 +97,7 @@ namespace Nikse.SubtitleEdit.Logic
public Keys MainVideoAudioToTextVosk { get; set; }
public Keys MainVideoAudioToTextWhisper { get; set; }
public Keys MainVideoAudioExtractSelectedLines { get; set; }
public Keys MainVideoTextToSpeech { get; set; }
public Keys MainVideoToggleContrast { get; set; }
public Keys MainGoToPreviousSubtitleAndFocusVideo { get; set; }
public Keys MainGoToNextSubtitleAndFocusVideo { get; set; }
@ -393,6 +394,7 @@ namespace Nikse.SubtitleEdit.Logic
MainVideoAudioToTextVosk = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoAudioToTextVosk);
MainVideoAudioToTextWhisper = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoAudioToTextWhisper);
MainVideoAudioExtractSelectedLines = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoAudioExtractAudioSelectedLines);
MainVideoTextToSpeech = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoTextToSpeech);
MainVideoToggleBrightness = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoToggleBrightness);
MainVideoToggleContrast = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoToggleContrast);
MainToolsAutoDuration = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainToolsAutoDuration);