Add waveform whisper context menu for long paragraph

This commit is contained in:
Nikolaj Olsson 2024-04-05 12:44:28 +02:00
parent 1ae0c82635
commit 440312fa54
6 changed files with 27 additions and 4 deletions

View File

@ -3374,6 +3374,7 @@ Keep changes?</KeepChangesMessage>
<SplitAtCursor>Split at cursor</SplitAtCursor>
<MergeWithPrevious>Merge with previous</MergeWithPrevious>
<MergeWithNext>Merge with next</MergeWithNext>
<RunWhisperSelectedParagraph>Run Whisper on selected paragraph...</RunWhisperSelectedParagraph>
<ExtendToPrevious>Extend to previous</ExtendToPrevious>
<ExtendToNext>Extend to next</ExtendToNext>
<PlaySelection>Play selection</PlaySelection>

View File

@ -579,6 +579,7 @@ namespace Nikse.SubtitleEdit.Forms
this.timerOriginalTextUndo = new System.Windows.Forms.Timer(this.components);
this.contextMenuStripShowVideoControls = new System.Windows.Forms.ContextMenuStrip(this.components);
this.toolStripMenuItemShowVideoControls = new System.Windows.Forms.ToolStripMenuItem();
this.runWhiperOnParagraphToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
@ -2721,7 +2722,7 @@ namespace Nikse.SubtitleEdit.Forms
this.toolStripMenuItemSelectedLines,
this.toolStripMenuItemGoogleMicrosoftTranslateSelLine});
this.contextMenuStripListView.Name = "contextMenuStripListView";
this.contextMenuStripListView.Size = new System.Drawing.Size(285, 848);
this.contextMenuStripListView.Size = new System.Drawing.Size(285, 826);
this.contextMenuStripListView.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.MenuClosed);
this.contextMenuStripListView.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripListViewOpening);
this.contextMenuStripListView.Opened += new System.EventHandler(this.MenuOpened);
@ -4459,6 +4460,7 @@ namespace Nikse.SubtitleEdit.Forms
this.splitToolStripMenuItem1,
this.mergeWithPreviousToolStripMenuItem,
this.mergeWithNextToolStripMenuItem,
this.runWhiperOnParagraphToolStripMenuItem,
this.toolStripSeparator11,
this.extendToPreviousToolStripMenuItem,
this.extendToNextToolStripMenuItem,
@ -4475,7 +4477,7 @@ namespace Nikse.SubtitleEdit.Forms
this.seekSilenceToolStripMenuItem,
this.insertSubtitleHereToolStripMenuItem});
this.contextMenuStripWaveform.Name = "contextMenuStripWaveform";
this.contextMenuStripWaveform.Size = new System.Drawing.Size(275, 490);
this.contextMenuStripWaveform.Size = new System.Drawing.Size(275, 534);
this.contextMenuStripWaveform.Closing += new System.Windows.Forms.ToolStripDropDownClosingEventHandler(this.ContextMenuStripWaveformClosing);
this.contextMenuStripWaveform.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripWaveformOpening);
//
@ -5879,6 +5881,13 @@ namespace Nikse.SubtitleEdit.Forms
this.toolStripMenuItemShowVideoControls.Text = "Show video controls";
this.toolStripMenuItemShowVideoControls.Click += new System.EventHandler(this.ToolStripMenuItemShowVideoControlsClick);
//
// runWhiperOnParagraphToolStripMenuItem
//
this.runWhiperOnParagraphToolStripMenuItem.Name = "runWhiperOnParagraphToolStripMenuItem";
this.runWhiperOnParagraphToolStripMenuItem.Size = new System.Drawing.Size(274, 22);
this.runWhiperOnParagraphToolStripMenuItem.Text = "Run Whiper on paragraph...";
this.runWhiperOnParagraphToolStripMenuItem.Click += new System.EventHandler(this.runWhiperOnParagraphToolStripMenuItem_Click);
//
// Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -6497,5 +6506,6 @@ namespace Nikse.SubtitleEdit.Forms
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemEvenlyDistributeLines;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemVerifyCompleteness;
private System.Windows.Forms.ToolStripButton toolStripButtonVideoOpen;
private System.Windows.Forms.ToolStripMenuItem runWhiperOnParagraphToolStripMenuItem;
}
}

View File

@ -939,6 +939,7 @@ namespace Nikse.SubtitleEdit.Forms
deleteParagraphToolStripMenuItem.Visible = false;
toolStripMenuItemFocusTextbox.Visible = true;
splitToolStripMenuItem1.Visible = false;
runWhiperOnParagraphToolStripMenuItem.Visible = false;
mergeWithPreviousToolStripMenuItem.Visible = false;
mergeWithNextToolStripMenuItem.Visible = false;
extendToPreviousToolStripMenuItem.Visible = false;
@ -1132,6 +1133,7 @@ namespace Nikse.SubtitleEdit.Forms
deleteParagraphToolStripMenuItem.Visible = true;
toolStripMenuItemFocusTextbox.Visible = true;
splitToolStripMenuItem1.Visible = true;
runWhiperOnParagraphToolStripMenuItem.Visible = e.Paragraph.DurationTotalMilliseconds > 8000;
mergeWithPreviousToolStripMenuItem.Visible = true;
mergeWithNextToolStripMenuItem.Visible = true;
toolStripSeparator11.Visible = true;
@ -2089,8 +2091,8 @@ namespace Nikse.SubtitleEdit.Forms
toolStripMenuItemFocusTextbox.Text = languageWaveform.FocusTextBox;
goToPreviousSubtitleStripMenuItem.Text = languageWaveform.GoToPrevious;
goToNextSubtitleStripMenuItem.Text = languageWaveform.GoToNext;
splitToolStripMenuItem1.Text = languageWaveform.Split;
runWhiperOnParagraphToolStripMenuItem.Text = languageWaveform.RunWhisperSelectedParagraph;
mergeWithPreviousToolStripMenuItem.Text = languageWaveform.MergeWithPrevious;
mergeWithNextToolStripMenuItem.Text = languageWaveform.MergeWithNext;
extendToPreviousToolStripMenuItem.Text = languageWaveform.ExtendToPrevious;
@ -9840,7 +9842,7 @@ namespace Nikse.SubtitleEdit.Forms
}
var audioClips = GetAudioClips();
if (audioClips.Count == 1 && audioClips[0].Paragraph.DurationTotalMilliseconds > 10_000)
if (audioClips.Count == 1 && audioClips[0].Paragraph.DurationTotalMilliseconds > 8_000)
{
var s = new Subtitle();
s.Paragraphs.Add(audioClips[0].Paragraph);
@ -36710,5 +36712,10 @@ namespace Nikse.SubtitleEdit.Forms
{
OpenVideoDialog();
}
private void runWhiperOnParagraphToolStripMenuItem_Click(object sender, EventArgs e)
{
AudioToTextWhisperSelectedLines();
}
}
}

View File

@ -3796,6 +3796,7 @@ Keep changes?",
MergeWithNext = "Merge with next",
ExtendToPrevious = "Extend to previous",
ExtendToNext = "Extend to next",
RunWhisperSelectedParagraph = "Run Whisper on selected paragraph...",
PlaySelection = "Play selection",
ShowWaveformAndSpectrogram = "Show waveform and spectrogram",
ShowWaveformOnly = "Show waveform only",

View File

@ -9205,6 +9205,9 @@ namespace Nikse.SubtitleEdit.Logic
case "Waveform/MergeWithNext":
language.Waveform.MergeWithNext = reader.Value;
break;
case "Waveform/RunWhisperSelectedParagraph":
language.Waveform.RunWhisperSelectedParagraph = reader.Value;
break;
case "Waveform/ExtendToPrevious":
language.Waveform.ExtendToPrevious = reader.Value;
break;

View File

@ -3602,6 +3602,7 @@
public string SplitAtCursor { get; set; }
public string MergeWithPrevious { get; set; }
public string MergeWithNext { get; set; }
public string RunWhisperSelectedParagraph { get; set; }
public string ExtendToPrevious { get; set; }
public string ExtendToNext { get; set; }
public string PlaySelection { get; set; }