Esempio n. 1
0
        // [InlineData("Case Closed (1996-2007)/Case Closed - 317.mkv", 317)] // triple digit episode number
        // TODO: [InlineData("Season 2/16 12 Some Title.avi", 16)]
        // TODO: [InlineData("Season 4/Uchuu.Senkan.Yamato.2199.E03.avi", 3)]
        // TODO: [InlineData("Season 2/7 12 Angry Men.avi", 7)]
        // TODO: [InlineData("Season 02/02x03x04x15 - Ep Name.mp4", 2)]
        public void GetEpisodeNumberFromFileTest(string path, int?expected)
        {
            var result = new EpisodePathParser(_namingOptions)
                         .Parse(path, false);

            Assert.Equal(expected, result.EpisodeNumber);
        }
Esempio n. 2
0
        private int?GetEpisodeNumberFromFile(string path)
        {
            var result = new EpisodePathParser(_namingOptions)
                         .Parse(path, false);

            return(result.EpisodeNumber);
        }
Esempio n. 3
0
        public void EpisodePathParserTest_FalsePositivePixelRate()
        {
            EpisodePathParser p = new EpisodePathParser(_namingOptions);
            var res             = p.Parse("Series Special (1920x1080).mkv", false);

            Assert.False(res.Success);
        }
Esempio n. 4
0
        public void EpisodePathParserTest_DifferentExpressionsParameters(string path, bool?isNamed, bool?isOptimistic)
        {
            EpisodePathParser p = new EpisodePathParser(_namingOptions);
            var res             = p.Parse(path, false, isNamed, isOptimistic);

            Assert.True(res.Success);
        }
Esempio n. 5
0
        public EpisodeInfo Resolve(string path, bool isFolder, bool fillExtendedInfo = true)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException("path");
            }

            var isStub = false;
            string container = null;
            string stubType = null;

            if (!isFolder)
            {
                var extension = Path.GetExtension(path) ?? string.Empty;
                // Check supported extensions
                if (!_options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
                {
                    var stubResult = new StubResolver(_options, _logger).ResolveFile(path);

                    isStub = stubResult.IsStub;

                    // It's not supported. Check stub extensions
                    if (!isStub)
                    {
                        return null;
                    }

                    stubType = stubResult.StubType;
                }

                container = extension.TrimStart('.');
            }

            var flags = new FlagParser(_options).GetFlags(path);
            var format3DResult = new Format3DParser(_options, _logger).Parse(flags);

            var parsingResult = new EpisodePathParser(_options, _iRegexProvider)
                .Parse(path, isFolder, fillExtendedInfo);
            
            return new EpisodeInfo
            {
                Path = path,
                Container = container,
                IsStub = isStub,
                EndingEpsiodeNumber = parsingResult.EndingEpsiodeNumber,
                EpisodeNumber = parsingResult.EpisodeNumber,
                SeasonNumber = parsingResult.SeasonNumber,
                SeriesName = parsingResult.SeriesName,
                StubType = stubType,
                Is3D = format3DResult.Is3D,
                Format3D = format3DResult.Format3D,
                IsByDate = parsingResult.IsByDate,
                Day = parsingResult.Day,
                Month = parsingResult.Month,
                Year = parsingResult.Year
            };
        }
Esempio n. 6
0
        private int?GetEndingEpisodeNumberFromFile(string path)
        {
            var options = new NamingOptions();

            var result = new EpisodePathParser(options)
                         .Parse(path, false);

            return(result.EndingEpsiodeNumber);
        }
Esempio n. 7
0
        private int? GetEndingEpisodeNumberFromFile(string path)
        {
            var options = new ExtendedNamingOptions();

            var result = new EpisodePathParser(options, new RegexProvider())
                .Parse(path, false, true);

            return result.EndingEpsiodeNumber;
        }
Esempio n. 8
0
        private int?GetEndingEpisodeNumberFromFile(string path)
        {
            var options = new ExtendedNamingOptions();

            var result = new EpisodePathParser(options, new RegexProvider())
                         .Parse(path, false, true);

            return(result.EndingEpsiodeNumber);
        }
Esempio n. 9
0
        public void TestGetEndingEpisodeNumberFromFile(string filename, int?endingEpisodeNumber)
        {
            var options = new NamingOptions();

            var result = new EpisodePathParser(options)
                         .Parse(filename, false);

            Assert.Equal(result.EndingEpsiodeNumber, endingEpisodeNumber);
        }
Esempio n. 10
0
        // TODO: [InlineData("/Castle Rock 2x01 Que el rio siga su curso [WEB-DL HULU 1080p h264 Dual DD5.1 Subs].mkv", "Castle Rock", 2, 1)]
        // TODO: [InlineData("/After Life 1x06 Episodio 6 [WEB-DL NF 1080p h264 Dual DD 5.1 Sub].mkv", "After Life", 1, 6)]
        // TODO: [InlineData("/Season 4/Uchuu.Senkan.Yamato.2199.E03.avi", "Uchuu Senkan Yamoto 2199", 4, 3)]
        // TODO: [InlineData("The Daily Show/The Daily Show 25x22 - [WEBDL-720p][AAC 2.0][x264] Noah Baumbach-TBS.mkv", "The Daily Show", 25, 22)]
        // TODO: [InlineData("Watchmen (2019)/Watchmen 1x03 [WEBDL-720p][EAC3 5.1][h264][-TBS] - She Was Killed by Space Junk.mkv", "Watchmen (2019)", 1, 3)]
        // TODO: [InlineData("/The.Legend.of.Condor.Heroes.2017.V2.web-dl.1080p.h264.aac-hdctv/The.Legend.of.Condor.Heroes.2017.E07.V2.web-dl.1080p.h264.aac-hdctv.mkv", "The Legend of Condor Heroes 2017", 1, 7)]
        public void ParseEpisodesCorrectly(string path, bool isDirectory, string name, int season, int episode)
        {
            EpisodePathParser p = new EpisodePathParser(_namingOptions);
            var res             = p.Parse(path, isDirectory);

            Assert.True(res.Success);
            Assert.Equal(name, res.SeriesName);
            Assert.Equal(season, res.SeasonNumber);
            Assert.Equal(episode, res.EpisodeNumber);
        }
Esempio n. 11
0
        // TODO: [InlineData("/Castle Rock 2x01 Que el rio siga su curso [WEB-DL HULU 1080p h264 Dual DD5.1 Subs].mkv", "Castle Rock", 2, 1)]
        // TODO: [InlineData("/After Life 1x06 Episodio 6 [WEB-DL NF 1080p h264 Dual DD 5.1 Sub].mkv", "After Life", 1, 6)]
        // TODO: [InlineData("/Season 4/Uchuu.Senkan.Yamato.2199.E03.avi", "Uchuu Senkan Yamoto 2199", 4, 3)]
        // TODO: [InlineData("The Daily Show/The Daily Show 25x22 - [WEBDL-720p][AAC 2.0][x264] Noah Baumbach-TBS.mkv", "The Daily Show", 25, 22)]
        // TODO: [InlineData("Watchmen (2019)/Watchmen 1x03 [WEBDL-720p][EAC3 5.1][h264][-TBS] - She Was Killed by Space Junk.mkv", "Watchmen (2019)", 1, 3)]
        // TODO: [InlineData("/The.Legend.of.Condor.Heroes.2017.V2.web-dl.1080p.h264.aac-hdctv/The.Legend.of.Condor.Heroes.2017.E07.V2.web-dl.1080p.h264.aac-hdctv.mkv", "The Legend of Condor Heroes 2017", 1, 7)]
        public void ParseEpisodesCorrectly(string path, string name, int season, int episode)
        {
            NamingOptions     o = new NamingOptions();
            EpisodePathParser p = new EpisodePathParser(o);
            var res             = p.Parse(path, false);

            Assert.True(res.Success);
            Assert.Equal(name, res.SeriesName);
            Assert.Equal(season, res.SeasonNumber);
            Assert.Equal(episode, res.EpisodeNumber);
        }
Esempio n. 12
0
        private void Test(string path, string seriesName, int?seasonNumber, int?episodeNumber)
        {
            var options = new NamingOptions();

            var result = new EpisodePathParser(options, new RegexProvider())
                         .Parse(path, FileInfoType.File);

            Assert.AreEqual(seasonNumber, result.SeasonNumber);
            Assert.AreEqual(episodeNumber, result.EpsiodeNumber);
            //Assert.AreEqual(seriesName, result.SeriesName, true, CultureInfo.InvariantCulture);
        }
Esempio n. 13
0
        public void ParseEpisodeWithoutSeason(string path, string name, int episode)
        {
            NamingOptions     o = new NamingOptions();
            EpisodePathParser p = new EpisodePathParser(o);
            var res             = p.Parse(path, true, fillExtendedInfo: true);

            Assert.True(res.Success);
            Assert.Equal(name, res.SeriesName);
            Assert.Null(res.SeasonNumber);
            Assert.Equal(episode, res.EpisodeNumber);
        }
Esempio n. 14
0
        public void EpisodePathParserTest_EmptyDateParsers()
        {
            NamingOptions o = new NamingOptions()
            {
                EpisodeExpressions = new[] { new EpisodeExpression("(([0-9]{4})-([0-9]{2})-([0-9]{2}) [0-9]{2}:[0-9]{2}:[0-9]{2})", true) }
            };

            o.Compile();

            EpisodePathParser p = new EpisodePathParser(o);
            var res             = p.Parse("ABC_2019_10_21 11:00:00", false);

            Assert.True(res.Success);
        }
        private void Test(string path, string seriesName, int?year, int?month, int?day)
        {
            var options = new NamingOptions();

            var result = new EpisodePathParser(options, new RegexProvider())
                         .Parse(path, FileInfoType.File);

            Assert.IsNull(result.SeasonNumber);
            Assert.IsNull(result.EpsiodeNumber);
            Assert.AreEqual(year, result.Year);
            Assert.AreEqual(month, result.Month);
            Assert.AreEqual(day, result.Day);
            //Assert.AreEqual(seriesName, result.SeriesName, true, CultureInfo.InvariantCulture);
        }
Esempio n. 16
0
        public void ParseEpisodeWithoutSeason(string path, string name, int episode)
        {
            NamingOptions     o = new NamingOptions();
            EpisodePathParser p = new EpisodePathParser(o);
            var res             = p.Parse(path, true, fillExtendedInfo: true);

            Assert.True(res.Success);
            Assert.Equal(name, res.SeriesName);
            Assert.Null(res.SeasonNumber);
            Assert.Equal(episode, res.EpisodeNumber);

            // testing other paths delimeter
            var res2 = p.Parse(path.Replace('/', '\\'), false, fillExtendedInfo: false);

            Assert.True(res2.Success);
            Assert.Equal(name, res2.SeriesName);
            Assert.Null(res2.SeasonNumber);
            Assert.Equal(episode, res2.EpisodeNumber);
        }
Esempio n. 17
0
        public void ParseEpisodesCorrectly(string path, string name, int season, int episode)
        {
            NamingOptions     o = new NamingOptions();
            EpisodePathParser p = new EpisodePathParser(o);
            var res             = p.Parse(path, false);

            Assert.True(res.Success);
            Assert.Equal(name, res.SeriesName);
            Assert.Equal(season, res.SeasonNumber);
            Assert.Equal(episode, res.EpisodeNumber);

            // testing other paths delimeter
            var res2 = p.Parse(path.Replace('/', '\\'), false);

            Assert.True(res2.Success);
            Assert.Equal(name, res2.SeriesName);
            Assert.Equal(season, res2.SeasonNumber);
            Assert.Equal(episode, res2.EpisodeNumber);
        }