Photo.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using System.Text.Json.Serialization;
  2. using MediaBrowser.Model.Drawing;
  3. namespace MediaBrowser.Controller.Entities
  4. {
  5. public class Photo : BaseItem
  6. {
  7. [JsonIgnore]
  8. public override bool SupportsLocalMetadata => false;
  9. [JsonIgnore]
  10. public override string MediaType => Model.Entities.MediaType.Photo;
  11. [JsonIgnore]
  12. public override Folder LatestItemsIndexContainer => AlbumEntity;
  13. [JsonIgnore]
  14. public PhotoAlbum AlbumEntity
  15. {
  16. get
  17. {
  18. var parents = GetParents();
  19. foreach (var parent in parents)
  20. {
  21. var photoAlbum = parent as PhotoAlbum;
  22. if (photoAlbum != null)
  23. {
  24. return photoAlbum;
  25. }
  26. }
  27. return null;
  28. }
  29. }
  30. public override bool CanDownload()
  31. {
  32. return true;
  33. }
  34. public override double GetDefaultPrimaryImageAspectRatio()
  35. {
  36. // REVIEW: @bond
  37. if (Width.HasValue && Height.HasValue)
  38. {
  39. double width = Width.Value;
  40. double height = Height.Value;
  41. if (Orientation.HasValue)
  42. {
  43. switch (Orientation.Value)
  44. {
  45. case ImageOrientation.LeftBottom:
  46. case ImageOrientation.LeftTop:
  47. case ImageOrientation.RightBottom:
  48. case ImageOrientation.RightTop:
  49. var temp = height;
  50. height = width;
  51. width = temp;
  52. break;
  53. }
  54. }
  55. return width / height;
  56. }
  57. return base.GetDefaultPrimaryImageAspectRatio();
  58. }
  59. public new int? Width { get; set; }
  60. public new int? Height { get; set; }
  61. public string CameraMake { get; set; }
  62. public string CameraModel { get; set; }
  63. public string Software { get; set; }
  64. public double? ExposureTime { get; set; }
  65. public double? FocalLength { get; set; }
  66. public ImageOrientation? Orientation { get; set; }
  67. public double? Aperture { get; set; }
  68. public double? ShutterSpeed { get; set; }
  69. public double? Latitude { get; set; }
  70. public double? Longitude { get; set; }
  71. public double? Altitude { get; set; }
  72. public int? IsoSpeedRating { get; set; }
  73. }
  74. }