renamed some old 'parseResult' variable names.
This commit is contained in:
parent
99958a822d
commit
a8e76b3251
|
@ -38,11 +38,11 @@ namespace NzbDrone.Core.DecisionEngine
|
||||||
{
|
{
|
||||||
foreach (var report in reports)
|
foreach (var report in reports)
|
||||||
{
|
{
|
||||||
var parseResult = _parsingService.Map(report);
|
var remoteEpisode = _parsingService.Map(report);
|
||||||
var generalReasons = GetGeneralRejectionReasons(parseResult);
|
var generalReasons = GetGeneralRejectionReasons(remoteEpisode);
|
||||||
var searchReasons = GetSearchRejectionReasons(parseResult, searchDefinitionBase);
|
var searchReasons = GetSearchRejectionReasons(remoteEpisode, searchDefinitionBase);
|
||||||
|
|
||||||
yield return new DownloadDecision(parseResult, generalReasons.Union(searchReasons).ToArray());
|
yield return new DownloadDecision(remoteEpisode, generalReasons.Union(searchReasons).ToArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ namespace NzbDrone.Core.ExternalNotification
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.Trace("Sending download notification to {0}", Name);
|
_logger.Trace("Sending download notification to {0}", Name);
|
||||||
OnDownload(message.ParseResult.ToString(), message.Series);
|
OnDownload(message.ParsedEpisodeInfo.ToString(), message.Series);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,7 +110,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
private List<DownloadDecision> Dispatch(Func<IIndexerBase, IEnumerable<ReportInfo>> searchAction, SearchDefinitionBase definitionBase)
|
private List<DownloadDecision> Dispatch(Func<IIndexerBase, IEnumerable<ReportInfo>> searchAction, SearchDefinitionBase definitionBase)
|
||||||
{
|
{
|
||||||
var indexers = _indexerService.GetAvailableIndexers();
|
var indexers = _indexerService.GetAvailableIndexers();
|
||||||
var parseResults = new List<ReportInfo>();
|
var reports = new List<ReportInfo>();
|
||||||
|
|
||||||
Parallel.ForEach(indexers, indexer =>
|
Parallel.ForEach(indexers, indexer =>
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
var indexerReports = searchAction(indexer);
|
var indexerReports = searchAction(indexer);
|
||||||
lock (indexer)
|
lock (indexer)
|
||||||
{
|
{
|
||||||
parseResults.AddRange(indexerReports);
|
reports.AddRange(indexerReports);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -79,15 +79,15 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
var title = GetTitle(item);
|
var title = GetTitle(item);
|
||||||
|
|
||||||
var episodeParseResult = new ReportInfo();
|
var reportInfo = new ReportInfo();
|
||||||
|
|
||||||
episodeParseResult.Title = title;
|
reportInfo.Title = title;
|
||||||
episodeParseResult.Age = DateTime.Now.Date.Subtract(item.PublishDate.Date).Days;
|
reportInfo.Age = DateTime.Now.Date.Subtract(item.PublishDate.Date).Days;
|
||||||
episodeParseResult.ReleaseGroup = ParseReleaseGroup(title);
|
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)
|
public static string ParseReleaseGroup(string title)
|
||||||
|
|
|
@ -30,14 +30,14 @@ namespace NzbDrone.Core.Indexers.Nzbx
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var episodeParseResult = new ReportInfo();
|
var reportInfo = new ReportInfo();
|
||||||
episodeParseResult.Age = DateTime.Now.Date.Subtract(item.PostDate).Days;
|
reportInfo.Age = DateTime.Now.Date.Subtract(item.PostDate).Days;
|
||||||
episodeParseResult.Title = item.Name;
|
reportInfo.Title = item.Name;
|
||||||
episodeParseResult.NzbUrl = String.Format("http://nzbx.co/nzb?{0}*|*{1}", item.Guid, item.Name);
|
reportInfo.NzbUrl = String.Format("http://nzbx.co/nzb?{0}*|*{1}", item.Guid, item.Name);
|
||||||
episodeParseResult.NzbInfoUrl = String.Format("http://nzbx.co/d?{0}", item.Guid);
|
reportInfo.NzbInfoUrl = String.Format("http://nzbx.co/d?{0}", item.Guid);
|
||||||
episodeParseResult.Size = item.Size;
|
reportInfo.Size = item.Size;
|
||||||
|
|
||||||
result.Add(episodeParseResult);
|
result.Add(reportInfo);
|
||||||
}
|
}
|
||||||
catch (Exception itemEx)
|
catch (Exception itemEx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,6 @@ using NzbDrone.Core.Download;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers
|
namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
|
|
||||||
public interface IRssSyncService
|
public interface IRssSyncService
|
||||||
{
|
{
|
||||||
void Sync();
|
void Sync();
|
||||||
|
@ -32,10 +31,11 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
_logger.Info("Starting RSS Sync");
|
_logger.Info("Starting RSS Sync");
|
||||||
|
|
||||||
var parseResults = _rssFetcherAndParser.Fetch();
|
var reports = _rssFetcherAndParser.Fetch();
|
||||||
var decisions = _downloadDecisionMaker.GetRssDecision(parseResults);
|
var decisions = _downloadDecisionMaker.GetRssDecision(reports);
|
||||||
|
|
||||||
//TODO: this will download multiple of same episode if they show up in RSS. need to
|
//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
|
var qualifiedReports = decisions
|
||||||
.Where(c => c.Approved)
|
.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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -78,12 +78,12 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
episodeFile.Path = newFile;
|
episodeFile.Path = newFile;
|
||||||
_mediaFileService.Update(episodeFile);
|
_mediaFileService.Update(episodeFile);
|
||||||
|
|
||||||
var parseResult = Parser.Parser.ParsePath(episodeFile.Path);
|
var parsedEpisodeInfo = Parser.Parser.ParsePath(episodeFile.Path);
|
||||||
parseResult.Quality = episodeFile.Quality;
|
parsedEpisodeInfo.Quality = episodeFile.Quality;
|
||||||
|
|
||||||
if (newDownload)
|
if (newDownload)
|
||||||
{
|
{
|
||||||
_eventAggregator.Publish(new EpisodeDownloadedEvent(parseResult, series));
|
_eventAggregator.Publish(new EpisodeDownloadedEvent(parsedEpisodeInfo, series));
|
||||||
}
|
}
|
||||||
|
|
||||||
return episodeFile;
|
return episodeFile;
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Eventing;
|
||||||
using NzbDrone.Core.Model;
|
|
||||||
using NzbDrone.Core.Parser;
|
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
|
@ -8,12 +6,12 @@ namespace NzbDrone.Core.MediaFiles.Events
|
||||||
{
|
{
|
||||||
public class EpisodeDownloadedEvent : IEvent
|
public class EpisodeDownloadedEvent : IEvent
|
||||||
{
|
{
|
||||||
public ParsedEpisodeInfo ParseResult { get; private set; }
|
public ParsedEpisodeInfo ParsedEpisodeInfo { get; private set; }
|
||||||
public Series Series { get; set; }
|
public Series Series { get; set; }
|
||||||
|
|
||||||
public EpisodeDownloadedEvent(ParsedEpisodeInfo parseResult, Series series)
|
public EpisodeDownloadedEvent(ParsedEpisodeInfo parsedEpisodeInfo, Series series)
|
||||||
{
|
{
|
||||||
ParseResult = parseResult;
|
ParsedEpisodeInfo = parsedEpisodeInfo;
|
||||||
Series = series;
|
Series = series;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,14 +30,14 @@ namespace NzbDrone.Core.Parser
|
||||||
|
|
||||||
public LocalEpisode GetEpisodes(string fileName, Series series)
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var episodes = GetEpisodesByParseResult(parseResult, series);
|
var episodes = GetEpisodes(parsedEpisodeInfo, series);
|
||||||
|
|
||||||
if (!episodes.Any())
|
if (!episodes.Any())
|
||||||
{
|
{
|
||||||
|
@ -46,7 +46,7 @@ namespace NzbDrone.Core.Parser
|
||||||
|
|
||||||
return new LocalEpisode
|
return new LocalEpisode
|
||||||
{
|
{
|
||||||
Quality = parseResult.Quality,
|
Quality = parsedEpisodeInfo.Quality,
|
||||||
Episodes = episodes,
|
Episodes = episodes,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -55,11 +55,11 @@ namespace NzbDrone.Core.Parser
|
||||||
{
|
{
|
||||||
var searchTitle = title;
|
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);
|
return _seriesService.FindByTitle(searchTitle);
|
||||||
|
@ -70,20 +70,20 @@ namespace NzbDrone.Core.Parser
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Episode> GetEpisodesByParseResult(ParsedEpisodeInfo parseResult, Series series)
|
private List<Episode> GetEpisodes(ParsedEpisodeInfo parsedEpisodeInfo, Series series)
|
||||||
{
|
{
|
||||||
var result = new List<Episode>();
|
var result = new List<Episode>();
|
||||||
|
|
||||||
if (parseResult.AirDate.HasValue)
|
if (parsedEpisodeInfo.AirDate.HasValue)
|
||||||
{
|
{
|
||||||
if (series.SeriesType == SeriesTypes.Standard)
|
if (series.SeriesType == SeriesTypes.Standard)
|
||||||
{
|
{
|
||||||
//Todo: Collect this as a Series we want to treat as a daily series, or possible parsing error
|
//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<Episode>();
|
return new List<Episode>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var episodeInfo = _episodeService.GetEpisode(series.Id, parseResult.AirDate.Value);
|
var episodeInfo = _episodeService.GetEpisode(series.Id, parsedEpisodeInfo.AirDate.Value);
|
||||||
|
|
||||||
if (episodeInfo != null)
|
if (episodeInfo != null)
|
||||||
{
|
{
|
||||||
|
@ -93,24 +93,24 @@ namespace NzbDrone.Core.Parser
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parseResult.EpisodeNumbers == null)
|
if (parsedEpisodeInfo.EpisodeNumbers == null)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
foreach (var episodeNumber in parseResult.EpisodeNumbers)
|
foreach (var episodeNumber in parsedEpisodeInfo.EpisodeNumbers)
|
||||||
{
|
{
|
||||||
Episode episodeInfo = null;
|
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)
|
if (episodeInfo == null)
|
||||||
{
|
{
|
||||||
episodeInfo = _episodeService.GetEpisode(series.Id, parseResult.SeasonNumber, episodeNumber);
|
episodeInfo = _episodeService.GetEpisode(series.Id, parsedEpisodeInfo.SeasonNumber, episodeNumber);
|
||||||
if (episodeInfo == null && parseResult.AirDate != null)
|
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
|
else
|
||||||
{
|
{
|
||||||
_logger.Debug("Unable to find {0}", parseResult);
|
_logger.Debug("Unable to find {0}", parsedEpisodeInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue