2
0

Photo.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #pragma warning disable CS1591
  2. using System.Text.Json.Serialization;
  3. using MediaBrowser.Model.Drawing;
  4. namespace MediaBrowser.Controller.Entities
  5. {
  6. public class Photo : BaseItem
  7. {
  8. [JsonIgnore]
  9. public override bool SupportsLocalMetadata => false;
  10. [JsonIgnore]
  11. public override string MediaType => Model.Entities.MediaType.Photo;
  12. [JsonIgnore]
  13. public override Folder LatestItemsIndexContainer => AlbumEntity;
  14. [JsonIgnore]
  15. public PhotoAlbum AlbumEntity
  16. {
  17. get
  18. {
  19. var parents = GetParents();
  20. foreach (var parent in parents)
  21. {
  22. var photoAlbum = parent as PhotoAlbum;
  23. if (photoAlbum != null)
  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. }