Example #1
0
        public EpisodeProcessResult GetTvEpisodesFiles()
        {
            var result = new EpisodeProcessResult();

            var files = _sourceFolder.EnumerateFiles("*", true)
                        .Where(f => _settings.FileExtentions.Contains(new File(f).Extension.ToLower()) && !f.Contains("sample"));

            var episodeFiles = TvEpisodeFileMatcher.GetTvEpisodesFiles(files);

            if (!episodeFiles.Any())
            {
                _logger.Info("No Downloaded episodes found to process");
                return(result);
            }

            foreach (var file in episodeFiles)
            {
                var episode = _tvService.GetEpisodeBySeriesName(file.SeriesName, file.Season, file.EpisodeNumber, true);

                if (episode != null)
                {
                    episode.FileName = file.FileName;
                    result.MatchedEpisodes.Add(episode);
                    continue;
                }

                _logger.Info($"Could not find Season: {file.Season} Episode: {file.EpisodeNumber} of Series: {file.SeriesName} in database");
                result.UnmatchedEpisodes.Add(file);
            }

            return(result);
        }
Example #2
0
        public void ValidEpisodeFormats()
        {
            var source = new[] {
                "The.Mindy.Project.S03E18.720p.HDTV.x264-KILLERS[rarbg]",
                "The.Walking.Dead.S05E12.720p.HDTV.x264-KILLERS",
                "The.Simpsons.S26E15.REAL.REPACK.720p.HDTV.x264-KILLERS.mkv",
                "testing s1e2 file.avi",
                "testing s01e02 - proper - eztv.mkv",
                "c:\\test\\Undateable.2014.S02E02.HDTV.x264-LOL[rarbg]\\undateable.202.hdtv-lol.mp4"
            };

            var matches = TvEpisodeFileMatcher.GetTvEpisodesFiles(source).ToList();

            Assert.IsTrue(matches.Count() == 6);
        }