mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-26 22:56:23 -04:00
New: Searching for episodes with season level scene mapping now possible instead of only via RssSync (Newznab/Torznab only)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using NLog;
|
||||
using NzbDrone.Core.DataAugmentation.Scene;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
@@ -7,10 +8,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
|
||||
public class SeasonMatchSpecification : IDecisionEngineSpecification
|
||||
{
|
||||
private readonly Logger _logger;
|
||||
private readonly ISceneMappingService _sceneMappingService;
|
||||
|
||||
public SeasonMatchSpecification(Logger logger)
|
||||
public SeasonMatchSpecification(ISceneMappingService sceneMappingService, Logger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_sceneMappingService = sceneMappingService;
|
||||
}
|
||||
|
||||
public SpecificationPriority Priority => SpecificationPriority.Default;
|
||||
@@ -26,7 +29,11 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
|
||||
var singleEpisodeSpec = searchCriteria as SeasonSearchCriteria;
|
||||
if (singleEpisodeSpec == null) return Decision.Accept();
|
||||
|
||||
if (singleEpisodeSpec.SeasonNumber != remoteEpisode.ParsedEpisodeInfo.SeasonNumber)
|
||||
var seasonNumber = _sceneMappingService.GetTvdbSeasonNumber(remoteEpisode.ParsedEpisodeInfo.SeriesTitle,
|
||||
remoteEpisode.ParsedEpisodeInfo.ReleaseTitle,
|
||||
remoteEpisode.ParsedEpisodeInfo.SeasonNumber);
|
||||
|
||||
if (singleEpisodeSpec.SeasonNumber != seasonNumber)
|
||||
{
|
||||
_logger.Debug("Season number does not match searched season number, skipping.");
|
||||
return Decision.Reject("Wrong season");
|
||||
|
||||
Reference in New Issue
Block a user