1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-30 19:56:54 +00:00

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 NUnit.Framework;
using NzbDrone.Common.Processes;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Test.Framework;
@ -17,8 +17,8 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
private void GivenOutput(string version)
{
Mocker.GetMock<IRuntimeProvider>()
.Setup(s => s.GetVersion())
Mocker.GetMock<IRuntimeInfo>()
.SetupGet(s => s.RuntimeVersion)
.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);
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);
_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)
{
@ -76,9 +76,13 @@ namespace NzbDrone.Core.Indexers
{
_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);
_logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count);
if (searchUrls.Any())
{
_logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count);
}
return result;
}
@ -87,10 +91,14 @@ namespace NzbDrone.Core.Indexers
{
_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);
_logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count);
if (searchUrls.Any())
{
_logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count);
}
return result;
}
@ -98,24 +106,34 @@ namespace NzbDrone.Core.Indexers
{
_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);
_logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count);
if (searchUrls.Any())
{
_logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count);
}
return result;
}
public IList<ReleaseInfo> Fetch(IIndexer indexer, SpecialEpisodeSearchCriteria searchCriteria)
{
var queryUrls = new List<String>();
var searchUrls = new List<String>();
foreach (var episodeQueryTitle in searchCriteria.EpisodeQueryTitles)
{
_logger.Debug("Performing query of {0} for {1}", indexer, episodeQueryTitle);
queryUrls.AddRange(indexer.GetSearchUrls(episodeQueryTitle));
searchUrls.AddRange(indexer.GetSearchUrls(episodeQueryTitle));
}
var result = Fetch(indexer, searchUrls);
if (searchUrls.Any())
{
_logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count);
}
var result = Fetch(indexer, queryUrls);
_logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count);
return result;
}