1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

renamed some old 'parseResult' variable names.

This commit is contained in:
kay.one 2013-04-22 23:14:55 -07:00 committed by Keivan Beigi
parent 99958a822d
commit a8e76b3251
9 changed files with 51 additions and 53 deletions

View File

@ -38,11 +38,11 @@ public IEnumerable<DownloadDecision> GetSearchDecision(IEnumerable<ReportInfo> r
{
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());
}
}

View File

@ -100,7 +100,7 @@ public void Handle(EpisodeDownloadedEvent message)
try
{
_logger.Trace("Sending download notification to {0}", Name);
OnDownload(message.ParseResult.ToString(), message.Series);
OnDownload(message.ParsedEpisodeInfo.ToString(), message.Series);
}
catch (Exception e)
{

View File

@ -110,7 +110,7 @@ private List<DownloadDecision> PartialSeasonSearch(SeasonSearchDefinition search
private List<DownloadDecision> Dispatch(Func<IIndexerBase, IEnumerable<ReportInfo>> searchAction, SearchDefinitionBase definitionBase)
{
var indexers = _indexerService.GetAvailableIndexers();
var parseResults = new List<ReportInfo>();
var reports = new List<ReportInfo>();
Parallel.ForEach(indexers, indexer =>
{
@ -119,7 +119,7 @@ private List<DownloadDecision> Dispatch(Func<IIndexerBase, IEnumerable<ReportInf
var indexerReports = searchAction(indexer);
lock (indexer)
{
parseResults.AddRange(indexerReports);
reports.AddRange(indexerReports);
}
}
catch (Exception e)
@ -128,9 +128,9 @@ private List<DownloadDecision> Dispatch(Func<IIndexerBase, IEnumerable<ReportInf
}
});
_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();
}

View File

@ -79,15 +79,15 @@ private ReportInfo ParseFeed(SyndicationItem item)
{
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)

View File

@ -30,14 +30,14 @@ public IEnumerable<ReportInfo> Process(Stream source)
{
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)
{

View File

@ -6,7 +6,6 @@
namespace NzbDrone.Core.Indexers
{
public interface IRssSyncService
{
void Sync();
@ -32,10 +31,11 @@ public void Sync()
{
_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 @@ public void Sync()
}
}
_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());
}
}
}

View File

@ -78,12 +78,12 @@ public EpisodeFile MoveEpisodeFile(EpisodeFile episodeFile, bool newDownload = f
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;

View File

@ -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;
}
}

View File

@ -30,14 +30,14 @@ public ParsingService(IEpisodeService episodeService, ISeriesService seriesServi
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 @@ public LocalEpisode GetEpisodes(string fileName, Series series)
return new LocalEpisode
{
Quality = parseResult.Quality,
Quality = parsedEpisodeInfo.Quality,
Episodes = episodes,
};
}
@ -55,11 +55,11 @@ public Series GetSeries(string 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);
@ -70,20 +70,20 @@ public RemoteEpisode Map(ReportInfo indexerParseResult)
throw new NotImplementedException();
}
private List<Episode> GetEpisodesByParseResult(ParsedEpisodeInfo parseResult, Series series)
private List<Episode> GetEpisodes(ParsedEpisodeInfo parsedEpisodeInfo, Series series)
{
var result = new List<Episode>();
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<Episode>();
}
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 @@ private List<Episode> GetEpisodesByParseResult(ParsedEpisodeInfo parseResult, Se
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 @@ private List<Episode> GetEpisodesByParseResult(ParsedEpisodeInfo parseResult, Se
}
else
{
_logger.Debug("Unable to find {0}", parseResult);
_logger.Debug("Unable to find {0}", parsedEpisodeInfo);
}
}