ImageProcessingOptions.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using MediaBrowser.Controller.Entities;
  2. using MediaBrowser.Controller.Providers;
  3. using MediaBrowser.Model.Drawing;
  4. using System.Collections.Generic;
  5. namespace MediaBrowser.Controller.Drawing
  6. {
  7. public class ImageProcessingOptions
  8. {
  9. public IHasImages Item { get; set; }
  10. public ItemImageInfo Image { get; set; }
  11. public int ImageIndex { get; set; }
  12. public bool CropWhiteSpace { get; set; }
  13. public int? Width { get; set; }
  14. public int? Height { get; set; }
  15. public int? MaxWidth { get; set; }
  16. public int? MaxHeight { get; set; }
  17. public int? Quality { get; set; }
  18. public List<IImageEnhancer> Enhancers { get; set; }
  19. public ImageOutputFormat OutputFormat { get; set; }
  20. public bool AddPlayedIndicator { get; set; }
  21. public int? UnplayedCount { get; set; }
  22. public double? PercentPlayed { get; set; }
  23. public string BackgroundColor { get; set; }
  24. public bool HasDefaultOptions()
  25. {
  26. return HasDefaultOptionsWithoutSize() &&
  27. !Width.HasValue &&
  28. !Height.HasValue &&
  29. !MaxWidth.HasValue &&
  30. !MaxHeight.HasValue;
  31. }
  32. public bool HasDefaultOptionsWithoutSize()
  33. {
  34. return (!Quality.HasValue || Quality.Value == 100) &&
  35. IsOutputFormatDefault &&
  36. !AddPlayedIndicator &&
  37. !PercentPlayed.HasValue &&
  38. !UnplayedCount.HasValue &&
  39. string.IsNullOrEmpty(BackgroundColor);
  40. }
  41. private bool IsOutputFormatDefault
  42. {
  43. get
  44. {
  45. if (OutputFormat == ImageOutputFormat.Original)
  46. {
  47. return true;
  48. }
  49. return false;
  50. }
  51. }
  52. }
  53. }