ImageProcessingOptions.cs 2.0 KB

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