Fixed: Unable to process downloads from client

Closes #5284
This commit is contained in:
Mark McDowall 2022-12-09 09:19:11 -08:00
parent 05775a9bd0
commit e50eb5188e
7 changed files with 13 additions and 14 deletions

View File

@ -74,7 +74,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.Build(); .Build();
Mocker.GetMock<ICustomFormatCalculationService>() Mocker.GetMock<ICustomFormatCalculationService>()
.Setup(x => x.ParseCustomFormat(It.IsAny<RemoteEpisode>())) .Setup(x => x.ParseCustomFormat(It.IsAny<RemoteEpisode>(), It.IsAny<long>()))
.Returns(new List<CustomFormat>()); .Returns(new List<CustomFormat>());
} }
@ -88,7 +88,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
private void GivenQueueFormats(List<CustomFormat> formats) private void GivenQueueFormats(List<CustomFormat> formats)
{ {
Mocker.GetMock<ICustomFormatCalculationService>() Mocker.GetMock<ICustomFormatCalculationService>()
.Setup(x => x.ParseCustomFormat(It.IsAny<RemoteEpisode>())) .Setup(x => x.ParseCustomFormat(It.IsAny<RemoteEpisode>(), It.IsAny<long>()))
.Returns(formats); .Returns(formats);
} }

View File

@ -269,7 +269,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
.Returns(new List<CustomFormat>()); .Returns(new List<CustomFormat>());
Mocker.GetMock<ICustomFormatCalculationService>() Mocker.GetMock<ICustomFormatCalculationService>()
.Setup(s => s.ParseCustomFormat(It.IsAny<RemoteEpisode>())) .Setup(s => s.ParseCustomFormat(It.IsAny<RemoteEpisode>(), It.IsAny<long>()))
.Returns(new List<CustomFormat>()); .Returns(new List<CustomFormat>());
_localEpisode.Quality = new QualityModel(Quality.Bluray2160p); _localEpisode.Quality = new QualityModel(Quality.Bluray2160p);
@ -303,7 +303,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
.Returns(new List<CustomFormat>()); .Returns(new List<CustomFormat>());
Mocker.GetMock<ICustomFormatCalculationService>() Mocker.GetMock<ICustomFormatCalculationService>()
.Setup(s => s.ParseCustomFormat(It.IsAny<RemoteEpisode>())) .Setup(s => s.ParseCustomFormat(It.IsAny<RemoteEpisode>(), It.IsAny<long>()))
.Returns(new List<CustomFormat>()); .Returns(new List<CustomFormat>());
_localEpisode.Quality = new QualityModel(Quality.Bluray1080p); _localEpisode.Quality = new QualityModel(Quality.Bluray1080p);
@ -381,7 +381,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
.Returns(new List<CustomFormat>()); .Returns(new List<CustomFormat>());
Mocker.GetMock<ICustomFormatCalculationService>() Mocker.GetMock<ICustomFormatCalculationService>()
.Setup(s => s.ParseCustomFormat(It.IsAny<RemoteEpisode>())) .Setup(s => s.ParseCustomFormat(It.IsAny<RemoteEpisode>(), It.IsAny<long>()))
.Returns(new List<CustomFormat>()); .Returns(new List<CustomFormat>());
_localEpisode.Quality = new QualityModel(Quality.Bluray1080p); _localEpisode.Quality = new QualityModel(Quality.Bluray1080p);
@ -414,7 +414,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
.Returns(new List<CustomFormat>()); .Returns(new List<CustomFormat>());
Mocker.GetMock<ICustomFormatCalculationService>() Mocker.GetMock<ICustomFormatCalculationService>()
.Setup(s => s.ParseCustomFormat(It.IsAny<RemoteEpisode>())) .Setup(s => s.ParseCustomFormat(It.IsAny<RemoteEpisode>(), It.IsAny<long>()))
.Returns(new List<CustomFormat>()); .Returns(new List<CustomFormat>());
_localEpisode.Quality = new QualityModel(Quality.Bluray1080p); _localEpisode.Quality = new QualityModel(Quality.Bluray1080p);

View File

@ -3,7 +3,6 @@ using System.IO;
using System.Linq; using System.Linq;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.Datastore.Migration;
using NzbDrone.Core.History; using NzbDrone.Core.History;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
@ -13,7 +12,7 @@ namespace NzbDrone.Core.CustomFormats
{ {
public interface ICustomFormatCalculationService public interface ICustomFormatCalculationService
{ {
List<CustomFormat> ParseCustomFormat(RemoteEpisode remoteEpisode); List<CustomFormat> ParseCustomFormat(RemoteEpisode remoteEpisode, long size);
List<CustomFormat> ParseCustomFormat(EpisodeFile episodeFile, Series series); List<CustomFormat> ParseCustomFormat(EpisodeFile episodeFile, Series series);
List<CustomFormat> ParseCustomFormat(EpisodeFile episodeFile); List<CustomFormat> ParseCustomFormat(EpisodeFile episodeFile);
List<CustomFormat> ParseCustomFormat(Blocklist blocklist, Series series); List<CustomFormat> ParseCustomFormat(Blocklist blocklist, Series series);
@ -30,13 +29,13 @@ namespace NzbDrone.Core.CustomFormats
_formatService = formatService; _formatService = formatService;
} }
public List<CustomFormat> ParseCustomFormat(RemoteEpisode remoteEpisode) public List<CustomFormat> ParseCustomFormat(RemoteEpisode remoteEpisode, long size)
{ {
var input = new CustomFormatInput var input = new CustomFormatInput
{ {
EpisodeInfo = remoteEpisode.ParsedEpisodeInfo, EpisodeInfo = remoteEpisode.ParsedEpisodeInfo,
Series = remoteEpisode.Series, Series = remoteEpisode.Series,
Size = remoteEpisode.Release.Size, Size = size,
Languages = remoteEpisode.Languages Languages = remoteEpisode.Languages
}; };

View File

@ -113,7 +113,7 @@ namespace NzbDrone.Core.DecisionEngine
{ {
_aggregationService.Augment(remoteEpisode); _aggregationService.Augment(remoteEpisode);
remoteEpisode.CustomFormats = _formatCalculator.ParseCustomFormat(remoteEpisode); remoteEpisode.CustomFormats = _formatCalculator.ParseCustomFormat(remoteEpisode, remoteEpisode.Release.Size);
remoteEpisode.CustomFormatScore = remoteEpisode?.Series?.QualityProfile?.Value.CalculateCustomFormatScore(remoteEpisode.CustomFormats) ?? 0; remoteEpisode.CustomFormatScore = remoteEpisode?.Series?.QualityProfile?.Value.CalculateCustomFormatScore(remoteEpisode.CustomFormats) ?? 0;
remoteEpisode.DownloadAllowed = remoteEpisode.Episodes.Any(); remoteEpisode.DownloadAllowed = remoteEpisode.Episodes.Any();

View File

@ -52,7 +52,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
continue; continue;
} }
var queuedItemCustomFormats = _formatService.ParseCustomFormat(remoteEpisode); var queuedItemCustomFormats = _formatService.ParseCustomFormat(remoteEpisode, (long)queueItem.Size);
_logger.Debug("Checking if existing release in queue meets cutoff. Queued: {0}", remoteEpisode.ParsedEpisodeInfo.Quality); _logger.Debug("Checking if existing release in queue meets cutoff. Queued: {0}", remoteEpisode.ParsedEpisodeInfo.Quality);

View File

@ -336,7 +336,7 @@ namespace NzbDrone.Core.Download.Pending
} }
_aggregationService.Augment(release.RemoteEpisode); _aggregationService.Augment(release.RemoteEpisode);
release.RemoteEpisode.CustomFormats = _formatCalculator.ParseCustomFormat(release.RemoteEpisode); release.RemoteEpisode.CustomFormats = _formatCalculator.ParseCustomFormat(release.RemoteEpisode, release.Release.Size);
result.Add(release); result.Add(release);
} }

View File

@ -153,7 +153,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
// Calculate custom formats // Calculate custom formats
if (trackedDownload.RemoteEpisode != null) if (trackedDownload.RemoteEpisode != null)
{ {
trackedDownload.RemoteEpisode.CustomFormats = _formatCalculator.ParseCustomFormat(trackedDownload.RemoteEpisode); trackedDownload.RemoteEpisode.CustomFormats = _formatCalculator.ParseCustomFormat(trackedDownload.RemoteEpisode, downloadItem.TotalSize);
} }
// Track it so it can be displayed in the queue even though we can't determine which series it is for // Track it so it can be displayed in the queue even though we can't determine which series it is for