Photo.cs 2.5 KB

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