< 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: 201
Coverable lines: 201
Total lines: 482
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

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.Entities;
 8using Jellyfin.Data.Enums;
 9using Jellyfin.Extensions;
 10using MediaBrowser.Controller.Dto;
 11using MediaBrowser.Controller.Entities;
 12using MediaBrowser.Controller.Library;
 13using MediaBrowser.Model.Dto;
 14using MediaBrowser.Model.Entities;
 15using MediaBrowser.Model.Querying;
 16using Microsoft.AspNetCore.Authorization;
 17using Microsoft.AspNetCore.Http;
 18using Microsoft.AspNetCore.Mvc;
 19
 20namespace Jellyfin.Api.Controllers;
 21
 22/// <summary>
 23/// The artists controller.
 24/// </summary>
 25[Route("Artists")]
 26[Authorize]
 27public class ArtistsController : BaseJellyfinApiController
 28{
 29    private readonly ILibraryManager _libraryManager;
 30    private readonly IUserManager _userManager;
 31    private readonly IDtoService _dtoService;
 32
 33    /// <summary>
 34    /// Initializes a new instance of the <see cref="ArtistsController"/> class.
 35    /// </summary>
 36    /// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param>
 37    /// <param name="userManager">Instance of the <see cref="IUserManager"/> interface.</param>
 38    /// <param name="dtoService">Instance of the <see cref="IDtoService"/> interface.</param>
 039    public ArtistsController(
 040        ILibraryManager libraryManager,
 041        IUserManager userManager,
 042        IDtoService dtoService)
 43    {
 044        _libraryManager = libraryManager;
 045        _userManager = userManager;
 046        _dtoService = dtoService;
 047    }
 48
 49    /// <summary>
 50    /// Gets all artists from a given item, folder, or the entire library.
 51    /// </summary>
 52    /// <param name="minCommunityRating">Optional filter by minimum community rating.</param>
 53    /// <param name="startIndex">Optional. The record index to start at. All items with a lower index will be dropped fr
 54    /// <param name="limit">Optional. The maximum number of records to return.</param>
 55    /// <param name="searchTerm">Optional. Search term.</param>
 56    /// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</
 57    /// <param name="fields">Optional. Specify additional fields of information to return in the output.</param>
 58    /// <param name="excludeItemTypes">Optional. If specified, results will be filtered out based on item type. This all
 59    /// <param name="includeItemTypes">Optional. If specified, results will be filtered based on item type. This allows 
 60    /// <param name="filters">Optional. Specify additional filters to apply.</param>
 61    /// <param name="isFavorite">Optional filter by items that are marked as favorite, or not.</param>
 62    /// <param name="mediaTypes">Optional filter by MediaType. Allows multiple, comma delimited.</param>
 63    /// <param name="genres">Optional. If specified, results will be filtered based on genre. This allows multiple, pipe
 64    /// <param name="genreIds">Optional. If specified, results will be filtered based on genre id. This allows multiple,
 65    /// <param name="officialRatings">Optional. If specified, results will be filtered based on OfficialRating. This all
 66    /// <param name="tags">Optional. If specified, results will be filtered based on tag. This allows multiple, pipe del
 67    /// <param name="years">Optional. If specified, results will be filtered based on production year. This allows multi
 68    /// <param name="enableUserData">Optional, include user data.</param>
 69    /// <param name="imageTypeLimit">Optional, the max number of images to return, per image type.</param>
 70    /// <param name="enableImageTypes">Optional. The image types to include in the output.</param>
 71    /// <param name="person">Optional. If specified, results will be filtered to include only those containing the speci
 72    /// <param name="personIds">Optional. If specified, results will be filtered to include only those containing the sp
 73    /// <param name="personTypes">Optional. If specified, along with Person, results will be filtered to include only th
 74    /// <param name="studios">Optional. If specified, results will be filtered based on studio. This allows multiple, pi
 75    /// <param name="studioIds">Optional. If specified, results will be filtered based on studio id. This allows multipl
 76    /// <param name="userId">User id.</param>
 77    /// <param name="nameStartsWithOrGreater">Optional filter by items whose name is sorted equally or greater than a gi
 78    /// <param name="nameStartsWith">Optional filter by items whose name is sorted equally than a given input string.</p
 79    /// <param name="nameLessThan">Optional filter by items whose name is equally or lesser than a given input string.</
 80    /// <param name="sortBy">Optional. Specify one or more sort orders, comma delimited.</param>
 81    /// <param name="sortOrder">Sort Order - Ascending,Descending.</param>
 82    /// <param name="enableImages">Optional, include image information in output.</param>
 83    /// <param name="enableTotalRecordCount">Total record count.</param>
 84    /// <response code="200">Artists returned.</response>
 85    /// <returns>An <see cref="OkResult"/> containing the artists.</returns>
 86    [HttpGet]
 87    [ProducesResponseType(StatusCodes.Status200OK)]
 88    public ActionResult<QueryResult<BaseItemDto>> GetArtists(
 89        [FromQuery] double? minCommunityRating,
 90        [FromQuery] int? startIndex,
 91        [FromQuery] int? limit,
 92        [FromQuery] string? searchTerm,
 93        [FromQuery] Guid? parentId,
 94        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFields[] fields,
 95        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] BaseItemKind[] excludeItemTypes,
 96        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] BaseItemKind[] includeItemTypes,
 97        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFilter[] filters,
 98        [FromQuery] bool? isFavorite,
 99        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] MediaType[] mediaTypes,
 100        [FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] genres,
 101        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] genreIds,
 102        [FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] officialRatings,
 103        [FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] tags,
 104        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] int[] years,
 105        [FromQuery] bool? enableUserData,
 106        [FromQuery] int? imageTypeLimit,
 107        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes,
 108        [FromQuery] string? person,
 109        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] personIds,
 110        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] personTypes,
 111        [FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] studios,
 112        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] studioIds,
 113        [FromQuery] Guid? userId,
 114        [FromQuery] string? nameStartsWithOrGreater,
 115        [FromQuery] string? nameStartsWith,
 116        [FromQuery] string? nameLessThan,
 117        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemSortBy[] sortBy,
 118        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] SortOrder[] sortOrder,
 119        [FromQuery] bool? enableImages = true,
 120        [FromQuery] bool enableTotalRecordCount = true)
 121    {
 0122        userId = RequestHelpers.GetUserId(User, userId);
 0123        var dtoOptions = new DtoOptions { Fields = fields }
 0124            .AddClientFields(User)
 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(CommaDelimitedArrayModelBinder))] ItemFields[] fields,
 299        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] BaseItemKind[] excludeItemTypes,
 300        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] BaseItemKind[] includeItemTypes,
 301        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFilter[] filters,
 302        [FromQuery] bool? isFavorite,
 303        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] MediaType[] mediaTypes,
 304        [FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] genres,
 305        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] genreIds,
 306        [FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] officialRatings,
 307        [FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] tags,
 308        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] int[] years,
 309        [FromQuery] bool? enableUserData,
 310        [FromQuery] int? imageTypeLimit,
 311        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes,
 312        [FromQuery] string? person,
 313        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] personIds,
 314        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] personTypes,
 315        [FromQuery, ModelBinder(typeof(PipeDelimitedArrayModelBinder))] string[] studios,
 316        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] studioIds,
 317        [FromQuery] Guid? userId,
 318        [FromQuery] string? nameStartsWithOrGreater,
 319        [FromQuery] string? nameStartsWith,
 320        [FromQuery] string? nameLessThan,
 321        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemSortBy[] sortBy,
 322        [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] 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            .AddClientFields(User)
 0329            .AddAdditionalDtoOptions(enableImages, enableUserData, imageTypeLimit, enableImageTypes);
 330
 0331        User? user = null;
 0332        BaseItem parentItem = _libraryManager.GetParentItem(parentId, userId);
 333
 0334        if (!userId.IsNullOrEmpty())
 335        {
 0336            user = _userManager.GetUserById(userId.Value);
 337        }
 338
 0339        var query = new InternalItemsQuery(user)
 0340        {
 0341            ExcludeItemTypes = excludeItemTypes,
 0342            IncludeItemTypes = includeItemTypes,
 0343            MediaTypes = mediaTypes,
 0344            StartIndex = startIndex,
 0345            Limit = limit,
 0346            IsFavorite = isFavorite,
 0347            NameLessThan = nameLessThan,
 0348            NameStartsWith = nameStartsWith,
 0349            NameStartsWithOrGreater = nameStartsWithOrGreater,
 0350            Tags = tags,
 0351            OfficialRatings = officialRatings,
 0352            Genres = genres,
 0353            GenreIds = genreIds,
 0354            StudioIds = studioIds,
 0355            Person = person,
 0356            PersonIds = personIds,
 0357            PersonTypes = personTypes,
 0358            Years = years,
 0359            MinCommunityRating = minCommunityRating,
 0360            DtoOptions = dtoOptions,
 0361            SearchTerm = searchTerm,
 0362            EnableTotalRecordCount = enableTotalRecordCount,
 0363            OrderBy = RequestHelpers.GetOrderBy(sortBy, sortOrder)
 0364        };
 365
 0366        if (parentId.HasValue)
 367        {
 0368            if (parentItem is Folder)
 369            {
 0370                query.AncestorIds = new[] { parentId.Value };
 371            }
 372            else
 373            {
 0374                query.ItemIds = new[] { parentId.Value };
 375            }
 376        }
 377
 378        // Studios
 0379        if (studios.Length != 0)
 380        {
 0381            query.StudioIds = studios.Select(i =>
 0382            {
 0383                try
 0384                {
 0385                    return _libraryManager.GetStudio(i);
 0386                }
 0387                catch
 0388                {
 0389                    return null;
 0390                }
 0391            }).Where(i => i is not null).Select(i => i!.Id).ToArray();
 392        }
 393
 0394        foreach (var filter in filters)
 395        {
 396            switch (filter)
 397            {
 398                case ItemFilter.Dislikes:
 0399                    query.IsLiked = false;
 0400                    break;
 401                case ItemFilter.IsFavorite:
 0402                    query.IsFavorite = true;
 0403                    break;
 404                case ItemFilter.IsFavoriteOrLikes:
 0405                    query.IsFavoriteOrLiked = true;
 0406                    break;
 407                case ItemFilter.IsFolder:
 0408                    query.IsFolder = true;
 0409                    break;
 410                case ItemFilter.IsNotFolder:
 0411                    query.IsFolder = false;
 0412                    break;
 413                case ItemFilter.IsPlayed:
 0414                    query.IsPlayed = true;
 0415                    break;
 416                case ItemFilter.IsResumable:
 0417                    query.IsResumable = true;
 0418                    break;
 419                case ItemFilter.IsUnplayed:
 0420                    query.IsPlayed = false;
 0421                    break;
 422                case ItemFilter.Likes:
 0423                    query.IsLiked = true;
 424                    break;
 425            }
 426        }
 427
 0428        var result = _libraryManager.GetAlbumArtists(query);
 429
 0430        var dtos = result.Items.Select(i =>
 0431        {
 0432            var (baseItem, itemCounts) = i;
 0433            var dto = _dtoService.GetItemByNameDto(baseItem, dtoOptions, null, user);
 0434
 0435            if (includeItemTypes.Length != 0)
 0436            {
 0437                dto.ChildCount = itemCounts.ItemCount;
 0438                dto.ProgramCount = itemCounts.ProgramCount;
 0439                dto.SeriesCount = itemCounts.SeriesCount;
 0440                dto.EpisodeCount = itemCounts.EpisodeCount;
 0441                dto.MovieCount = itemCounts.MovieCount;
 0442                dto.TrailerCount = itemCounts.TrailerCount;
 0443                dto.AlbumCount = itemCounts.AlbumCount;
 0444                dto.SongCount = itemCounts.SongCount;
 0445                dto.ArtistCount = itemCounts.ArtistCount;
 0446            }
 0447
 0448            return dto;
 0449        });
 450
 0451        return new QueryResult<BaseItemDto>(
 0452            query.StartIndex,
 0453            result.TotalRecordCount,
 0454            dtos.ToArray());
 455    }
 456
 457    /// <summary>
 458    /// Gets an artist by name.
 459    /// </summary>
 460    /// <param name="name">Studio name.</param>
 461    /// <param name="userId">Optional. Filter by user id, and attach user data.</param>
 462    /// <response code="200">Artist returned.</response>
 463    /// <returns>An <see cref="OkResult"/> containing the artist.</returns>
 464    [HttpGet("{name}")]
 465    [ProducesResponseType(StatusCodes.Status200OK)]
 466    public ActionResult<BaseItemDto> GetArtistByName([FromRoute, Required] string name, [FromQuery] Guid? userId)
 467    {
 0468        userId = RequestHelpers.GetUserId(User, userId);
 0469        var dtoOptions = new DtoOptions().AddClientFields(User);
 470
 0471        var item = _libraryManager.GetArtist(name, dtoOptions);
 472
 0473        if (!userId.IsNullOrEmpty())
 474        {
 0475            var user = _userManager.GetUserById(userId.Value);
 476
 0477            return _dtoService.GetBaseItemDto(item, dtoOptions, user);
 478        }
 479
 0480        return _dtoService.GetBaseItemDto(item, dtoOptions);
 481    }
 482}

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.Data.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.Data.Enums.SortOrder[],System.Nullable`1<System.Boolean>,System.Boolean)
GetArtistByName(System.String,System.Nullable`1<System.Guid>)