< Summary - Jellyfin

Information
Class: MediaBrowser.Controller.Entities.Photo
Assembly: MediaBrowser.Controller
File(s): /srv/git/jellyfin/MediaBrowser.Controller/Entities/Photo.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 20
Coverable lines: 20
Total lines: 98
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 12
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_SupportsLocalMetadata()100%210%
get_MediaType()100%210%
get_LatestItemsIndexContainer()100%210%
get_AlbumEntity()0%2040%
CanDownload()100%210%
GetDefaultPrimaryImageAspectRatio()0%7280%

File(s)

/srv/git/jellyfin/MediaBrowser.Controller/Entities/Photo.cs

#LineLine coverage
 1#nullable disable
 2
 3#pragma warning disable CS1591
 4
 5using System.Text.Json.Serialization;
 6using Jellyfin.Data.Enums;
 7using MediaBrowser.Model.Drawing;
 8
 9namespace MediaBrowser.Controller.Entities
 10{
 11    public class Photo : BaseItem
 12    {
 13        [JsonIgnore]
 014        public override bool SupportsLocalMetadata => false;
 15
 16        [JsonIgnore]
 017        public override MediaType MediaType => MediaType.Photo;
 18
 19        [JsonIgnore]
 020        public override Folder LatestItemsIndexContainer => AlbumEntity;
 21
 22        [JsonIgnore]
 23        public PhotoAlbum AlbumEntity
 24        {
 25            get
 26            {
 027                var parents = GetParents();
 028                foreach (var parent in parents)
 29                {
 030                    if (parent is PhotoAlbum photoAlbum)
 31                    {
 032                        return photoAlbum;
 33                    }
 34                }
 35
 036                return null;
 037            }
 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        {
 066            return true;
 67        }
 68
 69        public override double GetDefaultPrimaryImageAspectRatio()
 70        {
 71            // REVIEW: @bond
 072            if (Width != 0 && Height != 0)
 73            {
 074                double width = Width;
 075                double height = Height;
 76
 077                if (Orientation.HasValue)
 78                {
 079                    switch (Orientation.Value)
 80                    {
 81                        case ImageOrientation.LeftBottom:
 82                        case ImageOrientation.LeftTop:
 83                        case ImageOrientation.RightBottom:
 84                        case ImageOrientation.RightTop:
 085                            var temp = height;
 086                            height = width;
 087                            width = temp;
 88                            break;
 89                    }
 90                }
 91
 092                return width / height;
 93            }
 94
 095            return base.GetDefaultPrimaryImageAspectRatio();
 96        }
 97    }
 98}