本文整理汇总了C#中Nikse.SubtitleEdit.Forms.VobSubOcr.InitializeBatch方法的典型用法代码示例。如果您正苦于以下问题:C# VobSubOcr.InitializeBatch方法的具体用法?C# VobSubOcr.InitializeBatch怎么用?C# VobSubOcr.InitializeBatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nikse.SubtitleEdit.Forms.VobSubOcr
的用法示例。
在下文中一共展示了VobSubOcr.InitializeBatch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: buttonConvert_Click
//.........这里部分代码省略.........
isSsa = true;
}
else
{
format = new SubRip();
}
if (isSsa)
{
foreach (Paragraph p in Main.LoadMatroskaSSa(x, fileName, format, mkvSub).Paragraphs)
{
sub.Paragraphs.Add(p);
}
}
else
{
foreach (SubtitleSequence p in mkvSub)
{
sub.Paragraphs.Add(new Paragraph(p.Text, p.StartMilliseconds, p.EndMilliseconds));
}
}
break;
}
}
}
}
}
}
else if (bluRaySubtitles.Count > 0)
{
item.SubItems[3].Text = "OCR...";
var vobSubOcr = new VobSubOcr();
vobSubOcr.FileName = Path.GetFileName(fileName);
vobSubOcr.InitializeBatch(bluRaySubtitles, Configuration.Settings.VobSubOcr, fileName);
sub = vobSubOcr.SubtitleFromOcr;
}
else if (isVobSub)
{
item.SubItems[3].Text = "OCR...";
var vobSubOcr = new VobSubOcr();
vobSubOcr.InitializeBatch(fileName, Configuration.Settings.VobSubOcr, true);
sub = vobSubOcr.SubtitleFromOcr;
}
if (comboBoxSubtitleFormats.Text == new AdvancedSubStationAlpha().Name && _assStyle != null)
{
sub.Header = _assStyle;
}
else if (comboBoxSubtitleFormats.Text == new SubStationAlpha().Name && _ssaStyle != null)
{
sub.Header = _ssaStyle;
}
int prevIndex = -1;
foreach (Paragraph p in sub.Paragraphs)
{
string prevText = string.Empty;
var prev = sub.GetParagraphOrDefault(prevIndex);
if (prev != null)
prevText = prev.Text;
prevIndex++;
if (checkBoxRemoveTextForHI.Checked)
{
p.Text = _removeForHI.RemoveTextFromHearImpaired(p.Text, prevText);
}
示例2: ConvertVobSubSubtitle
private static void ConvertVobSubSubtitle(string fileName, string toFormat, string offset, Encoding targetEncoding, string outputFolder, int count, ref int converted, ref int errors, IList<SubtitleFormat> formats, bool overwrite, string pacCodePage, double? targetFrameRate)
{
var format = Utilities.GetSubtitleFormatByFriendlyName(toFormat) ?? new SubRip();
Console.WriteLine("Loading subtitles from file \"{0}\"", fileName);
Subtitle sub;
using (var vobSubOcr = new VobSubOcr())
{
Console.WriteLine("Using OCR to extract subtitles");
vobSubOcr.InitializeBatch(fileName, Configuration.Settings.VobSubOcr);
sub = vobSubOcr.SubtitleFromOcr;
Console.WriteLine("Extracted subtitles from file \"{0}\"", fileName);
}
if (sub != null)
{
Console.WriteLine("Converted subtitle");
BatchConvertSave(toFormat, offset, targetEncoding, outputFolder, count, ref converted, ref errors, formats, fileName, sub, format, overwrite, pacCodePage, targetFrameRate);
}
}
示例3: buttonConvert_Click
//.........这里部分代码省略.........
{
if (isMatroska && (Path.GetExtension(fileName).Equals(".mkv", StringComparison.OrdinalIgnoreCase) || Path.GetExtension(fileName).Equals(".mks", StringComparison.OrdinalIgnoreCase)))
{
using (var matroska = new MatroskaFile(fileName))
{
if (matroska.IsValid)
{
foreach (var track in matroska.GetTracks(true))
{
if (track.CodecId.Equals("S_VOBSUB", StringComparison.OrdinalIgnoreCase))
{
// TODO: Convert from VobSub image based format!
}
else if (track.CodecId.Equals("S_HDMV/PGS", StringComparison.OrdinalIgnoreCase))
{
// TODO: Convert from Blu-ray image based format!
}
else if (track.CodecId.Equals("S_TEXT/UTF8", StringComparison.OrdinalIgnoreCase) || track.CodecId.Equals("S_TEXT/SSA", StringComparison.OrdinalIgnoreCase) || track.CodecId.Equals("S_TEXT/ASS", StringComparison.OrdinalIgnoreCase))
{
var mkvSub = matroska.GetSubtitle(track.TrackNumber, null);
Utilities.LoadMatroskaTextSubtitle(track, matroska, mkvSub, sub);
break;
}
}
}
}
}
else if (bluRaySubtitles.Count > 0)
{
item.SubItems[3].Text = Configuration.Settings.Language.BatchConvert.Ocr;
using (var vobSubOcr = new VobSubOcr())
{
vobSubOcr.FileName = Path.GetFileName(fileName);
vobSubOcr.InitializeBatch(bluRaySubtitles, Configuration.Settings.VobSubOcr, fileName);
sub = vobSubOcr.SubtitleFromOcr;
}
}
else if (isVobSub)
{
item.SubItems[3].Text = Configuration.Settings.Language.BatchConvert.Ocr;
using (var vobSubOcr = new VobSubOcr())
{
vobSubOcr.InitializeBatch(fileName, Configuration.Settings.VobSubOcr);
sub = vobSubOcr.SubtitleFromOcr;
}
}
if (comboBoxSubtitleFormats.Text == AdvancedSubStationAlpha.NameOfFormat && _assStyle != null)
{
sub.Header = _assStyle;
}
else if (comboBoxSubtitleFormats.Text == SubStationAlpha.NameOfFormat && _ssaStyle != null)
{
sub.Header = _ssaStyle;
}
bool skip = CheckSkipFilter(fileName, format, sub);
if (skip)
{
item.SubItems[3].Text = Configuration.Settings.Language.BatchConvert.FilterSkipped;
}
else
{
foreach (Paragraph p in sub.Paragraphs)
{
if (checkBoxRemoveTextForHI.Checked)
{
示例4: ConvertBluRaySubtitle
private static void ConvertBluRaySubtitle(string fileName, string toFormat, string offset, Encoding targetEncoding, string outputFolder, int count, ref int converted, ref int errors, IList<SubtitleFormat> formats, bool overwrite, string pacCodePage, double? targetFrameRate, bool removeTextForHi, bool fixCommonErrors, bool redoCasing)
{
SubtitleFormat format = Utilities.GetSubtitleFormatByFriendlyName(toFormat) ?? new SubRip();
var log = new StringBuilder();
Console.WriteLine("Loading subtitles from file \"{0}\"", fileName);
var bluRaySubtitles = BluRaySupParser.ParseBluRaySup(fileName, log);
Subtitle sub;
using (var vobSubOcr = new VobSubOcr())
{
Console.WriteLine("Using OCR to extract subtitles");
vobSubOcr.FileName = Path.GetFileName(fileName);
vobSubOcr.InitializeBatch(bluRaySubtitles, Configuration.Settings.VobSubOcr, fileName);
sub = vobSubOcr.SubtitleFromOcr;
Console.WriteLine("Extracted subtitles from file \"{0}\"", fileName);
}
if (sub != null)
{
Console.WriteLine("Converted subtitle");
BatchConvertSave(toFormat, offset, targetEncoding, outputFolder, count, ref converted, ref errors, formats, fileName, sub, format, overwrite, pacCodePage, targetFrameRate, removeTextForHi, fixCommonErrors, redoCasing);
}
}