Ejemplo n.º 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);
        }
Ejemplo n.º 2
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;
        }