2021-05-06 15:39:20 -07:00
|
|
|
#nullable disable
|
|
|
|
|
2020-08-22 12:56:24 -07:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-10-15 08:49:49 -07:00
|
|
|
using System.Text.Json.Serialization;
|
2023-05-13 11:44:31 -07:00
|
|
|
using Jellyfin.Data.Enums;
|
2019-01-13 13:01:16 -07:00
|
|
|
using MediaBrowser.Model.Drawing;
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Entities
|
|
|
|
{
|
|
|
|
public class Photo : BaseItem
|
|
|
|
{
|
2019-10-15 08:49:49 -07:00
|
|
|
[JsonIgnore]
|
2019-01-13 13:31:14 -07:00
|
|
|
public override bool SupportsLocalMetadata => false;
|
2018-12-27 16:27:57 -07:00
|
|
|
|
2019-10-15 08:49:49 -07:00
|
|
|
[JsonIgnore]
|
2023-05-13 11:44:31 -07:00
|
|
|
public override MediaType MediaType => MediaType.Photo;
|
2018-12-27 16:27:57 -07:00
|
|
|
|
2019-10-15 08:49:49 -07:00
|
|
|
[JsonIgnore]
|
2019-01-13 13:31:14 -07:00
|
|
|
public override Folder LatestItemsIndexContainer => AlbumEntity;
|
2018-12-27 16:27:57 -07:00
|
|
|
|
2019-10-15 08:49:49 -07:00
|
|
|
[JsonIgnore]
|
2018-12-27 16:27:57 -07:00
|
|
|
public PhotoAlbum AlbumEntity
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
var parents = GetParents();
|
|
|
|
foreach (var parent in parents)
|
|
|
|
{
|
2021-05-05 04:37:36 -07:00
|
|
|
if (parent is PhotoAlbum photoAlbum)
|
2018-12-27 16:27:57 -07:00
|
|
|
{
|
|
|
|
return photoAlbum;
|
|
|
|
}
|
|
|
|
}
|
2020-06-15 14:43:52 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-23 13:07:19 -07:00
|
|
|
public string CameraMake { get; set; }
|
|
|
|
|
|
|
|
public string CameraModel { get; set; }
|
|
|
|
|
|
|
|
public string Software { get; set; }
|
|
|
|
|
|
|
|
public double? ExposureTime { get; set; }
|
|
|
|
|
|
|
|
public double? FocalLength { get; set; }
|
|
|
|
|
|
|
|
public ImageOrientation? Orientation { get; set; }
|
|
|
|
|
|
|
|
public double? Aperture { get; set; }
|
|
|
|
|
|
|
|
public double? ShutterSpeed { get; set; }
|
|
|
|
|
|
|
|
public double? Latitude { get; set; }
|
|
|
|
|
|
|
|
public double? Longitude { get; set; }
|
|
|
|
|
|
|
|
public double? Altitude { get; set; }
|
|
|
|
|
|
|
|
public int? IsoSpeedRating { get; set; }
|
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
public override bool CanDownload()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override double GetDefaultPrimaryImageAspectRatio()
|
|
|
|
{
|
2018-12-27 14:43:48 -07:00
|
|
|
// REVIEW: @bond
|
2020-02-20 07:30:04 -07:00
|
|
|
if (Width != 0 && Height != 0)
|
2018-12-27 16:27:57 -07:00
|
|
|
{
|
2020-02-20 07:30:04 -07:00
|
|
|
double width = Width;
|
|
|
|
double height = Height;
|
2018-12-27 16:27:57 -07: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 15:48:08 -07:00
|
|
|
return width / height;
|
2018-12-27 16:27:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return base.GetDefaultPrimaryImageAspectRatio();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|