diff --git a/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs b/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs index 9c7c6d13b..4c2b2d695 100644 --- a/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs +++ b/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs @@ -38,11 +38,11 @@ namespace NzbDrone.Core.DecisionEngine { foreach (var report in reports) { - var parseResult = _parsingService.Map(report); - var generalReasons = GetGeneralRejectionReasons(parseResult); - var searchReasons = GetSearchRejectionReasons(parseResult, searchDefinitionBase); + var remoteEpisode = _parsingService.Map(report); + var generalReasons = GetGeneralRejectionReasons(remoteEpisode); + var searchReasons = GetSearchRejectionReasons(remoteEpisode, searchDefinitionBase); - yield return new DownloadDecision(parseResult, generalReasons.Union(searchReasons).ToArray()); + yield return new DownloadDecision(remoteEpisode, generalReasons.Union(searchReasons).ToArray()); } } diff --git a/NzbDrone.Core/ExternalNotification/ExternalNotificationBase.cs b/NzbDrone.Core/ExternalNotification/ExternalNotificationBase.cs index 1b4596891..b11d19e40 100644 --- a/NzbDrone.Core/ExternalNotification/ExternalNotificationBase.cs +++ b/NzbDrone.Core/ExternalNotification/ExternalNotificationBase.cs @@ -100,7 +100,7 @@ namespace NzbDrone.Core.ExternalNotification try { _logger.Trace("Sending download notification to {0}", Name); - OnDownload(message.ParseResult.ToString(), message.Series); + OnDownload(message.ParsedEpisodeInfo.ToString(), message.Series); } catch (Exception e) { diff --git a/NzbDrone.Core/IndexerSearch/NzbSearchService.cs b/NzbDrone.Core/IndexerSearch/NzbSearchService.cs index 841f6a8ab..c952d46d2 100644 --- a/NzbDrone.Core/IndexerSearch/NzbSearchService.cs +++ b/NzbDrone.Core/IndexerSearch/NzbSearchService.cs @@ -110,7 +110,7 @@ namespace NzbDrone.Core.IndexerSearch private List Dispatch(Func> searchAction, SearchDefinitionBase definitionBase) { var indexers = _indexerService.GetAvailableIndexers(); - var parseResults = new List(); + var reports = new List(); Parallel.ForEach(indexers, indexer => { @@ -119,7 +119,7 @@ namespace NzbDrone.Core.IndexerSearch var indexerReports = searchAction(indexer); lock (indexer) { - parseResults.AddRange(indexerReports); + reports.AddRange(indexerReports); } } catch (Exception e) @@ -128,9 +128,9 @@ namespace NzbDrone.Core.IndexerSearch } }); - _logger.Debug("Total of {0} reports were found for {1} in {2} indexers", parseResults.Count, definitionBase, indexers.Count); + _logger.Debug("Total of {0} reports were found for {1} in {2} indexers", reports.Count, definitionBase, indexers.Count); - return _makeDownloadDecision.GetSearchDecision(parseResults, definitionBase).ToList(); + return _makeDownloadDecision.GetSearchDecision(reports, definitionBase).ToList(); } diff --git a/NzbDrone.Core/Indexers/BasicRssParser.cs b/NzbDrone.Core/Indexers/BasicRssParser.cs index 7dbfcf756..b38dd7593 100644 --- a/NzbDrone.Core/Indexers/BasicRssParser.cs +++ b/NzbDrone.Core/Indexers/BasicRssParser.cs @@ -79,15 +79,15 @@ namespace NzbDrone.Core.Indexers { var title = GetTitle(item); - var episodeParseResult = new ReportInfo(); + var reportInfo = new ReportInfo(); - episodeParseResult.Title = title; - episodeParseResult.Age = DateTime.Now.Date.Subtract(item.PublishDate.Date).Days; - episodeParseResult.ReleaseGroup = ParseReleaseGroup(title); + reportInfo.Title = title; + reportInfo.Age = DateTime.Now.Date.Subtract(item.PublishDate.Date).Days; + reportInfo.ReleaseGroup = ParseReleaseGroup(title); - _logger.Trace("Parsed: {0} from: {1}", episodeParseResult, item.Title.Text); + _logger.Trace("Parsed: {0} from: {1}", reportInfo, item.Title.Text); - return PostProcessor(item, episodeParseResult); + return PostProcessor(item, reportInfo); } public static string ParseReleaseGroup(string title) diff --git a/NzbDrone.Core/Indexers/Nzbx/NzbxParser.cs b/NzbDrone.Core/Indexers/Nzbx/NzbxParser.cs index c7e026d46..446df968e 100644 --- a/NzbDrone.Core/Indexers/Nzbx/NzbxParser.cs +++ b/NzbDrone.Core/Indexers/Nzbx/NzbxParser.cs @@ -30,14 +30,14 @@ namespace NzbDrone.Core.Indexers.Nzbx { try { - var episodeParseResult = new ReportInfo(); - episodeParseResult.Age = DateTime.Now.Date.Subtract(item.PostDate).Days; - episodeParseResult.Title = item.Name; - episodeParseResult.NzbUrl = String.Format("http://nzbx.co/nzb?{0}*|*{1}", item.Guid, item.Name); - episodeParseResult.NzbInfoUrl = String.Format("http://nzbx.co/d?{0}", item.Guid); - episodeParseResult.Size = item.Size; + var reportInfo = new ReportInfo(); + reportInfo.Age = DateTime.Now.Date.Subtract(item.PostDate).Days; + reportInfo.Title = item.Name; + reportInfo.NzbUrl = String.Format("http://nzbx.co/nzb?{0}*|*{1}", item.Guid, item.Name); + reportInfo.NzbInfoUrl = String.Format("http://nzbx.co/d?{0}", item.Guid); + reportInfo.Size = item.Size; - result.Add(episodeParseResult); + result.Add(reportInfo); } catch (Exception itemEx) { diff --git a/NzbDrone.Core/Indexers/RssSyncService.cs b/NzbDrone.Core/Indexers/RssSyncService.cs index e99aefdbc..b1543c3a1 100644 --- a/NzbDrone.Core/Indexers/RssSyncService.cs +++ b/NzbDrone.Core/Indexers/RssSyncService.cs @@ -6,7 +6,6 @@ using NzbDrone.Core.Download; namespace NzbDrone.Core.Indexers { - public interface IRssSyncService { void Sync(); @@ -32,10 +31,11 @@ namespace NzbDrone.Core.Indexers { _logger.Info("Starting RSS Sync"); - var parseResults = _rssFetcherAndParser.Fetch(); - var decisions = _downloadDecisionMaker.GetRssDecision(parseResults); + var reports = _rssFetcherAndParser.Fetch(); + var decisions = _downloadDecisionMaker.GetRssDecision(reports); //TODO: this will download multiple of same episode if they show up in RSS. need to + //proposal: maybe get download decision one by one, that way var qualifiedReports = decisions .Where(c => c.Approved) @@ -58,7 +58,7 @@ namespace NzbDrone.Core.Indexers } } - _logger.Info("RSS Sync Completed. Reports found: {0}, Fetches attempted: {1}", parseResults.Count, qualifiedReports.Count()); + _logger.Info("RSS Sync Completed. Reports found: {0}, Fetches attempted: {1}", reports.Count, qualifiedReports.Count()); } } } \ No newline at end of file diff --git a/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs b/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs index 5a89debbd..4079df116 100644 --- a/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs +++ b/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs @@ -78,12 +78,12 @@ namespace NzbDrone.Core.MediaFiles episodeFile.Path = newFile; _mediaFileService.Update(episodeFile); - var parseResult = Parser.Parser.ParsePath(episodeFile.Path); - parseResult.Quality = episodeFile.Quality; + var parsedEpisodeInfo = Parser.Parser.ParsePath(episodeFile.Path); + parsedEpisodeInfo.Quality = episodeFile.Quality; if (newDownload) { - _eventAggregator.Publish(new EpisodeDownloadedEvent(parseResult, series)); + _eventAggregator.Publish(new EpisodeDownloadedEvent(parsedEpisodeInfo, series)); } return episodeFile; diff --git a/NzbDrone.Core/MediaFiles/Events/EpisodeDownloadedEvent.cs b/NzbDrone.Core/MediaFiles/Events/EpisodeDownloadedEvent.cs index 2392c3c53..b0a5b91cd 100644 --- a/NzbDrone.Core/MediaFiles/Events/EpisodeDownloadedEvent.cs +++ b/NzbDrone.Core/MediaFiles/Events/EpisodeDownloadedEvent.cs @@ -1,6 +1,4 @@ using NzbDrone.Common.Eventing; -using NzbDrone.Core.Model; -using NzbDrone.Core.Parser; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Tv; @@ -8,12 +6,12 @@ namespace NzbDrone.Core.MediaFiles.Events { public class EpisodeDownloadedEvent : IEvent { - public ParsedEpisodeInfo ParseResult { get; private set; } + public ParsedEpisodeInfo ParsedEpisodeInfo { get; private set; } public Series Series { get; set; } - public EpisodeDownloadedEvent(ParsedEpisodeInfo parseResult, Series series) + public EpisodeDownloadedEvent(ParsedEpisodeInfo parsedEpisodeInfo, Series series) { - ParseResult = parseResult; + ParsedEpisodeInfo = parsedEpisodeInfo; Series = series; } } diff --git a/NzbDrone.Core/Parser/ParsingService.cs b/NzbDrone.Core/Parser/ParsingService.cs index 7330f9981..93232b7a5 100644 --- a/NzbDrone.Core/Parser/ParsingService.cs +++ b/NzbDrone.Core/Parser/ParsingService.cs @@ -30,14 +30,14 @@ namespace NzbDrone.Core.Parser public LocalEpisode GetEpisodes(string fileName, Series series) { - var parseResult = Parser.ParseTitle(fileName); + var parsedEpisodeInfo = Parser.ParseTitle(fileName); - if (parseResult == null) + if (parsedEpisodeInfo == null) { return null; } - var episodes = GetEpisodesByParseResult(parseResult, series); + var episodes = GetEpisodes(parsedEpisodeInfo, series); if (!episodes.Any()) { @@ -46,7 +46,7 @@ namespace NzbDrone.Core.Parser return new LocalEpisode { - Quality = parseResult.Quality, + Quality = parsedEpisodeInfo.Quality, Episodes = episodes, }; } @@ -55,11 +55,11 @@ namespace NzbDrone.Core.Parser { var searchTitle = title; - var parseResult = Parser.ParseTitle(title); + var parsedEpisodeInfo = Parser.ParseTitle(title); - if (parseResult != null) + if (parsedEpisodeInfo != null) { - searchTitle = parseResult.SeriesTitle; + searchTitle = parsedEpisodeInfo.SeriesTitle; } return _seriesService.FindByTitle(searchTitle); @@ -70,20 +70,20 @@ namespace NzbDrone.Core.Parser throw new NotImplementedException(); } - private List GetEpisodesByParseResult(ParsedEpisodeInfo parseResult, Series series) + private List GetEpisodes(ParsedEpisodeInfo parsedEpisodeInfo, Series series) { var result = new List(); - if (parseResult.AirDate.HasValue) + if (parsedEpisodeInfo.AirDate.HasValue) { if (series.SeriesType == SeriesTypes.Standard) { //Todo: Collect this as a Series we want to treat as a daily series, or possible parsing error - _logger.Warn("Found daily-style episode for non-daily series: {0}. {1}", series.Title, parseResult.OriginalString); + _logger.Warn("Found daily-style episode for non-daily series: {0}. {1}", series.Title, parsedEpisodeInfo.OriginalString); return new List(); } - var episodeInfo = _episodeService.GetEpisode(series.Id, parseResult.AirDate.Value); + var episodeInfo = _episodeService.GetEpisode(series.Id, parsedEpisodeInfo.AirDate.Value); if (episodeInfo != null) { @@ -93,24 +93,24 @@ namespace NzbDrone.Core.Parser return result; } - if (parseResult.EpisodeNumbers == null) + if (parsedEpisodeInfo.EpisodeNumbers == null) return result; - foreach (var episodeNumber in parseResult.EpisodeNumbers) + foreach (var episodeNumber in parsedEpisodeInfo.EpisodeNumbers) { Episode episodeInfo = null; - if (series.UseSceneNumbering && parseResult.SceneSource) + if (series.UseSceneNumbering && parsedEpisodeInfo.SceneSource) { - episodeInfo = _episodeService.GetEpisode(series.Id, parseResult.SeasonNumber, episodeNumber, true); + episodeInfo = _episodeService.GetEpisode(series.Id, parsedEpisodeInfo.SeasonNumber, episodeNumber, true); } if (episodeInfo == null) { - episodeInfo = _episodeService.GetEpisode(series.Id, parseResult.SeasonNumber, episodeNumber); - if (episodeInfo == null && parseResult.AirDate != null) + episodeInfo = _episodeService.GetEpisode(series.Id, parsedEpisodeInfo.SeasonNumber, episodeNumber); + if (episodeInfo == null && parsedEpisodeInfo.AirDate != null) { - episodeInfo = _episodeService.GetEpisode(series.Id, parseResult.AirDate.Value); + episodeInfo = _episodeService.GetEpisode(series.Id, parsedEpisodeInfo.AirDate.Value); } } @@ -130,7 +130,7 @@ namespace NzbDrone.Core.Parser } else { - _logger.Debug("Unable to find {0}", parseResult); + _logger.Debug("Unable to find {0}", parsedEpisodeInfo); } }