Ejemplo n.º 1
0
        /// <summary>
        /// Get subtitle parser to use for the provided subtitle file.
        /// </summary>
        public static SubsParser getSubtitleParserType(WorkerVars workerVars, string filename,
                                                       int stream, int episode, int subsNum, Encoding subsEncoding)
        {
            SubsParser parser;
            string     ext = filename.Substring(filename.LastIndexOf("."));

            ext = ext.ToLower();

            if (ext == ".ass" || ext == ".ssa")
            {
                parser = new SubsParserASS(workerVars, filename, subsEncoding, subsNum);
            }
            else if (ext == ".srt")
            {
                parser = new SubsParserSRT(filename, subsEncoding);
            }
            else if (ext == ".sub" || ext == ".idx")
            {
                parser = new SubsParserVOBSUB(workerVars, filename, stream, episode, subsNum);
            }
            else if (ext == ".lrc")
            {
                parser = new SubsParserLyrics(filename, subsEncoding);
            }
            else if (ext == ".trs")
            {
                parser = new SubsParserTranscriber(filename, subsEncoding);
            }
            else
            {
                parser = null;
            }

            return(parser);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get subtitle parser to use for the provided subtitle file.
        /// </summary>
        public static SubsParser getSubtitleParserType(WorkerVars workerVars, string filename,
                                                       int stream, int episode, int subsNum, Encoding subsEncoding)
        {
            SubsParser parser;
            string     ext = filename.Substring(filename.LastIndexOf("."));

            ext = ext.ToLower();

            switch (ext)
            {
            case ".ass":
            case ".ssa":
                parser = new SubsParserASS(workerVars, filename, subsEncoding, subsNum);
                break;

            case ".srt":
                parser = new SubsParserSRT(filename, subsEncoding);
                break;

            case ".sub":
            case ".idx":
                parser = new SubsParserVOBSUB(workerVars, filename, stream, episode, subsNum);
                break;

            case ".lrc":
                parser = new SubsParserLyrics(filename, subsEncoding);
                break;

            case ".trs":
                parser = new SubsParserTranscriber(filename, subsEncoding);
                break;

            case ".vtt":
                parser = new SubsParserVTT(filename, subsEncoding);
                break;

            default:
                parser = null;
                break;
            }

            return(parser);
        }