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