1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

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

View File

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

View File

@ -18,21 +18,21 @@ public class EpisodeSearchService : IExecute<EpisodeSearchCommand>,
IExecute<MissingEpisodeSearchCommand>,
IExecute<CutoffUnmetEpisodeSearchCommand>
{
private readonly ISearchForNzb _nzbSearchService;
private readonly ISearchForReleases _releaseSearchService;
private readonly IProcessDownloadDecisions _processDownloadDecisions;
private readonly IEpisodeService _episodeService;
private readonly IEpisodeCutoffService _episodeCutoffService;
private readonly IQueueService _queueService;
private readonly Logger _logger;
public EpisodeSearchService(ISearchForNzb nzbSearchService,
public EpisodeSearchService(ISearchForReleases releaseSearchService,
IProcessDownloadDecisions processDownloadDecisions,
IEpisodeService episodeService,
IEpisodeCutoffService episodeCutoffService,
IQueueService queueService,
Logger logger)
{
_nzbSearchService = nzbSearchService;
_releaseSearchService = releaseSearchService;
_processDownloadDecisions = processDownloadDecisions;
_episodeService = episodeService;
_episodeCutoffService = episodeCutoffService;
@ -55,7 +55,7 @@ private void SearchForEpisodes(List<Episode> episodes, bool monitoredOnly, bool
{
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)
{
@ -68,7 +68,7 @@ private void SearchForEpisodes(List<Episode> episodes, bool monitoredOnly, bool
{
try
{
decisions = _nzbSearchService.EpisodeSearch(season.First(), userInvokedSearch, false);
decisions = _releaseSearchService.EpisodeSearch(season.First(), userInvokedSearch, false);
}
catch (Exception ex)
{
@ -95,7 +95,7 @@ public void Execute(EpisodeSearchCommand message)
{
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);
_logger.ProgressInfo("Episode search completed. {0} reports downloaded.", processed.Grabbed.Count);

View File

@ -18,7 +18,7 @@
namespace NzbDrone.Core.IndexerSearch
{
public interface ISearchForNzb
public interface ISearchForReleases
{
List<DownloadDecision> EpisodeSearch(int episodeId, bool userInvokedSearch, bool interactiveSearch);
List<DownloadDecision> EpisodeSearch(Episode episode, bool userInvokedSearch, bool interactiveSearch);
@ -26,7 +26,7 @@ public interface ISearchForNzb
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 ISceneMappingService _sceneMapping;
@ -35,7 +35,7 @@ public class NzbSearchService : ISearchForNzb
private readonly IMakeDownloadDecision _makeDownloadDecision;
private readonly Logger _logger;
public NzbSearchService(IIndexerFactory indexerFactory,
public ReleaseSearchService(IIndexerFactory indexerFactory,
ISceneMappingService sceneMapping,
ISeriesService seriesService,
IEpisodeService episodeService,
@ -373,7 +373,7 @@ private List<DownloadDecision> SearchSpecial(Series series, List<Episode> episod
var searchSpec = Get<SpecialEpisodeSearchCriteria>(series, episodes, monitoredOnly, userInvokedSearch, interactiveSearch);
// build list of queries for each episode in the form: "<series> <episode-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();
downloadDecisions.AddRange(Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec));

View File

@ -7,22 +7,22 @@ namespace NzbDrone.Core.IndexerSearch
{
public class SeasonSearchService : IExecute<SeasonSearchCommand>
{
private readonly ISearchForNzb _nzbSearchService;
private readonly ISearchForReleases _releaseSearchService;
private readonly IProcessDownloadDecisions _processDownloadDecisions;
private readonly Logger _logger;
public SeasonSearchService(ISearchForNzb nzbSearchService,
public SeasonSearchService(ISearchForReleases releaseSearchService,
IProcessDownloadDecisions processDownloadDecisions,
Logger logger)
{
_nzbSearchService = nzbSearchService;
_releaseSearchService = releaseSearchService;
_processDownloadDecisions = processDownloadDecisions;
_logger = logger;
}
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);
_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>
{
private readonly ISeriesService _seriesService;
private readonly ISearchForNzb _nzbSearchService;
private readonly ISearchForReleases _releaseSearchService;
private readonly IProcessDownloadDecisions _processDownloadDecisions;
private readonly Logger _logger;
public SeriesSearchService(ISeriesService seriesService,
ISearchForNzb nzbSearchService,
ISearchForReleases releaseSearchService,
IProcessDownloadDecisions processDownloadDecisions,
Logger logger)
{
_seriesService = seriesService;
_nzbSearchService = nzbSearchService;
_releaseSearchService = releaseSearchService;
_processDownloadDecisions = processDownloadDecisions;
_logger = logger;
}
@ -39,7 +39,7 @@ public void Execute(SeriesSearchCommand message)
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;
}

View File

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