< Summary - Jellyfin

Information
Class: Jellyfin.Api.Controllers.ArtistsController
Assembly: Jellyfin.Api
File(s): /srv/git/jellyfin/Jellyfin.Api/Controllers/ArtistsController.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 199
Coverable lines: 199
Total lines: 481
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 44
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 9/30/2025 - 12:10:18 AM Line coverage: 0% (0/201) Branch coverage: 0% (0/44) Total lines: 48312/1/2025 - 12:11:46 AM Line coverage: 0% (0/199) Branch coverage: 0% (0/44) Total lines: 481 9/30/2025 - 12:10:18 AM Line coverage: 0% (0/201) Branch coverage: 0% (0/44) Total lines: 48312/1/2025 - 12:11:46 AM Line coverage: 0% (0/199) Branch coverage: 0% (0/44) Total lines: 481

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
GetArtists(...)0%462210%
GetAlbumArtists(...)0%462210%
GetArtistByName(...)0%620%

File(s)

/srv/git/jellyfin/Jellyfin.Api/Controllers/ArtistsController.cs

#LineLine coverage
 1using System;
 2using System.ComponentModel.DataAnnotations;
 3using System.Linq;
 4using Jellyfin.Api.Extensions;
 5using Jellyfin.Api.Helpers;
 6using Jellyfin.Api.ModelBinders;
 7using Jellyfin.Data.Enums;
 8using Jellyfin.Database.Implementations.Entities;
 9using Jellyfin.Database.Implementations.Enums;
 10using Jellyfin.Extensions;
 11using MediaBrowser.Controller.Dto;
 12using MediaBrowser.Controller.Entities;
 13using MediaBrowser.Controller.Library;
 14using MediaBrowser.Model.Dto;
 15using MediaBrowser.Model.Entities;
 16using MediaBrowser.Model.Querying;
 17using Microsoft.AspNetCore.Authorization;
 18using Microsoft.AspNetCore.Http;
 19using Microsoft.AspNetCore.Mvc;
 20
 21namespace Jellyfin.Api.Controllers;
 22
 23/// <summary>
 24/// The artists controller.
 25/// </summary>
 26[Route("Artists")]
 27[Authorize]
 28public class ArtistsController : BaseJellyfinApiController
 29{
 30    private readonly ILibraryManager _libraryManager;
 31    private readonly IUserManager _userManager;
 32    private readonly IDtoService _dtoService;
 33
 34    /// <summary>
 35    /// Initializes a new instance of the <see cref="ArtistsController"/> class.
 36    /// </summary>
 37    /// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param>
 38    /// <param name="userManager">Instance of the <see cref="IUserManager"/> interface.</param>
 39    /// <param name="dtoService">Instance of the <see cref="IDtoService"/> interface.</param>
 040    public ArtistsController(
 041        ILibraryManager libraryManager,
 042        IUserManager userManager,
 043        IDtoService dtoService)
 44    {
 045        _libraryManager = libraryManager;
 046        _userManager = userManager;
 047        _dtoService = dtoService;
 048    }
 49
 50    /// <summary>
 51    /// Gets all artists from a given item, folder, or the entire library.
 52    /// </summary>
 53    /// <param name="minCommunityRating">Optional filter by minimum community rating.</param>
 54    /// <param name="startIndex">Optional. The record index to start at. All items with a lower index will be dropped fr
 55    /// <param name="limit">Optional. The maximum number of records to return.</param>
 56    /// <param name="searchTerm">Optional. Search term.</param>
 57    /// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</
 58    /// <param name="fields">Optional. Specify additional fields of information to return in the output.</param>
 59    /// <param name="excludeItemTypes">Optional. If specified, results will be filtered out based on item type. This all
 60    /// <param name="includeItemTypes">Optional. If specified, results will be filtered based on item type. This allows 
 61    /// <param name="filters">Optional. Specify additional filters to apply.</param>
 62    /// <param name="isFavorite">Optional filter by items that are marked as favorite, or not.</param>
 63    /// <param name="mediaTypes">Optional filter by MediaType. Allows multiple, comma delimited.</param>
 64    /// <param name="genres">Optional. If specified, results will be filtered based on genre. This allows multiple, pipe
 65    /// <param name="genreIds">Optional. If specified, results will be filtered based on genre id. This allows multiple,
 66    /// <param name="officialRatings">Optional. If specified, results will be filtered based on OfficialRating. This all
 67    /// <param name="tags">Optional. If specified, results will be filtered based on tag. This allows multiple, pipe del
 68    /// <param name="years">Optional. If specified, results will be filtered based on production year. This allows multi
 69    /// <param name="enableUserData">Optional, include user data.</param>
 70    /// <param name="imageTypeLimit">Optional, the max number of images to return, per image type.</param>
 71    /// <param name="enableImageTypes">Optional. The image types to include in the output.</param>
 72    /// <param name="person">Optional. If specified, results will be filtered to include only those containing the speci
 73    /// <param name="personIds">Optional. If specified, results will be filtered to include only those containing the sp
 74    /// <param name="personTypes">Optional. If specified, along with Person, results will be filtered to include only th
 75    /// <param name="studios">Optional. If specified, results will be filtered based on studio. This allows multiple, pi
 76    /// <param name="studioIds">Optional. If specified, results will be filtered based on studio id. This allows multipl
 77    /// <param name="userId">User id.</param>
 78    /// <param name="nameStartsWithOrGreater">Optional filter by items whose name is sorted equally or greater than a gi
 79    /// <param name="nameStartsWith">Optional filter by items whose name is sorted equally than a given input string.</p
 80    /// <param name="nameLessThan">Optional filter by items whose name is equally or lesser than a given input string.</
 81    /// <param name="sortBy">Optional. Specify one or more sort orders, comma delimited.</param>
 82    /// <param name="sortOrder">Sort Order - Ascending,Descending.</param>
 83    /// <param name="enableImages">Optional, include image information in output.</param>
 84    /// <param name="enableTotalRecordCount">Total record count.</param>
 85    /// <response code="200">Artists returned.</response>
 86    /// <returns>An <see cref="OkResult"/> containing the artists.</returns>
 87    [HttpGet]
 88    [ProducesResponseType(StatusCodes.Status200OK)]
 89    public ActionResult<QueryResult<BaseItemDto>> GetArtists(
 90        [FromQuery] double? minCommunityRating,
 91        [FromQuery] int? startIndex,
 92        [FromQuery] int? limit,
 93        [FromQuery] string? searchTerm,
 94        [FromQuery] Guid? parentId,
 95        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] ItemFields[] fields,
 96        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] BaseItemKind[] excludeItemTypes,
 97        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] BaseItemKind[] includeItemTypes,
 98        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] ItemFilter[] filters,
 99        [FromQuery] bool? isFavorite,
 100        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] MediaType[] mediaTypes,
 101        [FromQuery, ModelBinder(typeof(PipeDelimitedCollectionModelBinder))] string[] genres,
 102        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] Guid[] genreIds,
 103        [FromQuery, ModelBinder(typeof(PipeDelimitedCollectionModelBinder))] string[] officialRatings,
 104        [FromQuery, ModelBinder(typeof(PipeDelimitedCollectionModelBinder))] string[] tags,
 105        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] int[] years,
 106        [FromQuery] bool? enableUserData,
 107        [FromQuery] int? imageTypeLimit,
 108        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] ImageType[] enableImageTypes,
 109        [FromQuery] string? person,
 110        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] Guid[] personIds,
 111        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] string[] personTypes,
 112        [FromQuery, ModelBinder(typeof(PipeDelimitedCollectionModelBinder))] string[] studios,
 113        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] Guid[] studioIds,
 114        [FromQuery] Guid? userId,
 115        [FromQuery] string? nameStartsWithOrGreater,
 116        [FromQuery] string? nameStartsWith,
 117        [FromQuery] string? nameLessThan,
 118        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] ItemSortBy[] sortBy,
 119        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] SortOrder[] sortOrder,
 120        [FromQuery] bool? enableImages = true,
 121        [FromQuery] bool enableTotalRecordCount = true)
 122    {
 0123        userId = RequestHelpers.GetUserId(User, userId);
 0124        var dtoOptions = new DtoOptions { Fields = fields }
 0125            .AddAdditionalDtoOptions(enableImages, enableUserData, imageTypeLimit, enableImageTypes);
 126
 0127        User? user = null;
 0128        BaseItem parentItem = _libraryManager.GetParentItem(parentId, userId);
 129
 0130        if (!userId.IsNullOrEmpty())
 131        {
 0132            user = _userManager.GetUserById(userId.Value);
 133        }
 134
 0135        var query = new InternalItemsQuery(user)
 0136        {
 0137            ExcludeItemTypes = excludeItemTypes,
 0138            IncludeItemTypes = includeItemTypes,
 0139            MediaTypes = mediaTypes,
 0140            StartIndex = startIndex,
 0141            Limit = limit,
 0142            IsFavorite = isFavorite,
 0143            NameLessThan = nameLessThan,
 0144            NameStartsWith = nameStartsWith,
 0145            NameStartsWithOrGreater = nameStartsWithOrGreater,
 0146            Tags = tags,
 0147            OfficialRatings = officialRatings,
 0148            Genres = genres,
 0149            GenreIds = genreIds,
 0150            StudioIds = studioIds,
 0151            Person = person,
 0152            PersonIds = personIds,
 0153            PersonTypes = personTypes,
 0154            Years = years,
 0155            MinCommunityRating = minCommunityRating,
 0156            DtoOptions = dtoOptions,
 0157            SearchTerm = searchTerm,
 0158            EnableTotalRecordCount = enableTotalRecordCount,
 0159            OrderBy = RequestHelpers.GetOrderBy(sortBy, sortOrder)
 0160        };
 161
 0162        if (parentId.HasValue)
 163        {
 0164            if (parentItem is Folder)
 165            {
 0166                query.AncestorIds = new[] { parentId.Value };
 167            }
 168            else
 169            {
 0170                query.ItemIds = new[] { parentId.Value };
 171            }
 172        }
 173
 174        // Studios
 0175        if (studios.Length != 0)
 176        {
 0177            query.StudioIds = studios.Select(i =>
 0178            {
 0179                try
 0180                {
 0181                    return _libraryManager.GetStudio(i);
 0182                }
 0183                catch
 0184                {
 0185                    return null;
 0186                }
 0187            }).Where(i => i is not null).Select(i => i!.Id).ToArray();
 188        }
 189
 0190        foreach (var filter in filters)
 191        {
 192            switch (filter)
 193            {
 194                case ItemFilter.Dislikes:
 0195                    query.IsLiked = false;
 0196                    break;
 197                case ItemFilter.IsFavorite:
 0198                    query.IsFavorite = true;
 0199                    break;
 200                case ItemFilter.IsFavoriteOrLikes:
 0201                    query.IsFavoriteOrLiked = true;
 0202                    break;
 203                case ItemFilter.IsFolder:
 0204                    query.IsFolder = true;
 0205                    break;
 206                case ItemFilter.IsNotFolder:
 0207                    query.IsFolder = false;
 0208                    break;
 209                case ItemFilter.IsPlayed:
 0210                    query.IsPlayed = true;
 0211                    break;
 212                case ItemFilter.IsResumable:
 0213                    query.IsResumable = true;
 0214                    break;
 215                case ItemFilter.IsUnplayed:
 0216                    query.IsPlayed = false;
 0217                    break;
 218                case ItemFilter.Likes:
 0219                    query.IsLiked = true;
 220                    break;
 221            }
 222        }
 223
 0224        var result = _libraryManager.GetArtists(query);
 225
 0226        var dtos = result.Items.Select(i =>
 0227        {
 0228            var (baseItem, itemCounts) = i;
 0229            var dto = _dtoService.GetItemByNameDto(baseItem, dtoOptions, null, user);
 0230
 0231            if (includeItemTypes.Length != 0)
 0232            {
 0233                dto.ChildCount = itemCounts.ItemCount;
 0234                dto.ProgramCount = itemCounts.ProgramCount;
 0235                dto.SeriesCount = itemCounts.SeriesCount;
 0236                dto.EpisodeCount = itemCounts.EpisodeCount;
 0237                dto.MovieCount = itemCounts.MovieCount;
 0238                dto.TrailerCount = itemCounts.TrailerCount;
 0239                dto.AlbumCount = itemCounts.AlbumCount;
 0240                dto.SongCount = itemCounts.SongCount;
 0241                dto.ArtistCount = itemCounts.ArtistCount;
 0242            }
 0243
 0244            return dto;
 0245        });
 246
 0247        return new QueryResult<BaseItemDto>(
 0248            query.StartIndex,
 0249            result.TotalRecordCount,
 0250            dtos.ToArray());
 251    }
 252
 253    /// <summary>
 254    /// Gets all album artists from a given item, folder, or the entire library.
 255    /// </summary>
 256    /// <param name="minCommunityRating">Optional filter by minimum community rating.</param>
 257    /// <param name="startIndex">Optional. The record index to start at. All items with a lower index will be dropped fr
 258    /// <param name="limit">Optional. The maximum number of records to return.</param>
 259    /// <param name="searchTerm">Optional. Search term.</param>
 260    /// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</
 261    /// <param name="fields">Optional. Specify additional fields of information to return in the output.</param>
 262    /// <param name="excludeItemTypes">Optional. If specified, results will be filtered out based on item type. This all
 263    /// <param name="includeItemTypes">Optional. If specified, results will be filtered based on item type. This allows 
 264    /// <param name="filters">Optional. Specify additional filters to apply.</param>
 265    /// <param name="isFavorite">Optional filter by items that are marked as favorite, or not.</param>
 266    /// <param name="mediaTypes">Optional filter by MediaType. Allows multiple, comma delimited.</param>
 267    /// <param name="genres">Optional. If specified, results will be filtered based on genre. This allows multiple, pipe
 268    /// <param name="genreIds">Optional. If specified, results will be filtered based on genre id. This allows multiple,
 269    /// <param name="officialRatings">Optional. If specified, results will be filtered based on OfficialRating. This all
 270    /// <param name="tags">Optional. If specified, results will be filtered based on tag. This allows multiple, pipe del
 271    /// <param name="years">Optional. If specified, results will be filtered based on production year. This allows multi
 272    /// <param name="enableUserData">Optional, include user data.</param>
 273    /// <param name="imageTypeLimit">Optional, the max number of images to return, per image type.</param>
 274    /// <param name="enableImageTypes">Optional. The image types to include in the output.</param>
 275    /// <param name="person">Optional. If specified, results will be filtered to include only those containing the speci
 276    /// <param name="personIds">Optional. If specified, results will be filtered to include only those containing the sp
 277    /// <param name="personTypes">Optional. If specified, along with Person, results will be filtered to include only th
 278    /// <param name="studios">Optional. If specified, results will be filtered based on studio. This allows multiple, pi
 279    /// <param name="studioIds">Optional. If specified, results will be filtered based on studio id. This allows multipl
 280    /// <param name="userId">User id.</param>
 281    /// <param name="nameStartsWithOrGreater">Optional filter by items whose name is sorted equally or greater than a gi
 282    /// <param name="nameStartsWith">Optional filter by items whose name is sorted equally than a given input string.</p
 283    /// <param name="nameLessThan">Optional filter by items whose name is equally or lesser than a given input string.</
 284    /// <param name="sortBy">Optional. Specify one or more sort orders, comma delimited.</param>
 285    /// <param name="sortOrder">Sort Order - Ascending,Descending.</param>
 286    /// <param name="enableImages">Optional, include image information in output.</param>
 287    /// <param name="enableTotalRecordCount">Total record count.</param>
 288    /// <response code="200">Album artists returned.</response>
 289    /// <returns>An <see cref="OkResult"/> containing the album artists.</returns>
 290    [HttpGet("AlbumArtists")]
 291    [ProducesResponseType(StatusCodes.Status200OK)]
 292    public ActionResult<QueryResult<BaseItemDto>> GetAlbumArtists(
 293        [FromQuery] double? minCommunityRating,
 294        [FromQuery] int? startIndex,
 295        [FromQuery] int? limit,
 296        [FromQuery] string? searchTerm,
 297        [FromQuery] Guid? parentId,
 298        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] ItemFields[] fields,
 299        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] BaseItemKind[] excludeItemTypes,
 300        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] BaseItemKind[] includeItemTypes,
 301        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] ItemFilter[] filters,
 302        [FromQuery] bool? isFavorite,
 303        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] MediaType[] mediaTypes,
 304        [FromQuery, ModelBinder(typeof(PipeDelimitedCollectionModelBinder))] string[] genres,
 305        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] Guid[] genreIds,
 306        [FromQuery, ModelBinder(typeof(PipeDelimitedCollectionModelBinder))] string[] officialRatings,
 307        [FromQuery, ModelBinder(typeof(PipeDelimitedCollectionModelBinder))] string[] tags,
 308        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] int[] years,
 309        [FromQuery] bool? enableUserData,
 310        [FromQuery] int? imageTypeLimit,
 311        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] ImageType[] enableImageTypes,
 312        [FromQuery] string? person,
 313        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] Guid[] personIds,
 314        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] string[] personTypes,
 315        [FromQuery, ModelBinder(typeof(PipeDelimitedCollectionModelBinder))] string[] studios,
 316        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] Guid[] studioIds,
 317        [FromQuery] Guid? userId,
 318        [FromQuery] string? nameStartsWithOrGreater,
 319        [FromQuery] string? nameStartsWith,
 320        [FromQuery] string? nameLessThan,
 321        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] ItemSortBy[] sortBy,
 322        [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] SortOrder[] sortOrder,
 323        [FromQuery] bool? enableImages = true,
 324        [FromQuery] bool enableTotalRecordCount = true)
 325    {
 0326        userId = RequestHelpers.GetUserId(User, userId);
 0327        var dtoOptions = new DtoOptions { Fields = fields }
 0328            .AddAdditionalDtoOptions(enableImages, enableUserData, imageTypeLimit, enableImageTypes);
 329
 0330        User? user = null;
 0331        BaseItem parentItem = _libraryManager.GetParentItem(parentId, userId);
 332
 0333        if (!userId.IsNullOrEmpty())
 334        {
 0335            user = _userManager.GetUserById(userId.Value);
 336        }
 337
 0338        var query = new InternalItemsQuery(user)
 0339        {
 0340            ExcludeItemTypes = excludeItemTypes,
 0341            IncludeItemTypes = includeItemTypes,
 0342            MediaTypes = mediaTypes,
 0343            StartIndex = startIndex,
 0344            Limit = limit,
 0345            IsFavorite = isFavorite,
 0346            NameLessThan = nameLessThan,
 0347            NameStartsWith = nameStartsWith,
 0348            NameStartsWithOrGreater = nameStartsWithOrGreater,
 0349            Tags = tags,
 0350            OfficialRatings = officialRatings,
 0351            Genres = genres,
 0352            GenreIds = genreIds,
 0353            StudioIds = studioIds,
 0354            Person = person,
 0355            PersonIds = personIds,
 0356            PersonTypes = personTypes,
 0357            Years = years,
 0358            MinCommunityRating = minCommunityRating,
 0359            DtoOptions = dtoOptions,
 0360            SearchTerm = searchTerm,
 0361            EnableTotalRecordCount = enableTotalRecordCount,
 0362            OrderBy = RequestHelpers.GetOrderBy(sortBy, sortOrder)
 0363        };
 364
 0365        if (parentId.HasValue)
 366        {
 0367            if (parentItem is Folder)
 368            {
 0369                query.AncestorIds = new[] { parentId.Value };
 370            }
 371            else
 372            {
 0373                query.ItemIds = new[] { parentId.Value };
 374            }
 375        }
 376
 377        // Studios
 0378        if (studios.Length != 0)
 379        {
 0380            query.StudioIds = studios.Select(i =>
 0381            {
 0382                try
 0383                {
 0384                    return _libraryManager.GetStudio(i);
 0385                }
 0386                catch
 0387                {
 0388                    return null;
 0389                }
 0390            }).Where(i => i is not null).Select(i => i!.Id).ToArray();
 391        }
 392
 0393        foreach (var filter in filters)
 394        {
 395            switch (filter)
 396            {
 397                case ItemFilter.Dislikes:
 0398                    query.IsLiked = false;
 0399                    break;
 400                case ItemFilter.IsFavorite:
 0401                    query.IsFavorite = true;
 0402                    break;
 403                case ItemFilter.IsFavoriteOrLikes:
 0404                    query.IsFavoriteOrLiked = true;
 0405                    break;
 406                case ItemFilter.IsFolder:
 0407                    query.IsFolder = true;
 0408                    break;
 409                case ItemFilter.IsNotFolder:
 0410                    query.IsFolder = false;
 0411                    break;
 412                case ItemFilter.IsPlayed:
 0413                    query.IsPlayed = true;
 0414                    break;
 415                case ItemFilter.IsResumable:
 0416                    query.IsResumable = true;
 0417                    break;
 418                case ItemFilter.IsUnplayed:
 0419                    query.IsPlayed = false;
 0420                    break;
 421                case ItemFilter.Likes:
 0422                    query.IsLiked = true;
 423                    break;
 424            }
 425        }
 426
 0427        var result = _libraryManager.GetAlbumArtists(query);
 428
 0429        var dtos = result.Items.Select(i =>
 0430        {
 0431            var (baseItem, itemCounts) = i;
 0432            var dto = _dtoService.GetItemByNameDto(baseItem, dtoOptions, null, user);
 0433
 0434            if (includeItemTypes.Length != 0)
 0435            {
 0436                dto.ChildCount = itemCounts.ItemCount;
 0437                dto.ProgramCount = itemCounts.ProgramCount;
 0438                dto.SeriesCount = itemCounts.SeriesCount;
 0439                dto.EpisodeCount = itemCounts.EpisodeCount;
 0440                dto.MovieCount = itemCounts.MovieCount;
 0441                dto.TrailerCount = itemCounts.TrailerCount;
 0442                dto.AlbumCount = itemCounts.AlbumCount;
 0443                dto.SongCount = itemCounts.SongCount;
 0444                dto.ArtistCount = itemCounts.ArtistCount;
 0445            }
 0446
 0447            return dto;
 0448        });
 449
 0450        return new QueryResult<BaseItemDto>(
 0451            query.StartIndex,
 0452            result.TotalRecordCount,
 0453            dtos.ToArray());
 454    }
 455
 456    /// <summary>
 457    /// Gets an artist by name.
 458    /// </summary>
 459    /// <param name="name">Studio name.</param>
 460    /// <param name="userId">Optional. Filter by user id, and attach user data.</param>
 461    /// <response code="200">Artist returned.</response>
 462    /// <returns>An <see cref="OkResult"/> containing the artist.</returns>
 463    [HttpGet("{name}")]
 464    [ProducesResponseType(StatusCodes.Status200OK)]
 465    public ActionResult<BaseItemDto> GetArtistByName([FromRoute, Required] string name, [FromQuery] Guid? userId)
 466    {
 0467        userId = RequestHelpers.GetUserId(User, userId);
 0468        var dtoOptions = new DtoOptions();
 469
 0470        var item = _libraryManager.GetArtist(name, dtoOptions);
 471
 0472        if (!userId.IsNullOrEmpty())
 473        {
 0474            var user = _userManager.GetUserById(userId.Value);
 475
 0476            return _dtoService.GetBaseItemDto(item, dtoOptions, user);
 477        }
 478
 0479        return _dtoService.GetBaseItemDto(item, dtoOptions);
 480    }
 481}

Methods/Properties

.ctor(MediaBrowser.Controller.Library.ILibraryManager,MediaBrowser.Controller.Library.IUserManager,MediaBrowser.Controller.Dto.IDtoService)
GetArtists(System.Nullable`1<System.Double>,System.Nullable`1<System.Int32>,System.Nullable`1<System.Int32>,System.String,System.Nullable`1<System.Guid>,MediaBrowser.Model.Querying.ItemFields[],Jellyfin.Data.Enums.BaseItemKind[],Jellyfin.Data.Enums.BaseItemKind[],MediaBrowser.Model.Querying.ItemFilter[],System.Nullable`1<System.Boolean>,Jellyfin.Data.Enums.MediaType[],System.String[],System.Guid[],System.String[],System.String[],System.Int32[],System.Nullable`1<System.Boolean>,System.Nullable`1<System.Int32>,MediaBrowser.Model.Entities.ImageType[],System.String,System.Guid[],System.String[],System.String[],System.Guid[],System.Nullable`1<System.Guid>,System.String,System.String,System.String,Jellyfin.Data.Enums.ItemSortBy[],Jellyfin.Database.Implementations.Enums.SortOrder[],System.Nullable`1<System.Boolean>,System.Boolean)
GetAlbumArtists(System.Nullable`1<System.Double>,System.Nullable`1<System.Int32>,System.Nullable`1<System.Int32>,System.String,System.Nullable`1<System.Guid>,MediaBrowser.Model.Querying.ItemFields[],Jellyfin.Data.Enums.BaseItemKind[],Jellyfin.Data.Enums.BaseItemKind[],MediaBrowser.Model.Querying.ItemFilter[],System.Nullable`1<System.Boolean>,Jellyfin.Data.Enums.MediaType[],System.String[],System.Guid[],System.String[],System.String[],System.Int32[],System.Nullable`1<System.Boolean>,System.Nullable`1<System.Int32>,MediaBrowser.Model.Entities.ImageType[],System.String,System.Guid[],System.String[],System.String[],System.Guid[],System.Nullable`1<System.Guid>,System.String,System.String,System.String,Jellyfin.Data.Enums.ItemSortBy[],Jellyfin.Database.Implementations.Enums.SortOrder[],System.Nullable`1<System.Boolean>,System.Boolean)
GetArtistByName(System.String,System.Nullable`1<System.Guid>)