Photo.cs 2.9 KB

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