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.

This commit is contained in:
Mark McDowall 2012-01-27 08:17:12 -08:00
parent 207ea607a7
commit 2bf97fd76f
3 changed files with 5 additions and 4 deletions

View File

@ -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";

View File

@ -224,7 +224,7 @@
<Compile Include="Datastore\Migrations\NzbDroneMigration.cs" />
<Compile Include="Fluent.cs" />
<Compile Include="Helpers\EpisodeSortingHelper.cs" />
<Compile Include="Helpers\FileSizeFormatHelpercs.cs" />
<Compile Include="Helpers\FileSizeFormatHelper.cs" />
<Compile Include="Helpers\SortHelper.cs" />
<Compile Include="Jobs\CheckpointJob.cs" />
<Compile Include="Providers\AnalyticsProvider.cs" />

View File

@ -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;
}