From 3fa2a001c7275737e4ff4011c23ca9dc359d721d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 31 Jul 2014 20:37:06 -0400 Subject: add error handling to dlna channel support --- .../Drawing/ImageProcessingOptions.cs | 30 ++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs') diff --git a/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs b/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs index 912ad012d..f4a76be00 100644 --- a/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs +++ b/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs @@ -2,6 +2,7 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Drawing; using System.Collections.Generic; +using System.IO; namespace MediaBrowser.Controller.Drawing { @@ -34,39 +35,36 @@ namespace MediaBrowser.Controller.Drawing public int? UnplayedCount { get; set; } public double? PercentPlayed { get; set; } - + public string BackgroundColor { get; set; } - public bool HasDefaultOptions() + public bool HasDefaultOptions(string originalImagePath) { - return HasDefaultOptionsWithoutSize() && - !Width.HasValue && - !Height.HasValue && - !MaxWidth.HasValue && + return HasDefaultOptionsWithoutSize(originalImagePath) && + !Width.HasValue && + !Height.HasValue && + !MaxWidth.HasValue && !MaxHeight.HasValue; } - public bool HasDefaultOptionsWithoutSize() + public bool HasDefaultOptionsWithoutSize(string originalImagePath) { return (!Quality.HasValue || Quality.Value == 100) && - IsOutputFormatDefault && + IsOutputFormatDefault(originalImagePath) && !AddPlayedIndicator && !PercentPlayed.HasValue && !UnplayedCount.HasValue && string.IsNullOrEmpty(BackgroundColor); } - private bool IsOutputFormatDefault + private bool IsOutputFormatDefault(string originalImagePath) { - get + if (OutputFormat == ImageOutputFormat.Original) { - if (OutputFormat == ImageOutputFormat.Original) - { - return true; - } - - return false; + return true; } + + return string.Equals(Path.GetExtension(originalImagePath), "." + OutputFormat); } } } -- cgit v1.2.3