< Summary - Jellyfin

Information
Class: Emby.Server.Implementations.Images.GenreImageProvider
Assembly: Emby.Server.Implementations
File(s): /srv/git/jellyfin/Emby.Server.Implementations/Images/GenreImageProvider.cs
Line coverage
23%
Covered lines: 3
Uncovered lines: 10
Coverable lines: 13
Total lines: 52
Line coverage: 23%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
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%
GetItemsWithImages(...)100%210%

File(s)

/srv/git/jellyfin/Emby.Server.Implementations/Images/GenreImageProvider.cs

#LineLine coverage
 1#pragma warning disable CS1591
 2
 3using System.Collections.Generic;
 4using Jellyfin.Data.Enums;
 5using Jellyfin.Database.Implementations.Enums;
 6using MediaBrowser.Common.Configuration;
 7using MediaBrowser.Controller.Drawing;
 8using MediaBrowser.Controller.Dto;
 9using MediaBrowser.Controller.Entities;
 10using MediaBrowser.Controller.Library;
 11using MediaBrowser.Controller.Providers;
 12using MediaBrowser.Model.Entities;
 13using MediaBrowser.Model.IO;
 14using MediaBrowser.Model.Querying;
 15
 16namespace Emby.Server.Implementations.Images
 17{
 18    /// <summary>
 19    /// Class GenreImageProvider.
 20    /// </summary>
 21    public class GenreImageProvider : BaseDynamicImageProvider<Genre>
 22    {
 23        /// <summary>
 24        /// The library manager.
 25        /// </summary>
 26        private readonly ILibraryManager _libraryManager;
 27
 2128        public GenreImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicatio
 29        {
 2130            _libraryManager = libraryManager;
 2131        }
 32
 33        /// <summary>
 34        /// Get children objects used to create an genre image.
 35        /// </summary>
 36        /// <param name="item">The genre used to create the image.</param>
 37        /// <returns>Any relevant children objects.</returns>
 38        protected override IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item)
 39        {
 040            return _libraryManager.GetItemList(new InternalItemsQuery
 041            {
 042                Genres = new[] { item.Name },
 043                IncludeItemTypes = new[] { BaseItemKind.Series, BaseItemKind.Movie },
 044                OrderBy = new[] { (ItemSortBy.Random, SortOrder.Ascending) },
 045                Limit = 4,
 046                Recursive = true,
 047                ImageTypes = new[] { ImageType.Primary },
 048                DtoOptions = new DtoOptions(false)
 049            });
 50        }
 51    }
 52}