Rename NzbSearchService to ReleaseSearchService

This commit is contained in:
Mark McDowall 2021-10-05 12:00:15 -07:00
parent 4bdb7fe795
commit eb4a9f624e
7 changed files with 28 additions and 28 deletions

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Api.Indexers
public class ReleaseModule : ReleaseModuleBase public class ReleaseModule : ReleaseModuleBase
{ {
private readonly IFetchAndParseRss _rssFetcherAndParser; private readonly IFetchAndParseRss _rssFetcherAndParser;
private readonly ISearchForNzb _nzbSearchService; private readonly ISearchForReleases _releaseSearchService;
private readonly IMakeDownloadDecision _downloadDecisionMaker; private readonly IMakeDownloadDecision _downloadDecisionMaker;
private readonly IPrioritizeDownloadDecision _prioritizeDownloadDecision; private readonly IPrioritizeDownloadDecision _prioritizeDownloadDecision;
private readonly IDownloadService _downloadService; private readonly IDownloadService _downloadService;
@ -27,7 +27,7 @@ namespace NzbDrone.Api.Indexers
private readonly ICached<RemoteEpisode> _remoteEpisodeCache; private readonly ICached<RemoteEpisode> _remoteEpisodeCache;
public ReleaseModule(IFetchAndParseRss rssFetcherAndParser, public ReleaseModule(IFetchAndParseRss rssFetcherAndParser,
ISearchForNzb nzbSearchService, ISearchForReleases releaseSearchService,
IMakeDownloadDecision downloadDecisionMaker, IMakeDownloadDecision downloadDecisionMaker,
IPrioritizeDownloadDecision prioritizeDownloadDecision, IPrioritizeDownloadDecision prioritizeDownloadDecision,
IDownloadService downloadService, IDownloadService downloadService,
@ -35,7 +35,7 @@ namespace NzbDrone.Api.Indexers
Logger logger) Logger logger)
{ {
_rssFetcherAndParser = rssFetcherAndParser; _rssFetcherAndParser = rssFetcherAndParser;
_nzbSearchService = nzbSearchService; _releaseSearchService = releaseSearchService;
_downloadDecisionMaker = downloadDecisionMaker; _downloadDecisionMaker = downloadDecisionMaker;
_prioritizeDownloadDecision = prioritizeDownloadDecision; _prioritizeDownloadDecision = prioritizeDownloadDecision;
_downloadService = downloadService; _downloadService = downloadService;
@ -88,7 +88,7 @@ namespace NzbDrone.Api.Indexers
{ {
try try
{ {
var decisions = _nzbSearchService.EpisodeSearch(episodeId, true, true); var decisions = _releaseSearchService.EpisodeSearch(episodeId, true, true);
var prioritizedDecisions = _prioritizeDownloadDecision.PrioritizeDecisions(decisions); var prioritizedDecisions = _prioritizeDownloadDecision.PrioritizeDecisions(decisions);
return MapDecisions(prioritizedDecisions); return MapDecisions(prioritizedDecisions);

View File

@ -16,7 +16,7 @@ using NzbDrone.Core.Tv;
namespace NzbDrone.Core.Test.IndexerSearchTests namespace NzbDrone.Core.Test.IndexerSearchTests
{ {
public class NzbSearchServiceFixture : CoreTest<NzbSearchService> public class ReleaseSearchServiceFixture : CoreTest<ReleaseSearchService>
{ {
private Mock<IIndexer> _mockIndexer; private Mock<IIndexer> _mockIndexer;
private Series _xemSeries; private Series _xemSeries;

View File

@ -18,21 +18,21 @@ namespace NzbDrone.Core.IndexerSearch
IExecute<MissingEpisodeSearchCommand>, IExecute<MissingEpisodeSearchCommand>,
IExecute<CutoffUnmetEpisodeSearchCommand> IExecute<CutoffUnmetEpisodeSearchCommand>
{ {
private readonly ISearchForNzb _nzbSearchService; private readonly ISearchForReleases _releaseSearchService;
private readonly IProcessDownloadDecisions _processDownloadDecisions; private readonly IProcessDownloadDecisions _processDownloadDecisions;
private readonly IEpisodeService _episodeService; private readonly IEpisodeService _episodeService;
private readonly IEpisodeCutoffService _episodeCutoffService; private readonly IEpisodeCutoffService _episodeCutoffService;
private readonly IQueueService _queueService; private readonly IQueueService _queueService;
private readonly Logger _logger; private readonly Logger _logger;
public EpisodeSearchService(ISearchForNzb nzbSearchService, public EpisodeSearchService(ISearchForReleases releaseSearchService,
IProcessDownloadDecisions processDownloadDecisions, IProcessDownloadDecisions processDownloadDecisions,
IEpisodeService episodeService, IEpisodeService episodeService,
IEpisodeCutoffService episodeCutoffService, IEpisodeCutoffService episodeCutoffService,
IQueueService queueService, IQueueService queueService,
Logger logger) Logger logger)
{ {
_nzbSearchService = nzbSearchService; _releaseSearchService = releaseSearchService;
_processDownloadDecisions = processDownloadDecisions; _processDownloadDecisions = processDownloadDecisions;
_episodeService = episodeService; _episodeService = episodeService;
_episodeCutoffService = episodeCutoffService; _episodeCutoffService = episodeCutoffService;
@ -55,7 +55,7 @@ namespace NzbDrone.Core.IndexerSearch
{ {
try try
{ {
decisions = _nzbSearchService.SeasonSearch(series.Key, season.Key, season.ToList(), monitoredOnly, userInvokedSearch, false); decisions = _releaseSearchService.SeasonSearch(series.Key, season.Key, season.ToList(), monitoredOnly, userInvokedSearch, false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -68,7 +68,7 @@ namespace NzbDrone.Core.IndexerSearch
{ {
try try
{ {
decisions = _nzbSearchService.EpisodeSearch(season.First(), userInvokedSearch, false); decisions = _releaseSearchService.EpisodeSearch(season.First(), userInvokedSearch, false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -95,7 +95,7 @@ namespace NzbDrone.Core.IndexerSearch
{ {
foreach (var episodeId in message.EpisodeIds) foreach (var episodeId in message.EpisodeIds)
{ {
var decisions = _nzbSearchService.EpisodeSearch(episodeId, message.Trigger == CommandTrigger.Manual, false); var decisions = _releaseSearchService.EpisodeSearch(episodeId, message.Trigger == CommandTrigger.Manual, false);
var processed = _processDownloadDecisions.ProcessDecisions(decisions); var processed = _processDownloadDecisions.ProcessDecisions(decisions);
_logger.ProgressInfo("Episode search completed. {0} reports downloaded.", processed.Grabbed.Count); _logger.ProgressInfo("Episode search completed. {0} reports downloaded.", processed.Grabbed.Count);

View File

@ -18,7 +18,7 @@ using NzbDrone.Core.Parser;
namespace NzbDrone.Core.IndexerSearch namespace NzbDrone.Core.IndexerSearch
{ {
public interface ISearchForNzb public interface ISearchForReleases
{ {
List<DownloadDecision> EpisodeSearch(int episodeId, bool userInvokedSearch, bool interactiveSearch); List<DownloadDecision> EpisodeSearch(int episodeId, bool userInvokedSearch, bool interactiveSearch);
List<DownloadDecision> EpisodeSearch(Episode episode, bool userInvokedSearch, bool interactiveSearch); List<DownloadDecision> EpisodeSearch(Episode episode, bool userInvokedSearch, bool interactiveSearch);
@ -26,7 +26,7 @@ namespace NzbDrone.Core.IndexerSearch
List<DownloadDecision> SeasonSearch(int seriesId, int seasonNumber, List<Episode> episodes, bool monitoredOnly, bool userInvokedSearch, bool interactiveSearch); List<DownloadDecision> SeasonSearch(int seriesId, int seasonNumber, List<Episode> episodes, bool monitoredOnly, bool userInvokedSearch, bool interactiveSearch);
} }
public class NzbSearchService : ISearchForNzb public class ReleaseSearchService : ISearchForReleases
{ {
private readonly IIndexerFactory _indexerFactory; private readonly IIndexerFactory _indexerFactory;
private readonly ISceneMappingService _sceneMapping; private readonly ISceneMappingService _sceneMapping;
@ -35,7 +35,7 @@ namespace NzbDrone.Core.IndexerSearch
private readonly IMakeDownloadDecision _makeDownloadDecision; private readonly IMakeDownloadDecision _makeDownloadDecision;
private readonly Logger _logger; private readonly Logger _logger;
public NzbSearchService(IIndexerFactory indexerFactory, public ReleaseSearchService(IIndexerFactory indexerFactory,
ISceneMappingService sceneMapping, ISceneMappingService sceneMapping,
ISeriesService seriesService, ISeriesService seriesService,
IEpisodeService episodeService, IEpisodeService episodeService,
@ -373,7 +373,7 @@ namespace NzbDrone.Core.IndexerSearch
var searchSpec = Get<SpecialEpisodeSearchCriteria>(series, episodes, monitoredOnly, userInvokedSearch, interactiveSearch); var searchSpec = Get<SpecialEpisodeSearchCriteria>(series, episodes, monitoredOnly, userInvokedSearch, interactiveSearch);
// build list of queries for each episode in the form: "<series> <episode-title>" // build list of queries for each episode in the form: "<series> <episode-title>"
searchSpec.EpisodeQueryTitles = episodes.Where(e => !string.IsNullOrWhiteSpace(e.Title)) searchSpec.EpisodeQueryTitles = episodes.Where(e => !string.IsNullOrWhiteSpace(e.Title))
.SelectMany(e => searchSpec.QueryTitles.Select(title => title + " " + SearchCriteriaBase.GetQueryTitle(e.Title))) .SelectMany(e => searchSpec.CleanSceneTitles.Select(title => title + " " + SearchCriteriaBase.GetCleanSceneTitle(e.Title)))
.ToArray(); .ToArray();
downloadDecisions.AddRange(Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec)); downloadDecisions.AddRange(Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec));

View File

@ -7,22 +7,22 @@ namespace NzbDrone.Core.IndexerSearch
{ {
public class SeasonSearchService : IExecute<SeasonSearchCommand> public class SeasonSearchService : IExecute<SeasonSearchCommand>
{ {
private readonly ISearchForNzb _nzbSearchService; private readonly ISearchForReleases _releaseSearchService;
private readonly IProcessDownloadDecisions _processDownloadDecisions; private readonly IProcessDownloadDecisions _processDownloadDecisions;
private readonly Logger _logger; private readonly Logger _logger;
public SeasonSearchService(ISearchForNzb nzbSearchService, public SeasonSearchService(ISearchForReleases releaseSearchService,
IProcessDownloadDecisions processDownloadDecisions, IProcessDownloadDecisions processDownloadDecisions,
Logger logger) Logger logger)
{ {
_nzbSearchService = nzbSearchService; _releaseSearchService = releaseSearchService;
_processDownloadDecisions = processDownloadDecisions; _processDownloadDecisions = processDownloadDecisions;
_logger = logger; _logger = logger;
} }
public void Execute(SeasonSearchCommand message) public void Execute(SeasonSearchCommand message)
{ {
var decisions = _nzbSearchService.SeasonSearch(message.SeriesId, message.SeasonNumber, false, true, message.Trigger == CommandTrigger.Manual, false); var decisions = _releaseSearchService.SeasonSearch(message.SeriesId, message.SeasonNumber, false, true, message.Trigger == CommandTrigger.Manual, false);
var processed = _processDownloadDecisions.ProcessDecisions(decisions); var processed = _processDownloadDecisions.ProcessDecisions(decisions);
_logger.ProgressInfo("Season search completed. {0} reports downloaded.", processed.Grabbed.Count); _logger.ProgressInfo("Season search completed. {0} reports downloaded.", processed.Grabbed.Count);

View File

@ -10,17 +10,17 @@ namespace NzbDrone.Core.IndexerSearch
public class SeriesSearchService : IExecute<SeriesSearchCommand> public class SeriesSearchService : IExecute<SeriesSearchCommand>
{ {
private readonly ISeriesService _seriesService; private readonly ISeriesService _seriesService;
private readonly ISearchForNzb _nzbSearchService; private readonly ISearchForReleases _releaseSearchService;
private readonly IProcessDownloadDecisions _processDownloadDecisions; private readonly IProcessDownloadDecisions _processDownloadDecisions;
private readonly Logger _logger; private readonly Logger _logger;
public SeriesSearchService(ISeriesService seriesService, public SeriesSearchService(ISeriesService seriesService,
ISearchForNzb nzbSearchService, ISearchForReleases releaseSearchService,
IProcessDownloadDecisions processDownloadDecisions, IProcessDownloadDecisions processDownloadDecisions,
Logger logger) Logger logger)
{ {
_seriesService = seriesService; _seriesService = seriesService;
_nzbSearchService = nzbSearchService; _releaseSearchService = releaseSearchService;
_processDownloadDecisions = processDownloadDecisions; _processDownloadDecisions = processDownloadDecisions;
_logger = logger; _logger = logger;
} }
@ -39,7 +39,7 @@ namespace NzbDrone.Core.IndexerSearch
continue; continue;
} }
var decisions = _nzbSearchService.SeasonSearch(message.SeriesId, season.SeasonNumber, false, true, message.Trigger == CommandTrigger.Manual, false); var decisions = _releaseSearchService.SeasonSearch(message.SeriesId, season.SeasonNumber, false, true, message.Trigger == CommandTrigger.Manual, false);
downloadedCount += _processDownloadDecisions.ProcessDecisions(decisions).Grabbed.Count; downloadedCount += _processDownloadDecisions.ProcessDecisions(decisions).Grabbed.Count;
} }

View File

@ -23,7 +23,7 @@ namespace Sonarr.Api.V3.Indexers
public class ReleaseModule : ReleaseModuleBase public class ReleaseModule : ReleaseModuleBase
{ {
private readonly IFetchAndParseRss _rssFetcherAndParser; private readonly IFetchAndParseRss _rssFetcherAndParser;
private readonly ISearchForNzb _nzbSearchService; private readonly ISearchForReleases _releaseSearchService;
private readonly IMakeDownloadDecision _downloadDecisionMaker; private readonly IMakeDownloadDecision _downloadDecisionMaker;
private readonly IPrioritizeDownloadDecision _prioritizeDownloadDecision; private readonly IPrioritizeDownloadDecision _prioritizeDownloadDecision;
private readonly IDownloadService _downloadService; private readonly IDownloadService _downloadService;
@ -35,7 +35,7 @@ namespace Sonarr.Api.V3.Indexers
private readonly ICached<RemoteEpisode> _remoteEpisodeCache; private readonly ICached<RemoteEpisode> _remoteEpisodeCache;
public ReleaseModule(IFetchAndParseRss rssFetcherAndParser, public ReleaseModule(IFetchAndParseRss rssFetcherAndParser,
ISearchForNzb nzbSearchService, ISearchForReleases releaseSearchService,
IMakeDownloadDecision downloadDecisionMaker, IMakeDownloadDecision downloadDecisionMaker,
IPrioritizeDownloadDecision prioritizeDownloadDecision, IPrioritizeDownloadDecision prioritizeDownloadDecision,
IDownloadService downloadService, IDownloadService downloadService,
@ -49,7 +49,7 @@ namespace Sonarr.Api.V3.Indexers
base(languageProfileService, qualityProfileService) base(languageProfileService, qualityProfileService)
{ {
_rssFetcherAndParser = rssFetcherAndParser; _rssFetcherAndParser = rssFetcherAndParser;
_nzbSearchService = nzbSearchService; _releaseSearchService = releaseSearchService;
_downloadDecisionMaker = downloadDecisionMaker; _downloadDecisionMaker = downloadDecisionMaker;
_prioritizeDownloadDecision = prioritizeDownloadDecision; _prioritizeDownloadDecision = prioritizeDownloadDecision;
_downloadService = downloadService; _downloadService = downloadService;
@ -156,7 +156,7 @@ namespace Sonarr.Api.V3.Indexers
{ {
try try
{ {
var decisions = _nzbSearchService.EpisodeSearch(episodeId, true, true); var decisions = _releaseSearchService.EpisodeSearch(episodeId, true, true);
var prioritizedDecisions = _prioritizeDownloadDecision.PrioritizeDecisions(decisions); var prioritizedDecisions = _prioritizeDownloadDecision.PrioritizeDecisions(decisions);
return MapDecisions(prioritizedDecisions); return MapDecisions(prioritizedDecisions);
@ -176,7 +176,7 @@ namespace Sonarr.Api.V3.Indexers
{ {
try try
{ {
var decisions = _nzbSearchService.SeasonSearch(seriesId, seasonNumber, false, false, true, true); var decisions = _releaseSearchService.SeasonSearch(seriesId, seasonNumber, false, false, true, true);
var prioritizedDecisions = _prioritizeDownloadDecision.PrioritizeDecisions(decisions); var prioritizedDecisions = _prioritizeDownloadDecision.PrioritizeDecisions(decisions);
return MapDecisions(prioritizedDecisions); return MapDecisions(prioritizedDecisions);