2019-10-15 15:49:49 +00:00
|
|
|
using System.Text.Json.Serialization;
|
2019-01-13 20:01:16 +00:00
|
|
|
using MediaBrowser.Model.Drawing;
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Entities
|
|
|
|
{
|
|
|
|
public class Photo : BaseItem
|
|
|
|
{
|
2019-10-15 15:49:49 +00:00
|
|
|
[JsonIgnore]
|
2019-01-13 20:31:14 +00:00
|
|
|
public override bool SupportsLocalMetadata => false;
|
2018-12-27 23:27:57 +00:00
|
|
|
|
2019-10-15 15:49:49 +00:00
|
|
|
[JsonIgnore]
|
2019-01-13 20:31:14 +00:00
|
|
|
public override string MediaType => Model.Entities.MediaType.Photo;
|
2018-12-27 23:27:57 +00:00
|
|
|
|
2019-10-15 15:49:49 +00:00
|
|
|
[JsonIgnore]
|
2019-01-13 20:31:14 +00:00
|
|
|
public override Folder LatestItemsIndexContainer => AlbumEntity;
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
|
2019-10-15 15:49:49 +00:00
|
|
|
[JsonIgnore]
|
2018-12-27 23:27:57 +00:00
|
|
|
public PhotoAlbum AlbumEntity
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
var parents = GetParents();
|
|
|
|
foreach (var parent in parents)
|
|
|
|
{
|
|
|
|
var photoAlbum = parent as PhotoAlbum;
|
|
|
|
if (photoAlbum != null)
|
|
|
|
{
|
|
|
|
return photoAlbum;
|
|
|
|
}
|
|
|
|
}
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public override bool CanDownload()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override double GetDefaultPrimaryImageAspectRatio()
|
|
|
|
{
|
2018-12-27 21:43:48 +00:00
|
|
|
// REVIEW: @bond
|
2020-02-20 14:30:04 +00:00
|
|
|
if (Width != 0 && Height != 0)
|
2018-12-27 23:27:57 +00:00
|
|
|
{
|
2020-02-20 14:30:04 +00:00
|
|
|
double width = Width;
|
|
|
|
double height = Height;
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
if (Orientation.HasValue)
|
|
|
|
{
|
|
|
|
switch (Orientation.Value)
|
|
|
|
{
|
|
|
|
case ImageOrientation.LeftBottom:
|
|
|
|
case ImageOrientation.LeftTop:
|
|
|
|
case ImageOrientation.RightBottom:
|
|
|
|
case ImageOrientation.RightTop:
|
|
|
|
var temp = height;
|
|
|
|
height = width;
|
|
|
|
width = temp;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-08 22:48:08 +00:00
|
|
|
return width / height;
|
2018-12-27 23:27:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return base.GetDefaultPrimaryImageAspectRatio();
|
|
|
|
}
|
|
|
|
|
|
|
|
public string CameraMake { get; set; }
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public string CameraModel { get; set; }
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public string Software { get; set; }
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public double? ExposureTime { get; set; }
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public double? FocalLength { get; set; }
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public ImageOrientation? Orientation { get; set; }
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public double? Aperture { get; set; }
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public double? ShutterSpeed { get; set; }
|
|
|
|
|
|
|
|
public double? Latitude { get; set; }
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public double? Longitude { get; set; }
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public double? Altitude { get; set; }
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public int? IsoSpeedRating { get; set; }
|
|
|
|
}
|
|
|
|
}
|