Fixed: no longer logging finished searching messages when search did not occur on that indexer

This commit is contained in:
Mark McDowall 2014-07-30 07:31:02 -07:00
parent 705d4a3d02
commit 043ca57e1e
2 changed files with 33 additions and 15 deletions

View File

@ -1,6 +1,6 @@
using System; using System;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common.Processes; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
@ -17,8 +17,8 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
private void GivenOutput(string version) private void GivenOutput(string version)
{ {
Mocker.GetMock<IRuntimeProvider>() Mocker.GetMock<IRuntimeInfo>()
.Setup(s => s.GetVersion()) .SetupGet(s => s.RuntimeVersion)
.Returns(String.Format("{0} (tarball Wed Sep 25 16:35:44 CDT 2013)", version)); .Returns(String.Format("{0} (tarball Wed Sep 25 16:35:44 CDT 2013)", version));
} }

View File

@ -59,10 +59,10 @@ namespace NzbDrone.Core.Indexers
{ {
_logger.Debug("Searching for {0} offset: {1}", searchCriteria, offset); _logger.Debug("Searching for {0} offset: {1}", searchCriteria, offset);
var searchUrls = indexer.GetSeasonSearchUrls(searchCriteria.QueryTitles, searchCriteria.Series.TvRageId, searchCriteria.SeasonNumber, offset); var searchUrls = indexer.GetSeasonSearchUrls(searchCriteria.QueryTitles, searchCriteria.Series.TvRageId, searchCriteria.SeasonNumber, offset).ToList();
var result = Fetch(indexer, searchUrls); var result = Fetch(indexer, searchUrls);
_logger.Info("{0} offset {1}. Found {2}", indexer, searchCriteria, result.Count); _logger.Info("{0} offset {1}. Found {2}", indexer, offset, result.Count);
if (indexer.SupportsPaging && result.Count >= indexer.SupportedPageSize && offset < 900) if (indexer.SupportsPaging && result.Count >= indexer.SupportedPageSize && offset < 900)
{ {
@ -76,9 +76,13 @@ namespace NzbDrone.Core.Indexers
{ {
_logger.Debug("Searching for {0}", searchCriteria); _logger.Debug("Searching for {0}", searchCriteria);
var searchUrls = indexer.GetEpisodeSearchUrls(searchCriteria.QueryTitles, searchCriteria.Series.TvRageId, searchCriteria.SeasonNumber, searchCriteria.EpisodeNumber); var searchUrls = indexer.GetEpisodeSearchUrls(searchCriteria.QueryTitles, searchCriteria.Series.TvRageId, searchCriteria.SeasonNumber, searchCriteria.EpisodeNumber).ToList();
var result = Fetch(indexer, searchUrls); var result = Fetch(indexer, searchUrls);
if (searchUrls.Any())
{
_logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count); _logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count);
}
return result; return result;
} }
@ -87,10 +91,14 @@ namespace NzbDrone.Core.Indexers
{ {
_logger.Debug("Searching for {0}", searchCriteria); _logger.Debug("Searching for {0}", searchCriteria);
var searchUrls = indexer.GetDailyEpisodeSearchUrls(searchCriteria.QueryTitles, searchCriteria.Series.TvRageId, searchCriteria.AirDate); var searchUrls = indexer.GetDailyEpisodeSearchUrls(searchCriteria.QueryTitles, searchCriteria.Series.TvRageId, searchCriteria.AirDate).ToList();
var result = Fetch(indexer, searchUrls); var result = Fetch(indexer, searchUrls);
if (searchUrls.Any())
{
_logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count); _logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count);
}
return result; return result;
} }
@ -98,24 +106,34 @@ namespace NzbDrone.Core.Indexers
{ {
_logger.Debug("Searching for {0}", searchCriteria); _logger.Debug("Searching for {0}", searchCriteria);
var searchUrls = indexer.GetAnimeEpisodeSearchUrls(searchCriteria.SceneTitles, searchCriteria.Series.TvRageId, searchCriteria.AbsoluteEpisodeNumber); var searchUrls = indexer.GetAnimeEpisodeSearchUrls(searchCriteria.SceneTitles, searchCriteria.Series.TvRageId, searchCriteria.AbsoluteEpisodeNumber).ToList();
var result = Fetch(indexer, searchUrls); var result = Fetch(indexer, searchUrls);
if (searchUrls.Any())
{
_logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count); _logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count);
}
return result; return result;
} }
public IList<ReleaseInfo> Fetch(IIndexer indexer, SpecialEpisodeSearchCriteria searchCriteria) public IList<ReleaseInfo> Fetch(IIndexer indexer, SpecialEpisodeSearchCriteria searchCriteria)
{ {
var queryUrls = new List<String>(); var searchUrls = new List<String>();
foreach (var episodeQueryTitle in searchCriteria.EpisodeQueryTitles) foreach (var episodeQueryTitle in searchCriteria.EpisodeQueryTitles)
{ {
_logger.Debug("Performing query of {0} for {1}", indexer, episodeQueryTitle); _logger.Debug("Performing query of {0} for {1}", indexer, episodeQueryTitle);
queryUrls.AddRange(indexer.GetSearchUrls(episodeQueryTitle)); searchUrls.AddRange(indexer.GetSearchUrls(episodeQueryTitle));
} }
var result = Fetch(indexer, queryUrls); var result = Fetch(indexer, searchUrls);
if (searchUrls.Any())
{
_logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count); _logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count);
}
return result; return result;
} }