diff --git a/Changelog.txt b/Changelog.txt index 69152774e..9e1774078 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -28,6 +28,8 @@ * Update Romanian translation - thx Mircea * Update Chinese translation - thx LeonCheung * Update Polish translation - thx admas + * Update Portuguese translation - thx moob + * Update Greek translation - thx Lero91 * Init no-break-after-list with language * Make quick-char-list in "OCR Char" window dynamic * Remember settings for "column paste" @@ -45,6 +47,7 @@ * FIXED: * Fix spell check dictionary download - thx bluesea1401/ksoll4 * Fix freeze after using Win key + * Fix auto-br issue with dialog - thx Kevin * Fix for sometimes missing last sub in teletext - thx borifax/xylographe * Fix for sometimes missing images in bdsup - thx Devin * Fix OCR window after minimize - thx Janusz @@ -60,10 +63,10 @@ * Fix list view Ctrl+v/selection bug - thx gleaming * Fixes for Bing translate token endpoint - thx obliver27 * Fix auto br for 3+ lines dialog - thx thejester77 - * Fix auto-br issue with dialog - thx Kevin * Don't remove spaces in auto-br - thx thehulk * Fix crash in compare report - thx Janusz * Fix "Extend to previous/next" shortcuts w original - thx OmrSi + * Fix for overlap in "adjust durations" - thx JD 3.5.15 (1st May 2020) diff --git a/src/Forms/BatchConvert.cs b/src/Forms/BatchConvert.cs index ade1be0e4..402765e1d 100644 --- a/src/Forms/BatchConvert.cs +++ b/src/Forms/BatchConvert.cs @@ -1152,7 +1152,7 @@ namespace Nikse.SubtitleEdit.Forms item.SubItems[3].Text = Configuration.Settings.Language.BatchConvert.Ocr + " " + progress; listViewInputFiles.Refresh(); }; - vobSubOcr.InitializeBatch(fileName, Configuration.Settings.VobSubOcr, false); + vobSubOcr.InitializeBatch(fileName, Configuration.Settings.VobSubOcr, false, "Tesseract"); sub = vobSubOcr.SubtitleFromOcr; } } diff --git a/src/Forms/Ocr/VobSubOcr.cs b/src/Forms/Ocr/VobSubOcr.cs index b30be3f19..6e9555758 100644 --- a/src/Forms/Ocr/VobSubOcr.cs +++ b/src/Forms/Ocr/VobSubOcr.cs @@ -615,13 +615,23 @@ namespace Nikse.SubtitleEdit.Forms.Ocr comboBoxDictionaries.SelectedIndexChanged += comboBoxDictionaries_SelectedIndexChanged; } - internal void InitializeBatch(string vobSubFileName, VobSubOcrSettings vobSubOcrSettings, bool forcedOnly, string language = null) + internal void InitializeBatch(string vobSubFileName, VobSubOcrSettings vobSubOcrSettings, bool forcedOnly, string ocrEngine, string language = null) { Initialize(vobSubFileName, vobSubOcrSettings, null, true); FormVobSubOcr_Shown(null, null); checkBoxShowOnlyForced.Checked = forcedOnly; checkBoxPromptForUnknownWords.Checked = false; + if (ocrEngine?.ToLowerInvariant() == "nocr") + { + var oldNOcrDrawText = checkBoxNOcrDrawUnknownLetters.Checked; + InitializeNOcrForBatch(language); + checkBoxShowOnlyForced.Checked = forcedOnly; + DoBatch(); + checkBoxNOcrDrawUnknownLetters.Checked = oldNOcrDrawText; + return; + } + _ocrMethodIndex = Configuration.Settings.VobSubOcr.LastOcrMethod == "Tesseract4" ? _ocrMethodTesseract4 : _ocrMethodTesseract302; if (language == null) { @@ -6383,6 +6393,11 @@ namespace Nikse.SubtitleEdit.Forms.Ocr if (string.IsNullOrEmpty(fileName)) { fileName = Configuration.Settings.VobSubOcr.LineOcrLastLanguages; + if (string.IsNullOrEmpty(fileName)) + { + fileName = "Latin"; + } + if (!string.IsNullOrEmpty(fileName)) { fileName = Path.Combine(Configuration.OcrDirectory, Configuration.Settings.VobSubOcr.LineOcrLastLanguages + ".nocr"); diff --git a/src/Logic/CommandLineConvert/CommandLineConverter.cs b/src/Logic/CommandLineConvert/CommandLineConverter.cs index 91635322a..96445b98a 100644 --- a/src/Logic/CommandLineConvert/CommandLineConverter.cs +++ b/src/Logic/CommandLineConvert/CommandLineConverter.cs @@ -597,7 +597,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert else if (!done && FileUtil.IsVobSub(fileName)) { _stdOutWriter.WriteLine("Found VobSub subtitle format"); - ConvertVobSubSubtitle(fileName, targetFormat, offset, targetEncoding, outputFolder, count, ref converted, ref errors, formats, overwrite, pacCodePage, targetFrameRate, multipleReplaceImportFiles, actions, forcedOnly); + ConvertVobSubSubtitle(fileName, targetFormat, offset, targetEncoding, outputFolder, count, ref converted, ref errors, formats, overwrite, pacCodePage, targetFrameRate, multipleReplaceImportFiles, actions, forcedOnly, ocrEngine); done = true; } @@ -807,7 +807,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert } } - private static void ConvertVobSubSubtitle(string fileName, string targetFormat, TimeSpan offset, TextEncoding targetEncoding, string outputFolder, int count, ref int converted, ref int errors, IEnumerable formats, bool overwrite, int pacCodePage, double? targetFrameRate, ICollection multipleReplaceImportFiles, IEnumerable actions, bool forcedOnly) + private static void ConvertVobSubSubtitle(string fileName, string targetFormat, TimeSpan offset, TextEncoding targetEncoding, string outputFolder, int count, ref int converted, ref int errors, IEnumerable formats, bool overwrite, int pacCodePage, double? targetFrameRate, ICollection multipleReplaceImportFiles, IEnumerable actions, bool forcedOnly, string ocrEngine) { var format = Utilities.GetSubtitleFormatByFriendlyName(targetFormat) ?? new SubRip(); @@ -815,12 +815,12 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert Subtitle sub; using (var vobSubOcr = new VobSubOcr()) { - _stdOutWriter?.WriteLine("Using OCR to extract subtitles"); + _stdOutWriter?.WriteLine($"Using OCR via {ocrEngine} to extract subtitles"); vobSubOcr.ProgressCallback = progress => { _stdOutWriter?.Write($"\r{Configuration.Settings.Language.BatchConvert.Ocr} : {progress}"); }; - vobSubOcr.InitializeBatch(fileName, Configuration.Settings.VobSubOcr, forcedOnly); + vobSubOcr.InitializeBatch(fileName, Configuration.Settings.VobSubOcr, forcedOnly, ocrEngine); _stdOutWriter?.WriteLine(); sub = vobSubOcr.SubtitleFromOcr; _stdOutWriter?.WriteLine($"Extracted subtitles from file \"{fileName}\"");