< Summary - Jellyfin

Information
Class: MediaBrowser.Controller.Providers.MetadataResult<T>
Assembly: MediaBrowser.Controller
File(s): /srv/git/jellyfin/MediaBrowser.Controller/Providers/MetadataResult.cs
Line coverage
73%
Covered lines: 11
Uncovered lines: 4
Coverable lines: 15
Total lines: 74
Line coverage: 73.3%
Branch coverage
90%
Covered branches: 9
Total branches: 10
Branch coverage: 90%
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_Images()100%22100%
set_Images(...)100%210%
get_RemoteImages()100%22100%
set_RemoteImages(...)100%210%
get_People()100%11100%
set_People(...)100%22100%
AddPerson(...)100%22100%
ResetPeople()50%3250%

File(s)

/srv/git/jellyfin/MediaBrowser.Controller/Providers/MetadataResult.cs

#LineLine coverage
 1#nullable disable
 2
 3#pragma warning disable CA1002, CA2227, CS1591
 4
 5using System.Collections.Generic;
 6using System.Linq;
 7using MediaBrowser.Controller.Entities;
 8using MediaBrowser.Model.Entities;
 9
 10namespace MediaBrowser.Controller.Providers
 11{
 12    public class MetadataResult<T>
 13    {
 14        // Images aren't always used so the allocation is a waste a lot of the time
 15        private List<LocalImageInfo> _images;
 16        private List<(string Url, ImageType Type)> _remoteImages;
 17        private List<PersonInfo> _people;
 18
 19        public MetadataResult()
 20        {
 39821            ResultLanguage = "en";
 39822        }
 23
 24        public List<LocalImageInfo> Images
 25        {
 526            get => _images ??= [];
 027            set => _images = value;
 28        }
 29
 30        public List<(string Url, ImageType Type)> RemoteImages
 31        {
 20332            get => _remoteImages ??= [];
 033            set => _remoteImages = value;
 34        }
 35
 36        public IReadOnlyList<PersonInfo> People
 37        {
 31738            get => _people;
 21539            set => _people = value?.ToList();
 40        }
 41
 42        public bool HasMetadata { get; set; }
 43
 44        public T Item { get; set; }
 45
 46        public string ResultLanguage { get; set; }
 47
 48        public string Provider { get; set; }
 49
 50        public bool QueriedById { get; set; }
 51
 52        public void AddPerson(PersonInfo p)
 53        {
 6354            People ??= new List<PersonInfo>();
 55
 6356            PeopleHelper.AddPerson(_people, p);
 6357        }
 58
 59        /// <summary>
 60        /// Not only does this clear, but initializes the list so that services can differentiate between a null list an
 61        /// </summary>
 62        public void ResetPeople()
 63        {
 1664            if (People is null)
 65            {
 1666                People = new List<PersonInfo>();
 67            }
 68            else
 69            {
 070                _people.Clear();
 71            }
 072        }
 73    }
 74}