ImageProcessingOptions.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 BaseItem 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? PercentPlayed { get; set; }
  26. public string BackgroundColor { get; set; }
  27. public bool HasDefaultOptions()
  28. {
  29. return HasDefaultOptionsWithoutSize() &&
  30. !Width.HasValue &&
  31. !Height.HasValue &&
  32. !MaxWidth.HasValue &&
  33. !MaxHeight.HasValue;
  34. }
  35. public bool HasDefaultOptionsWithoutSize()
  36. {
  37. return !CropWhiteSpace &&
  38. (!Quality.HasValue || Quality.Value == 100) &&
  39. IsOutputFormatDefault &&
  40. !AddPlayedIndicator &&
  41. !PercentPlayed.HasValue &&
  42. string.IsNullOrEmpty(BackgroundColor);
  43. }
  44. private bool IsOutputFormatDefault
  45. {
  46. get
  47. {
  48. if (OutputFormat == ImageOutputFormat.Original)
  49. {
  50. return true;
  51. }
  52. return false;
  53. }
  54. }
  55. }
  56. }