ImageProcessingOptions.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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? 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 (!Quality.HasValue || Quality.Value == 100) &&
  38. IsOutputFormatDefault &&
  39. !AddPlayedIndicator &&
  40. !PercentPlayed.HasValue &&
  41. string.IsNullOrEmpty(BackgroundColor);
  42. }
  43. private bool IsOutputFormatDefault
  44. {
  45. get
  46. {
  47. if (OutputFormat == ImageOutputFormat.Original)
  48. {
  49. return true;
  50. }
  51. return false;
  52. }
  53. }
  54. }
  55. }