Work on #8109 - thx rRobis :)

This commit is contained in:
Nikolaj Olsson 2024-04-04 12:44:14 +02:00
parent ae5c93d634
commit 922cfe8295
3 changed files with 71 additions and 5 deletions

View File

@ -2721,7 +2721,7 @@ namespace Nikse.SubtitleEdit.Forms
this.toolStripMenuItemSelectedLines,
this.toolStripMenuItemGoogleMicrosoftTranslateSelLine});
this.contextMenuStripListView.Name = "contextMenuStripListView";
this.contextMenuStripListView.Size = new System.Drawing.Size(285, 826);
this.contextMenuStripListView.Size = new System.Drawing.Size(285, 848);
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);

View File

@ -9721,7 +9721,7 @@ namespace Nikse.SubtitleEdit.Forms
var selectLinesStatistics = new ToolStripMenuItem(LanguageSettings.Current.Main.Menu.File.Statistics);
UiUtil.FixFonts(selectLinesStatistics);
selectLinesStatistics.Tag = "(REMOVE)";
if (SubtitleListview1.SelectedItems.Count > 1)
if (SubtitleListview1.SelectedItems.Count > 0)
{
toolStripMenuItemSelectedLines.DropDownItems.Insert(1, selectLinesStatistics);
}
@ -9778,6 +9778,37 @@ namespace Nikse.SubtitleEdit.Forms
}
var audioClips = GetAudioClips();
if (audioClips.Count == 1 && audioClips[0].Paragraph.DurationTotalMilliseconds > 10_000)
{
using (var form = new VoskAudioToText(audioClips[0].AudioFileName, _videoAudioTrackNumber, this))
{
var result = form.ShowDialog(this);
if (result != DialogResult.OK)
{
return;
}
if (form.TranscribedSubtitle.Paragraphs.Count == 0)
{
MessageBox.Show(LanguageSettings.Current.AudioToText.NoTextFound);
return;
}
_subtitle.Paragraphs.RemoveAll(p => p.Id == audioClips[0].Paragraph.Id);
foreach (var p in form.TranscribedSubtitle.Paragraphs)
{
p.Adjust(1, audioClips[0].Paragraph.StartTime.TotalSeconds);
_subtitle.InsertParagraphInCorrectTimeOrder(p);
}
SubtitleListview1.Fill(_subtitle, _subtitleOriginal);
RestoreSubtitleListviewIndices();
RefreshSelectedParagraph();
}
}
using (var form = new VoskAudioToTextSelectedLines(audioClips, this))
{
if (form.ShowDialog(this) == DialogResult.OK)
@ -9809,6 +9840,41 @@ namespace Nikse.SubtitleEdit.Forms
}
var audioClips = GetAudioClips();
if (audioClips.Count == 1 && audioClips[0].Paragraph.DurationTotalMilliseconds > 10_000)
{
var s = new Subtitle();
s.Paragraphs.Add(audioClips[0].Paragraph);
using (var form = new WhisperAudioToText(audioClips[0].AudioFileName, s, _videoAudioTrackNumber, this, null))
{
var result = form.ShowDialog(this);
if (result != DialogResult.OK)
{
return;
}
if (form.TranscribedSubtitle.Paragraphs.Count == 0)
{
MessageBox.Show(LanguageSettings.Current.AudioToText.NoTextFound);
return;
}
_subtitle.Paragraphs.RemoveAll(p => p.Id == audioClips[0].Paragraph.Id);
foreach (var p in form.TranscribedSubtitle.Paragraphs)
{
p.Adjust(1, audioClips[0].Paragraph.StartTime.TotalSeconds);
_subtitle.InsertParagraphInCorrectTimeOrder(p);
}
SubtitleListview1.Fill(_subtitle, _subtitleOriginal);
RestoreSubtitleListviewIndices();
RefreshSelectedParagraph();
}
return;
}
using (var form = new WhisperAudioToTextSelectedLines(audioClips, this))
{
CheckWhisperCpp();

View File

@ -730,9 +730,9 @@
<data name="toolStripButtonLockCenter.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACJSURBVEhLYxjioPT6M4aKawVQHvEApAekFydIuP6bofx6
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACJSURBVEhLYxjioPT6M4aKawVQHvEApAekFyeIv/6bofx6
A5RHPADpAenFCbAZXHk1ACi2nqHi6n44BokhA5INrrpiwFBx/T9Q7DxYHILPg8VAcjBAssEgNsgQdACx
DFXdqMFgMGowlDdqMCUG0yxLgwCowEEugEAFEsWFELGAoME0K+gHP2BgAACKlxeWMO5vswAAAABJRU5E
DFXdqMFgMGowlDdqMCUG0yxLgwCowEEugEAFEsWFELGAoME0K+gHP2BgAAAQJxd2BqH7LAAAAABJRU5E
rkJggg==
</value>
</data>
@ -788,6 +788,6 @@
<value>676, 92</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
<value>144</value>
</metadata>
</root>