Show file list after Whisper/Vosk batch - thx Simon :)

This commit is contained in:
niksedk 2023-11-22 06:34:08 +01:00
parent 0b74c448b8
commit 888a5260da
2 changed files with 11 additions and 4 deletions

View File

@ -33,6 +33,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
private bool _useCenterChannelOnly; private bool _useCenterChannelOnly;
private Model _model; private Model _model;
private int _initialWidth = 725; private int _initialWidth = 725;
private readonly List<string> _outputBatchFileNames = new List<string>();
public Subtitle TranscribedSubtitle { get; private set; } public Subtitle TranscribedSubtitle { get; private set; }
@ -236,7 +237,8 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
MessageBox.Show($"{errorCount} error(s)!{Environment.NewLine}{errors}"); MessageBox.Show($"{errorCount} error(s)!{Environment.NewLine}{errors}");
} }
MessageBox.Show(string.Format(LanguageSettings.Current.AudioToText.XFilesSavedToVideoSourceFolder, listViewInputFiles.Items.Count - errorCount)); var fileList = Environment.NewLine + Environment.NewLine + string.Join(Environment.NewLine, _outputBatchFileNames);
MessageBox.Show(string.Format(LanguageSettings.Current.AudioToText.XFilesSavedToVideoSourceFolder, listViewInputFiles.Items.Count - errorCount) + fileList);
groupBoxInputFiles.Enabled = true; groupBoxInputFiles.Enabled = true;
buttonGenerate.Enabled = true; buttonGenerate.Enabled = true;
@ -253,11 +255,12 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
var fileName = Path.Combine(Utilities.GetPathAndFileNameWithoutExtension(videoFileName)) + format.Extension; var fileName = Path.Combine(Utilities.GetPathAndFileNameWithoutExtension(videoFileName)) + format.Extension;
if (File.Exists(fileName)) if (File.Exists(fileName))
{ {
fileName = $"{Path.Combine(Utilities.GetPathAndFileNameWithoutExtension(videoFileName))}.{Guid.NewGuid().ToByteArray()}.{format.Extension}"; fileName = $"{Path.Combine(Utilities.GetPathAndFileNameWithoutExtension(videoFileName))}.{Guid.NewGuid().ToString()}.{format.Extension}";
} }
File.WriteAllText(fileName, text, Encoding.UTF8); File.WriteAllText(fileName, text, Encoding.UTF8);
textBoxLog.AppendText("Subtitle written to : " + fileName + Environment.NewLine); textBoxLog.AppendText("Subtitle written to : " + fileName + Environment.NewLine);
_outputBatchFileNames.Add(fileName);
} }
internal static string GetLanguage(string text) internal static string GetLanguage(string text)

View File

@ -44,6 +44,8 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
private double _lastEstimatedMs = double.MaxValue; private double _lastEstimatedMs = double.MaxValue;
private VideoInfo _videoInfo; private VideoInfo _videoInfo;
private readonly WavePeakData _wavePeaks; private readonly WavePeakData _wavePeaks;
private readonly List<string> _outputBatchFileNames = new List<string>();
public bool UnknownArgument { get; set; } public bool UnknownArgument { get; set; }
public bool RunningOnCuda { get; set; } public bool RunningOnCuda { get; set; }
public bool IncompleteModel { get; set; } public bool IncompleteModel { get; set; }
@ -575,7 +577,8 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
MessageBox.Show(this, $"{errorCount} error(s)!{Environment.NewLine}{errors}", Text, MessageBoxButtons.OK); MessageBox.Show(this, $"{errorCount} error(s)!{Environment.NewLine}{errors}", Text, MessageBoxButtons.OK);
} }
MessageBox.Show(this, string.Format(LanguageSettings.Current.AudioToText.XFilesSavedToVideoSourceFolder, listViewInputFiles.Items.Count - errorCount), Text, MessageBoxButtons.OK); var fileList = Environment.NewLine + Environment.NewLine + string.Join(Environment.NewLine, _outputBatchFileNames);
MessageBox.Show(this, string.Format(LanguageSettings.Current.AudioToText.XFilesSavedToVideoSourceFolder, listViewInputFiles.Items.Count - errorCount) + fileList, Text, MessageBoxButtons.OK);
groupBoxInputFiles.Enabled = true; groupBoxInputFiles.Enabled = true;
buttonGenerate.Enabled = true; buttonGenerate.Enabled = true;
@ -671,11 +674,12 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
var fileName = Path.Combine(Utilities.GetPathAndFileNameWithoutExtension(videoFileName)) + format.Extension; var fileName = Path.Combine(Utilities.GetPathAndFileNameWithoutExtension(videoFileName)) + format.Extension;
if (File.Exists(fileName)) if (File.Exists(fileName))
{ {
fileName = $"{Path.Combine(Utilities.GetPathAndFileNameWithoutExtension(videoFileName))}.{Guid.NewGuid().ToByteArray()}.{format.Extension}"; fileName = $"{Path.Combine(Utilities.GetPathAndFileNameWithoutExtension(videoFileName))}.{Guid.NewGuid().ToString()}.{format.Extension}";
} }
File.WriteAllText(fileName, text, Encoding.UTF8); File.WriteAllText(fileName, text, Encoding.UTF8);
_outputText.Add("Subtitle written to : " + fileName); _outputText.Add("Subtitle written to : " + fileName);
_outputBatchFileNames.Add(fileName);
} }
internal static string GetLanguage(string name) internal static string GetLanguage(string name)