parent
3fdc7c8346
commit
89270ad7a1
|
@ -74,7 +74,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
.Build();
|
||||
|
||||
Mocker.GetMock<ICustomFormatCalculationService>()
|
||||
.Setup(x => x.ParseCustomFormat(It.IsAny<ParsedEpisodeInfo>()))
|
||||
.Setup(x => x.ParseCustomFormat(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<Series>()))
|
||||
.Returns(new List<CustomFormat>());
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
private void GivenQueueFormats(List<CustomFormat> formats)
|
||||
{
|
||||
Mocker.GetMock<ICustomFormatCalculationService>()
|
||||
.Setup(x => x.ParseCustomFormat(It.IsAny<ParsedEpisodeInfo>()))
|
||||
.Setup(x => x.ParseCustomFormat(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<Series>()))
|
||||
.Returns(formats);
|
||||
}
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||
.Returns(new List<CustomFormat>());
|
||||
|
||||
Mocker.GetMock<ICustomFormatCalculationService>()
|
||||
.Setup(s => s.ParseCustomFormat(It.IsAny<ParsedEpisodeInfo>()))
|
||||
.Setup(s => s.ParseCustomFormat(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<Series>()))
|
||||
.Returns(new List<CustomFormat>());
|
||||
|
||||
_localEpisode.Quality = new QualityModel(Quality.Bluray2160p);
|
||||
|
@ -306,7 +306,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||
.Returns(new List<CustomFormat>());
|
||||
|
||||
Mocker.GetMock<ICustomFormatCalculationService>()
|
||||
.Setup(s => s.ParseCustomFormat(It.IsAny<ParsedEpisodeInfo>()))
|
||||
.Setup(s => s.ParseCustomFormat(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<Series>()))
|
||||
.Returns(new List<CustomFormat>());
|
||||
|
||||
_localEpisode.Quality = new QualityModel(Quality.Bluray1080p);
|
||||
|
@ -384,7 +384,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||
.Returns(new List<CustomFormat>());
|
||||
|
||||
Mocker.GetMock<ICustomFormatCalculationService>()
|
||||
.Setup(s => s.ParseCustomFormat(It.IsAny<ParsedEpisodeInfo>()))
|
||||
.Setup(s => s.ParseCustomFormat(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<Series>()))
|
||||
.Returns(new List<CustomFormat>());
|
||||
|
||||
_localEpisode.Quality = new QualityModel(Quality.Bluray1080p);
|
||||
|
@ -417,7 +417,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||
.Returns(new List<CustomFormat>());
|
||||
|
||||
Mocker.GetMock<ICustomFormatCalculationService>()
|
||||
.Setup(s => s.ParseCustomFormat(It.IsAny<ParsedEpisodeInfo>()))
|
||||
.Setup(s => s.ParseCustomFormat(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<Series>()))
|
||||
.Returns(new List<CustomFormat>());
|
||||
|
||||
_localEpisode.Quality = new QualityModel(Quality.Bluray1080p);
|
||||
|
|
|
@ -14,8 +14,8 @@ namespace NzbDrone.Core.CustomFormats
|
|||
{
|
||||
public interface ICustomFormatCalculationService
|
||||
{
|
||||
List<CustomFormat> ParseCustomFormat(ParsedEpisodeInfo movieInfo);
|
||||
List<CustomFormat> ParseCustomFormat(EpisodeFile movieFile);
|
||||
List<CustomFormat> ParseCustomFormat(ParsedEpisodeInfo episodeInfo, Series series);
|
||||
List<CustomFormat> ParseCustomFormat(EpisodeFile episodeFile);
|
||||
List<CustomFormat> ParseCustomFormat(Blocklist blocklist);
|
||||
List<CustomFormat> ParseCustomFormat(EpisodeHistory history);
|
||||
}
|
||||
|
@ -92,24 +92,25 @@ namespace NzbDrone.Core.CustomFormats
|
|||
return ParseCustomFormat(info, allCustomFormats);
|
||||
}
|
||||
|
||||
public List<CustomFormat> ParseCustomFormat(ParsedEpisodeInfo movieInfo)
|
||||
public List<CustomFormat> ParseCustomFormat(ParsedEpisodeInfo episodeInfo, Series series)
|
||||
{
|
||||
return ParseCustomFormat(movieInfo, _formatService.All());
|
||||
episodeInfo.ExtraInfo["OriginalLanguage"] = series.OriginalLanguage;
|
||||
return ParseCustomFormat(episodeInfo, _formatService.All());
|
||||
}
|
||||
|
||||
public List<CustomFormat> ParseCustomFormat(EpisodeFile wpisodeFile)
|
||||
public List<CustomFormat> ParseCustomFormat(EpisodeFile episodeFile)
|
||||
{
|
||||
return ParseCustomFormat(wpisodeFile, _formatService.All());
|
||||
return ParseCustomFormat(episodeFile, _formatService.All());
|
||||
}
|
||||
|
||||
public List<CustomFormat> ParseCustomFormat(Blocklist blocklist)
|
||||
{
|
||||
var movie = _seriesService.GetSeries(blocklist.SeriesId);
|
||||
var series = _seriesService.GetSeries(blocklist.SeriesId);
|
||||
var parsed = Parser.Parser.ParseTitle(blocklist.SourceTitle);
|
||||
|
||||
var info = new ParsedEpisodeInfo
|
||||
{
|
||||
SeriesTitle = movie.Title,
|
||||
SeriesTitle = series.Title,
|
||||
ReleaseTitle = parsed?.ReleaseTitle ?? blocklist.SourceTitle,
|
||||
Quality = blocklist.Quality,
|
||||
Languages = blocklist.Languages,
|
||||
|
@ -120,19 +121,19 @@ namespace NzbDrone.Core.CustomFormats
|
|||
}
|
||||
};
|
||||
|
||||
return ParseCustomFormat(info);
|
||||
return ParseCustomFormat(info, series);
|
||||
}
|
||||
|
||||
public List<CustomFormat> ParseCustomFormat(EpisodeHistory history)
|
||||
{
|
||||
var movie = _seriesService.GetSeries(history.SeriesId);
|
||||
var series = _seriesService.GetSeries(history.SeriesId);
|
||||
var parsed = Parser.Parser.ParseTitle(history.SourceTitle);
|
||||
|
||||
long.TryParse(history.Data.GetValueOrDefault("size"), out var size);
|
||||
|
||||
var info = new ParsedEpisodeInfo
|
||||
{
|
||||
SeriesTitle = movie.Title,
|
||||
SeriesTitle = series.Title,
|
||||
ReleaseTitle = parsed?.ReleaseTitle ?? history.SourceTitle,
|
||||
Quality = history.Quality,
|
||||
Languages = history.Languages,
|
||||
|
@ -143,7 +144,7 @@ namespace NzbDrone.Core.CustomFormats
|
|||
}
|
||||
};
|
||||
|
||||
return ParseCustomFormat(info);
|
||||
return ParseCustomFormat(info, series);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace NzbDrone.Core.DecisionEngine
|
|||
var remoteEpisode = _parsingService.Map(parsedEpisodeInfo, report.TvdbId, report.TvRageId, searchCriteria);
|
||||
remoteEpisode.Release = report;
|
||||
|
||||
remoteEpisode.CustomFormats = _formatCalculator.ParseCustomFormat(parsedEpisodeInfo);
|
||||
remoteEpisode.CustomFormats = _formatCalculator.ParseCustomFormat(parsedEpisodeInfo, remoteEpisode.Series);
|
||||
remoteEpisode.CustomFormatScore = remoteEpisode?.Series?.QualityProfile?.Value.CalculateCustomFormatScore(remoteEpisode.CustomFormats) ?? 0;
|
||||
|
||||
if (remoteEpisode.Series == null)
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
|||
continue;
|
||||
}
|
||||
|
||||
var queuedItemCustomFormats = _formatService.ParseCustomFormat(remoteEpisode.ParsedEpisodeInfo);
|
||||
var queuedItemCustomFormats = _formatService.ParseCustomFormat(remoteEpisode.ParsedEpisodeInfo, subject.Series);
|
||||
|
||||
_logger.Debug("Checking if existing release in queue meets cutoff. Queued: {0}", remoteEpisode.ParsedEpisodeInfo.Quality);
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
|
|||
// Calculate custom formats
|
||||
if (trackedDownload.RemoteEpisode != null)
|
||||
{
|
||||
trackedDownload.RemoteEpisode.CustomFormats = _formatCalculator.ParseCustomFormat(parsedEpisodeInfo);
|
||||
trackedDownload.RemoteEpisode.CustomFormats = _formatCalculator.ParseCustomFormat(parsedEpisodeInfo, trackedDownload.RemoteEpisode.Series);
|
||||
}
|
||||
|
||||
// Track it so it can be displayed in the queue even though we can't determine which series it is for
|
||||
|
|
Loading…
Reference in New Issue