Example #1
0
        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);
            }
        }
Example #2
0
        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);
            }
        }
        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);
            }
        }