1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-22 07:43:01 +00:00

Clarified min/max size rejection message by including the episode runtime.

This commit is contained in:
Taloth Saldono 2016-09-22 22:38:38 +02:00
parent b034d0c1b3
commit dc82e66dde

View file

@ -53,8 +53,10 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
//If the parsed size is smaller than minSize we don't want it //If the parsed size is smaller than minSize we don't want it
if (subject.Release.Size < minSize) if (subject.Release.Size < minSize)
{ {
_logger.Debug("Item: {0}, Size: {1:0n} is smaller than minimum allowed size ({2:0}), rejecting.", subject, subject.Release.Size, minSize); var runtimeMessage = subject.Episodes.Count == 1 ? $"{subject.Series.Runtime}min" : $"{subject.Episodes.Count}x {subject.Series.Runtime}min";
return Decision.Reject("{0} is smaller than minimum allowed: {1}", subject.Release.Size.SizeSuffix(), minSize.SizeSuffix());
_logger.Debug("Item: {0}, Size: {1} is smaller than minimum allowed size ({2} bytes for {3}), rejecting.", subject, subject.Release.Size, minSize, runtimeMessage);
return Decision.Reject("{0} is smaller than minimum allowed {1} (for {2})", subject.Release.Size.SizeSuffix(), minSize.SizeSuffix(), runtimeMessage);
} }
} }
if (!qualityDefinition.MaxSize.HasValue || qualityDefinition.MaxSize.Value == 0) if (!qualityDefinition.MaxSize.HasValue || qualityDefinition.MaxSize.Value == 0)
@ -95,8 +97,10 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
//If the parsed size is greater than maxSize we don't want it //If the parsed size is greater than maxSize we don't want it
if (subject.Release.Size > maxSize) if (subject.Release.Size > maxSize)
{ {
_logger.Debug("Item: {0}, Size: {1} is greater than maximum allowed size ({2}), rejecting.", subject, subject.Release.Size, maxSize); var runtimeMessage = subject.Episodes.Count == 1 ? $"{subject.Series.Runtime}min" : $"{subject.Episodes.Count}x {subject.Series.Runtime}min";
return Decision.Reject("{0} is larger than maximum allowed: {1}", subject.Release.Size.SizeSuffix(), maxSize.SizeSuffix());
_logger.Debug("Item: {0}, Size: {1} is greater than maximum allowed size ({2} for {3}), rejecting.", subject, subject.Release.Size, maxSize, runtimeMessage);
return Decision.Reject("{0} is larger than maximum allowed {1} (for {2})", subject.Release.Size.SizeSuffix(), maxSize.SizeSuffix(), runtimeMessage);
} }
} }