From 2bf97fd76f3038d89b0decbd33df27150ab242b0 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 27 Jan 2012 08:17:12 -0800 Subject: [PATCH] Fix: Size will be displayed in best format when rejected (instead of bytes). It will also be displayed as info so it shows in the normal log. --- .../{FileSizeFormatHelpercs.cs => FileSizeFormatHelper.cs} | 4 ++-- NzbDrone.Core/NzbDrone.Core.csproj | 2 +- NzbDrone.Core/Providers/InventoryProvider.cs | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) rename NzbDrone.Core/Helpers/{FileSizeFormatHelpercs.cs => FileSizeFormatHelper.cs} (89%) diff --git a/NzbDrone.Core/Helpers/FileSizeFormatHelpercs.cs b/NzbDrone.Core/Helpers/FileSizeFormatHelper.cs similarity index 89% rename from NzbDrone.Core/Helpers/FileSizeFormatHelpercs.cs rename to NzbDrone.Core/Helpers/FileSizeFormatHelper.cs index 138c3227f..515543fc8 100644 --- a/NzbDrone.Core/Helpers/FileSizeFormatHelpercs.cs +++ b/NzbDrone.Core/Helpers/FileSizeFormatHelper.cs @@ -2,13 +2,13 @@ namespace NzbDrone.Core.Helpers { - public class FileSizeFormatHelper + public static class FileSizeFormatHelper { private const Decimal OneKiloByte = 1024M; private const Decimal OneMegaByte = OneKiloByte * 1024M; private const Decimal OneGigaByte = OneMegaByte * 1024M; - public static string Format(long bytes, int precision) + public static string Format(long bytes, int precision = 0) { if (bytes == 0) return "0B"; diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index bfedcc96e..4a66dff38 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -224,7 +224,7 @@ - + diff --git a/NzbDrone.Core/Providers/InventoryProvider.cs b/NzbDrone.Core/Providers/InventoryProvider.cs index 42a212811..e374e5e77 100644 --- a/NzbDrone.Core/Providers/InventoryProvider.cs +++ b/NzbDrone.Core/Providers/InventoryProvider.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using Ninject; using NLog; +using NzbDrone.Core.Helpers; using NzbDrone.Core.Model; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; @@ -88,7 +89,7 @@ namespace NzbDrone.Core.Providers if (!IsAcceptableSize(parsedReport)) { - Logger.Trace("Size: {0} is not acceptable for Quality: {1}", parsedReport.Size, parsedReport.Quality); + Logger.Info("Size: {0} is not acceptable for Quality: {1}", FileSizeFormatHelper.Format(parsedReport.Size, 2), parsedReport.Quality); return false; }