< Summary - Jellyfin

Information
Class: MediaBrowser.Providers.Plugins.AudioDb.AudioDbArtistImageProvider
Assembly: MediaBrowser.Providers
File(s): /srv/git/jellyfin/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistImageProvider.cs
Line coverage
4%
Covered lines: 3
Uncovered lines: 62
Coverable lines: 65
Total lines: 139
Line coverage: 4.6%
Branch coverage
0%
Covered branches: 0
Total branches: 14
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 5/1/2026 - 12:13:05 AM Line coverage: 7.1% (5/70) Branch coverage: 0% (0/20) Total lines: 1557/29/2026 - 12:15:53 AM Line coverage: 4.6% (3/65) Branch coverage: 0% (0/14) Total lines: 139 5/1/2026 - 12:13:05 AM Line coverage: 7.1% (5/70) Branch coverage: 0% (0/20) Total lines: 1557/29/2026 - 12:15:53 AM Line coverage: 4.6% (3/65) Branch coverage: 0% (0/14) Total lines: 139

Coverage delta

Coverage delta 3 -3

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Name()100%210%
get_Order()100%210%
GetSupportedImages(...)100%210%
GetImages()0%620%
GetImages(...)0%156120%
GetImageResponse(...)100%210%
Supports(...)100%11100%

File(s)

/srv/git/jellyfin/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistImageProvider.cs

#LineLine coverage
 1#nullable disable
 2
 3#pragma warning disable CS1591
 4
 5using System.Collections.Generic;
 6using System.Net.Http;
 7using System.Threading;
 8using System.Threading.Tasks;
 9using MediaBrowser.Common.Net;
 10using MediaBrowser.Controller.Entities;
 11using MediaBrowser.Controller.Entities.Audio;
 12using MediaBrowser.Controller.Providers;
 13using MediaBrowser.Model.Entities;
 14using MediaBrowser.Model.Providers;
 15
 16namespace MediaBrowser.Providers.Plugins.AudioDb
 17{
 18    public class AudioDbArtistImageProvider : IRemoteImageProvider, IHasOrder
 19    {
 20        private readonly IHttpClientFactory _httpClientFactory;
 21
 22        public AudioDbArtistImageProvider(IHttpClientFactory httpClientFactory)
 23        {
 2224            _httpClientFactory = httpClientFactory;
 2225        }
 26
 27        /// <inheritdoc />
 028        public string Name => "TheAudioDB";
 29
 30        /// <inheritdoc />
 31        // After fanart
 032        public int Order => 1;
 33
 34        /// <inheritdoc />
 35        public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
 36        {
 037            return
 038            [
 039                ImageType.Primary,
 040                ImageType.Logo,
 041                ImageType.Banner,
 042                ImageType.Backdrop
 043            ];
 44        }
 45
 46        /// <inheritdoc />
 47        public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
 48        {
 049            item.TryGetProviderId(MetadataProvider.MusicBrainzArtist, out var musicBrainzId);
 050            item.TryGetProviderId(MetadataProvider.AudioDbArtist, out var audioDbId);
 51
 052            var artist = await AudioDbArtistProvider.Current.GetArtist(musicBrainzId, audioDbId, cancellationToken).Conf
 53
 054            if (artist is not null)
 55            {
 056                return GetImages(artist);
 57            }
 58
 059            return [];
 060        }
 61
 62        private List<RemoteImageInfo> GetImages(AudioDbArtistProvider.Artist item)
 63        {
 064            var list = new List<RemoteImageInfo>();
 65
 066            if (!string.IsNullOrWhiteSpace(item.strArtistThumb))
 67            {
 068                list.Add(new RemoteImageInfo
 069                {
 070                    ProviderName = Name,
 071                    Url = item.strArtistThumb,
 072                    Type = ImageType.Primary
 073                });
 74            }
 75
 076            if (!string.IsNullOrWhiteSpace(item.strArtistLogo))
 77            {
 078                list.Add(new RemoteImageInfo
 079                {
 080                    ProviderName = Name,
 081                    Url = item.strArtistLogo,
 082                    Type = ImageType.Logo
 083                });
 84            }
 85
 086            if (!string.IsNullOrWhiteSpace(item.strArtistBanner))
 87            {
 088                list.Add(new RemoteImageInfo
 089                {
 090                    ProviderName = Name,
 091                    Url = item.strArtistBanner,
 092                    Type = ImageType.Banner
 093                });
 94            }
 95
 096            if (!string.IsNullOrWhiteSpace(item.strArtistFanart))
 97            {
 098                list.Add(new RemoteImageInfo
 099                {
 0100                    ProviderName = Name,
 0101                    Url = item.strArtistFanart,
 0102                    Type = ImageType.Backdrop
 0103                });
 104            }
 105
 0106            if (!string.IsNullOrWhiteSpace(item.strArtistFanart2))
 107            {
 0108                list.Add(new RemoteImageInfo
 0109                {
 0110                    ProviderName = Name,
 0111                    Url = item.strArtistFanart2,
 0112                    Type = ImageType.Backdrop
 0113                });
 114            }
 115
 0116            if (!string.IsNullOrWhiteSpace(item.strArtistFanart3))
 117            {
 0118                list.Add(new RemoteImageInfo
 0119                {
 0120                    ProviderName = Name,
 0121                    Url = item.strArtistFanart3,
 0122                    Type = ImageType.Backdrop
 0123                });
 124            }
 125
 0126            return list;
 127        }
 128
 129        public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
 130        {
 0131            var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
 0132            return httpClient.GetAsync(url, cancellationToken);
 133        }
 134
 135        /// <inheritdoc />
 136        public bool Supports(BaseItem item)
 61137            => item is MusicArtist;
 138    }
 139}