< Summary - Jellyfin

Information
Class: Emby.Server.Implementations.Images.BaseFolderImageProvider<T>
Assembly: Emby.Server.Implementations
File(s): /srv/git/jellyfin/Emby.Server.Implementations/Images/BaseFolderImageProvider.cs
Line coverage
80%
Covered lines: 17
Uncovered lines: 4
Coverable lines: 21
Total lines: 66
Line coverage: 80.9%
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%
GetItemsWithImages(...)100%11100%
CreateImage(...)100%11100%
Supports(...)100%210%
HasChangedByDate(...)0%620%

File(s)

/srv/git/jellyfin/Emby.Server.Implementations/Images/BaseFolderImageProvider.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.Entities.Audio;
 11using MediaBrowser.Controller.Library;
 12using MediaBrowser.Controller.Providers;
 13using MediaBrowser.Model.Entities;
 14using MediaBrowser.Model.IO;
 15
 16namespace Emby.Server.Implementations.Images
 17{
 18    public abstract class BaseFolderImageProvider<T> : BaseDynamicImageProvider<T>
 19        where T : Folder, new()
 20    {
 21        private readonly ILibraryManager _libraryManager;
 22
 23        protected BaseFolderImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths ap
 6324            : base(fileSystem, providerManager, applicationPaths, imageProcessor)
 25        {
 6326            _libraryManager = libraryManager;
 6327        }
 28
 29        protected override IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item)
 30        {
 3731            return _libraryManager.GetItemList(new InternalItemsQuery
 3732            {
 3733                Parent = item,
 3734                Recursive = true,
 3735                DtoOptions = new DtoOptions(true),
 3736                ImageTypes = [ImageType.Primary],
 3737                OrderBy =
 3738                [
 3739                    (ItemSortBy.IsFolder, SortOrder.Ascending),
 3740                    (ItemSortBy.SortName, SortOrder.Ascending)
 3741                ],
 3742                Limit = 1
 3743            });
 44        }
 45
 46        protected override string CreateImage(BaseItem item, IReadOnlyCollection<BaseItem> itemsWithImages, string outpu
 47        {
 3648            return CreateSingleImage(itemsWithImages, outputPathWithoutExtension, ImageType.Primary);
 49        }
 50
 51        protected override bool Supports(BaseItem item)
 52        {
 053            return item is T;
 54        }
 55
 56        protected override bool HasChangedByDate(BaseItem item, ItemImageInfo image)
 57        {
 058            if (item is MusicAlbum)
 59            {
 060                return false;
 61            }
 62
 063            return base.HasChangedByDate(item, image);
 64        }
 65    }
 66}