< Summary - Jellyfin

Information
Class: MediaBrowser.Controller.Entities.Book
Assembly: MediaBrowser.Controller
File(s): /srv/git/jellyfin/MediaBrowser.Controller/Entities/Book.cs
Line coverage
16%
Covered lines: 3
Uncovered lines: 15
Coverable lines: 18
Total lines: 87
Line coverage: 16.6%
Branch coverage
0%
Covered branches: 0
Total branches: 2
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
.ctor()100%11100%
get_MediaType()100%210%
get_SupportsPlayedStatus()100%210%
get_SupportsPositionTicksResume()100%210%
get_SupportsPeople()100%210%
FindSeriesSortName()100%210%
FindSeriesName()100%210%
FindSeriesPresentationUniqueKey()100%210%
FindSeriesId()100%210%
CanDownload()100%210%
GetBlockUnratedType()100%210%
GetLookupInfo()0%620%

File(s)

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

#LineLine coverage
 1#nullable disable
 2
 3#pragma warning disable CS1591
 4
 5using System;
 6using System.Linq;
 7using System.Text.Json.Serialization;
 8using Jellyfin.Data.Enums;
 9using MediaBrowser.Controller.Providers;
 10
 11namespace MediaBrowser.Controller.Entities
 12{
 13    public class Book : BaseItem, IHasLookupInfo<BookInfo>, IHasSeries
 14    {
 515        public Book()
 16        {
 517            this.RunTimeTicks = TimeSpan.TicksPerSecond;
 518        }
 19
 20        [JsonIgnore]
 021        public override MediaType MediaType => MediaType.Book;
 22
 023        public override bool SupportsPlayedStatus => true;
 24
 025        public override bool SupportsPositionTicksResume => true;
 26
 27        [JsonIgnore]
 028        public override bool SupportsPeople => true;
 29
 30        [JsonIgnore]
 31        public string SeriesPresentationUniqueKey { get; set; }
 32
 33        [JsonIgnore]
 34        public string SeriesName { get; set; }
 35
 36        [JsonIgnore]
 37        public Guid SeriesId { get; set; }
 38
 39        public string FindSeriesSortName()
 40        {
 041            return SeriesName;
 42        }
 43
 44        public string FindSeriesName()
 45        {
 046            return SeriesName;
 47        }
 48
 49        public string FindSeriesPresentationUniqueKey()
 50        {
 051            return SeriesPresentationUniqueKey;
 52        }
 53
 54        public Guid FindSeriesId()
 55        {
 056            return SeriesId;
 57        }
 58
 59        /// <inheritdoc />
 60        public override bool CanDownload()
 61        {
 062            return IsFileProtocol;
 63        }
 64
 65        /// <inheritdoc />
 66        public override UnratedItem GetBlockUnratedType()
 67        {
 068            return UnratedItem.Book;
 69        }
 70
 71        public BookInfo GetLookupInfo()
 72        {
 073            var info = GetItemLookupInfo<BookInfo>();
 74
 075            if (string.IsNullOrEmpty(SeriesName))
 76            {
 077                info.SeriesName = GetParents().Select(i => i.Name).FirstOrDefault();
 78            }
 79            else
 80            {
 081                info.SeriesName = SeriesName;
 82            }
 83
 084            return info;
 85        }
 86    }
 87}