add error handling to dlna channel support

This commit is contained in:
Luke Pulverenti
2014-07-31 20:37:06 -04:00
parent a37a11c486
commit 3fa2a001c7
46 changed files with 1689 additions and 439 deletions

View File

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