ArtistsController.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. using System;
  2. using System.ComponentModel.DataAnnotations;
  3. using System.Linq;
  4. using Jellyfin.Api.Constants;
  5. using Jellyfin.Api.Extensions;
  6. using Jellyfin.Api.Helpers;
  7. using Jellyfin.Api.ModelBinders;
  8. using Jellyfin.Data.Entities;
  9. using MediaBrowser.Controller.Dto;
  10. using MediaBrowser.Controller.Entities;
  11. using MediaBrowser.Controller.Library;
  12. using MediaBrowser.Model.Dto;
  13. using MediaBrowser.Model.Entities;
  14. using MediaBrowser.Model.Querying;
  15. using Microsoft.AspNetCore.Authorization;
  16. using Microsoft.AspNetCore.Http;
  17. using Microsoft.AspNetCore.Mvc;
  18. namespace Jellyfin.Api.Controllers
  19. {
  20. /// <summary>
  21. /// The artists controller.
  22. /// </summary>
  23. [Route("Artists")]
  24. [Authorize(Policy = Policies.DefaultAuthorization)]
  25. public class ArtistsController : BaseJellyfinApiController
  26. {
  27. private readonly ILibraryManager _libraryManager;
  28. private readonly IUserManager _userManager;
  29. private readonly IDtoService _dtoService;
  30. /// <summary>
  31. /// Initializes a new instance of the <see cref="ArtistsController"/> class.
  32. /// </summary>
  33. /// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param>
  34. /// <param name="userManager">Instance of the <see cref="IUserManager"/> interface.</param>
  35. /// <param name="dtoService">Instance of the <see cref="IDtoService"/> interface.</param>
  36. public ArtistsController(
  37. ILibraryManager libraryManager,
  38. IUserManager userManager,
  39. IDtoService dtoService)
  40. {
  41. _libraryManager = libraryManager;
  42. _userManager = userManager;
  43. _dtoService = dtoService;
  44. }
  45. /// <summary>
  46. /// Gets all artists from a given item, folder, or the entire library.
  47. /// </summary>
  48. /// <param name="minCommunityRating">Optional filter by minimum community rating.</param>
  49. /// <param name="startIndex">Optional. The record index to start at. All items with a lower index will be dropped from the results.</param>
  50. /// <param name="limit">Optional. The maximum number of records to return.</param>
  51. /// <param name="searchTerm">Optional. Search term.</param>
  52. /// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</param>
  53. /// <param name="fields">Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines.</param>
  54. /// <param name="excludeItemTypes">Optional. If specified, results will be filtered out based on item type. This allows multiple, comma delimited.</param>
  55. /// <param name="includeItemTypes">Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimited.</param>
  56. /// <param name="filters">Optional. Specify additional filters to apply.</param>
  57. /// <param name="isFavorite">Optional filter by items that are marked as favorite, or not.</param>
  58. /// <param name="mediaTypes">Optional filter by MediaType. Allows multiple, comma delimited.</param>
  59. /// <param name="genres">Optional. If specified, results will be filtered based on genre. This allows multiple, pipe delimited.</param>
  60. /// <param name="genreIds">Optional. If specified, results will be filtered based on genre id. This allows multiple, pipe delimited.</param>
  61. /// <param name="officialRatings">Optional. If specified, results will be filtered based on OfficialRating. This allows multiple, pipe delimited.</param>
  62. /// <param name="tags">Optional. If specified, results will be filtered based on tag. This allows multiple, pipe delimited.</param>
  63. /// <param name="years">Optional. If specified, results will be filtered based on production year. This allows multiple, comma delimited.</param>
  64. /// <param name="enableUserData">Optional, include user data.</param>
  65. /// <param name="imageTypeLimit">Optional, the max number of images to return, per image type.</param>
  66. /// <param name="enableImageTypes">Optional. The image types to include in the output.</param>
  67. /// <param name="person">Optional. If specified, results will be filtered to include only those containing the specified person.</param>
  68. /// <param name="personIds">Optional. If specified, results will be filtered to include only those containing the specified person ids.</param>
  69. /// <param name="personTypes">Optional. If specified, along with Person, results will be filtered to include only those containing the specified person and PersonType. Allows multiple, comma-delimited.</param>
  70. /// <param name="studios">Optional. If specified, results will be filtered based on studio. This allows multiple, pipe delimited.</param>
  71. /// <param name="studioIds">Optional. If specified, results will be filtered based on studio id. This allows multiple, pipe delimited.</param>
  72. /// <param name="userId">User id.</param>
  73. /// <param name="nameStartsWithOrGreater">Optional filter by items whose name is sorted equally or greater than a given input string.</param>
  74. /// <param name="nameStartsWith">Optional filter by items whose name is sorted equally than a given input string.</param>
  75. /// <param name="nameLessThan">Optional filter by items whose name is equally or lesser than a given input string.</param>
  76. /// <param name="enableImages">Optional, include image information in output.</param>
  77. /// <param name="enableTotalRecordCount">Total record count.</param>
  78. /// <response code="200">Artists returned.</response>
  79. /// <returns>An <see cref="OkResult"/> containing the artists.</returns>
  80. [HttpGet]
  81. [ProducesResponseType(StatusCodes.Status200OK)]
  82. public ActionResult<QueryResult<BaseItemDto>> GetArtists(
  83. [FromQuery] double? minCommunityRating,
  84. [FromQuery] int? startIndex,
  85. [FromQuery] int? limit,
  86. [FromQuery] string? searchTerm,
  87. [FromQuery] string? parentId,
  88. [FromQuery] string? fields,
  89. [FromQuery] string? excludeItemTypes,
  90. [FromQuery] string? includeItemTypes,
  91. [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFilter[] filters,
  92. [FromQuery] bool? isFavorite,
  93. [FromQuery] string? mediaTypes,
  94. [FromQuery] string? genres,
  95. [FromQuery] string? genreIds,
  96. [FromQuery] string? officialRatings,
  97. [FromQuery] string? tags,
  98. [FromQuery] string? years,
  99. [FromQuery] bool? enableUserData,
  100. [FromQuery] int? imageTypeLimit,
  101. [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes,
  102. [FromQuery] string? person,
  103. [FromQuery] string? personIds,
  104. [FromQuery] string? personTypes,
  105. [FromQuery] string? studios,
  106. [FromQuery] string? studioIds,
  107. [FromQuery] Guid? userId,
  108. [FromQuery] string? nameStartsWithOrGreater,
  109. [FromQuery] string? nameStartsWith,
  110. [FromQuery] string? nameLessThan,
  111. [FromQuery] bool? enableImages = true,
  112. [FromQuery] bool enableTotalRecordCount = true)
  113. {
  114. var dtoOptions = new DtoOptions()
  115. .AddItemFields(fields)
  116. .AddClientFields(Request)
  117. .AddAdditionalDtoOptions(enableImages, enableUserData, imageTypeLimit, enableImageTypes);
  118. User? user = null;
  119. BaseItem parentItem;
  120. if (userId.HasValue && !userId.Equals(Guid.Empty))
  121. {
  122. user = _userManager.GetUserById(userId.Value);
  123. parentItem = string.IsNullOrEmpty(parentId) ? _libraryManager.GetUserRootFolder() : _libraryManager.GetItemById(parentId);
  124. }
  125. else
  126. {
  127. parentItem = string.IsNullOrEmpty(parentId) ? _libraryManager.RootFolder : _libraryManager.GetItemById(parentId);
  128. }
  129. var excludeItemTypesArr = RequestHelpers.Split(excludeItemTypes, ',', true);
  130. var includeItemTypesArr = RequestHelpers.Split(includeItemTypes, ',', true);
  131. var mediaTypesArr = RequestHelpers.Split(mediaTypes, ',', true);
  132. var query = new InternalItemsQuery(user)
  133. {
  134. ExcludeItemTypes = excludeItemTypesArr,
  135. IncludeItemTypes = includeItemTypesArr,
  136. MediaTypes = mediaTypesArr,
  137. StartIndex = startIndex,
  138. Limit = limit,
  139. IsFavorite = isFavorite,
  140. NameLessThan = nameLessThan,
  141. NameStartsWith = nameStartsWith,
  142. NameStartsWithOrGreater = nameStartsWithOrGreater,
  143. Tags = RequestHelpers.Split(tags, '|', true),
  144. OfficialRatings = RequestHelpers.Split(officialRatings, '|', true),
  145. Genres = RequestHelpers.Split(genres, '|', true),
  146. GenreIds = RequestHelpers.GetGuids(genreIds),
  147. StudioIds = RequestHelpers.GetGuids(studioIds),
  148. Person = person,
  149. PersonIds = RequestHelpers.GetGuids(personIds),
  150. PersonTypes = RequestHelpers.Split(personTypes, ',', true),
  151. Years = RequestHelpers.Split(years, ',', true).Select(int.Parse).ToArray(),
  152. MinCommunityRating = minCommunityRating,
  153. DtoOptions = dtoOptions,
  154. SearchTerm = searchTerm,
  155. EnableTotalRecordCount = enableTotalRecordCount
  156. };
  157. if (!string.IsNullOrWhiteSpace(parentId))
  158. {
  159. if (parentItem is Folder)
  160. {
  161. query.AncestorIds = new[] { new Guid(parentId) };
  162. }
  163. else
  164. {
  165. query.ItemIds = new[] { new Guid(parentId) };
  166. }
  167. }
  168. // Studios
  169. if (!string.IsNullOrEmpty(studios))
  170. {
  171. query.StudioIds = studios.Split('|').Select(i =>
  172. {
  173. try
  174. {
  175. return _libraryManager.GetStudio(i);
  176. }
  177. catch
  178. {
  179. return null;
  180. }
  181. }).Where(i => i != null).Select(i => i!.Id).ToArray();
  182. }
  183. foreach (var filter in filters)
  184. {
  185. switch (filter)
  186. {
  187. case ItemFilter.Dislikes:
  188. query.IsLiked = false;
  189. break;
  190. case ItemFilter.IsFavorite:
  191. query.IsFavorite = true;
  192. break;
  193. case ItemFilter.IsFavoriteOrLikes:
  194. query.IsFavoriteOrLiked = true;
  195. break;
  196. case ItemFilter.IsFolder:
  197. query.IsFolder = true;
  198. break;
  199. case ItemFilter.IsNotFolder:
  200. query.IsFolder = false;
  201. break;
  202. case ItemFilter.IsPlayed:
  203. query.IsPlayed = true;
  204. break;
  205. case ItemFilter.IsResumable:
  206. query.IsResumable = true;
  207. break;
  208. case ItemFilter.IsUnplayed:
  209. query.IsPlayed = false;
  210. break;
  211. case ItemFilter.Likes:
  212. query.IsLiked = true;
  213. break;
  214. }
  215. }
  216. var result = _libraryManager.GetArtists(query);
  217. var dtos = result.Items.Select(i =>
  218. {
  219. var (baseItem, itemCounts) = i;
  220. var dto = _dtoService.GetItemByNameDto(baseItem, dtoOptions, null, user);
  221. if (!string.IsNullOrWhiteSpace(includeItemTypes))
  222. {
  223. dto.ChildCount = itemCounts.ItemCount;
  224. dto.ProgramCount = itemCounts.ProgramCount;
  225. dto.SeriesCount = itemCounts.SeriesCount;
  226. dto.EpisodeCount = itemCounts.EpisodeCount;
  227. dto.MovieCount = itemCounts.MovieCount;
  228. dto.TrailerCount = itemCounts.TrailerCount;
  229. dto.AlbumCount = itemCounts.AlbumCount;
  230. dto.SongCount = itemCounts.SongCount;
  231. dto.ArtistCount = itemCounts.ArtistCount;
  232. }
  233. return dto;
  234. });
  235. return new QueryResult<BaseItemDto>
  236. {
  237. Items = dtos.ToArray(),
  238. TotalRecordCount = result.TotalRecordCount
  239. };
  240. }
  241. /// <summary>
  242. /// Gets all album artists from a given item, folder, or the entire library.
  243. /// </summary>
  244. /// <param name="minCommunityRating">Optional filter by minimum community rating.</param>
  245. /// <param name="startIndex">Optional. The record index to start at. All items with a lower index will be dropped from the results.</param>
  246. /// <param name="limit">Optional. The maximum number of records to return.</param>
  247. /// <param name="searchTerm">Optional. Search term.</param>
  248. /// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</param>
  249. /// <param name="fields">Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines.</param>
  250. /// <param name="excludeItemTypes">Optional. If specified, results will be filtered out based on item type. This allows multiple, comma delimited.</param>
  251. /// <param name="includeItemTypes">Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimited.</param>
  252. /// <param name="filters">Optional. Specify additional filters to apply.</param>
  253. /// <param name="isFavorite">Optional filter by items that are marked as favorite, or not.</param>
  254. /// <param name="mediaTypes">Optional filter by MediaType. Allows multiple, comma delimited.</param>
  255. /// <param name="genres">Optional. If specified, results will be filtered based on genre. This allows multiple, pipe delimited.</param>
  256. /// <param name="genreIds">Optional. If specified, results will be filtered based on genre id. This allows multiple, pipe delimited.</param>
  257. /// <param name="officialRatings">Optional. If specified, results will be filtered based on OfficialRating. This allows multiple, pipe delimited.</param>
  258. /// <param name="tags">Optional. If specified, results will be filtered based on tag. This allows multiple, pipe delimited.</param>
  259. /// <param name="years">Optional. If specified, results will be filtered based on production year. This allows multiple, comma delimited.</param>
  260. /// <param name="enableUserData">Optional, include user data.</param>
  261. /// <param name="imageTypeLimit">Optional, the max number of images to return, per image type.</param>
  262. /// <param name="enableImageTypes">Optional. The image types to include in the output.</param>
  263. /// <param name="person">Optional. If specified, results will be filtered to include only those containing the specified person.</param>
  264. /// <param name="personIds">Optional. If specified, results will be filtered to include only those containing the specified person ids.</param>
  265. /// <param name="personTypes">Optional. If specified, along with Person, results will be filtered to include only those containing the specified person and PersonType. Allows multiple, comma-delimited.</param>
  266. /// <param name="studios">Optional. If specified, results will be filtered based on studio. This allows multiple, pipe delimited.</param>
  267. /// <param name="studioIds">Optional. If specified, results will be filtered based on studio id. This allows multiple, pipe delimited.</param>
  268. /// <param name="userId">User id.</param>
  269. /// <param name="nameStartsWithOrGreater">Optional filter by items whose name is sorted equally or greater than a given input string.</param>
  270. /// <param name="nameStartsWith">Optional filter by items whose name is sorted equally than a given input string.</param>
  271. /// <param name="nameLessThan">Optional filter by items whose name is equally or lesser than a given input string.</param>
  272. /// <param name="enableImages">Optional, include image information in output.</param>
  273. /// <param name="enableTotalRecordCount">Total record count.</param>
  274. /// <response code="200">Album artists returned.</response>
  275. /// <returns>An <see cref="OkResult"/> containing the album artists.</returns>
  276. [HttpGet("AlbumArtists")]
  277. [ProducesResponseType(StatusCodes.Status200OK)]
  278. public ActionResult<QueryResult<BaseItemDto>> GetAlbumArtists(
  279. [FromQuery] double? minCommunityRating,
  280. [FromQuery] int? startIndex,
  281. [FromQuery] int? limit,
  282. [FromQuery] string? searchTerm,
  283. [FromQuery] string? parentId,
  284. [FromQuery] string? fields,
  285. [FromQuery] string? excludeItemTypes,
  286. [FromQuery] string? includeItemTypes,
  287. [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFilter[] filters,
  288. [FromQuery] bool? isFavorite,
  289. [FromQuery] string? mediaTypes,
  290. [FromQuery] string? genres,
  291. [FromQuery] string? genreIds,
  292. [FromQuery] string? officialRatings,
  293. [FromQuery] string? tags,
  294. [FromQuery] string? years,
  295. [FromQuery] bool? enableUserData,
  296. [FromQuery] int? imageTypeLimit,
  297. [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes,
  298. [FromQuery] string? person,
  299. [FromQuery] string? personIds,
  300. [FromQuery] string? personTypes,
  301. [FromQuery] string? studios,
  302. [FromQuery] string? studioIds,
  303. [FromQuery] Guid? userId,
  304. [FromQuery] string? nameStartsWithOrGreater,
  305. [FromQuery] string? nameStartsWith,
  306. [FromQuery] string? nameLessThan,
  307. [FromQuery] bool? enableImages = true,
  308. [FromQuery] bool enableTotalRecordCount = true)
  309. {
  310. var dtoOptions = new DtoOptions()
  311. .AddItemFields(fields)
  312. .AddClientFields(Request)
  313. .AddAdditionalDtoOptions(enableImages, enableUserData, imageTypeLimit, enableImageTypes);
  314. User? user = null;
  315. BaseItem parentItem;
  316. if (userId.HasValue && !userId.Equals(Guid.Empty))
  317. {
  318. user = _userManager.GetUserById(userId.Value);
  319. parentItem = string.IsNullOrEmpty(parentId) ? _libraryManager.GetUserRootFolder() : _libraryManager.GetItemById(parentId);
  320. }
  321. else
  322. {
  323. parentItem = string.IsNullOrEmpty(parentId) ? _libraryManager.RootFolder : _libraryManager.GetItemById(parentId);
  324. }
  325. var excludeItemTypesArr = RequestHelpers.Split(excludeItemTypes, ',', true);
  326. var includeItemTypesArr = RequestHelpers.Split(includeItemTypes, ',', true);
  327. var mediaTypesArr = RequestHelpers.Split(mediaTypes, ',', true);
  328. var query = new InternalItemsQuery(user)
  329. {
  330. ExcludeItemTypes = excludeItemTypesArr,
  331. IncludeItemTypes = includeItemTypesArr,
  332. MediaTypes = mediaTypesArr,
  333. StartIndex = startIndex,
  334. Limit = limit,
  335. IsFavorite = isFavorite,
  336. NameLessThan = nameLessThan,
  337. NameStartsWith = nameStartsWith,
  338. NameStartsWithOrGreater = nameStartsWithOrGreater,
  339. Tags = RequestHelpers.Split(tags, '|', true),
  340. OfficialRatings = RequestHelpers.Split(officialRatings, '|', true),
  341. Genres = RequestHelpers.Split(genres, '|', true),
  342. GenreIds = RequestHelpers.GetGuids(genreIds),
  343. StudioIds = RequestHelpers.GetGuids(studioIds),
  344. Person = person,
  345. PersonIds = RequestHelpers.GetGuids(personIds),
  346. PersonTypes = RequestHelpers.Split(personTypes, ',', true),
  347. Years = RequestHelpers.Split(years, ',', true).Select(int.Parse).ToArray(),
  348. MinCommunityRating = minCommunityRating,
  349. DtoOptions = dtoOptions,
  350. SearchTerm = searchTerm,
  351. EnableTotalRecordCount = enableTotalRecordCount
  352. };
  353. if (!string.IsNullOrWhiteSpace(parentId))
  354. {
  355. if (parentItem is Folder)
  356. {
  357. query.AncestorIds = new[] { new Guid(parentId) };
  358. }
  359. else
  360. {
  361. query.ItemIds = new[] { new Guid(parentId) };
  362. }
  363. }
  364. // Studios
  365. if (!string.IsNullOrEmpty(studios))
  366. {
  367. query.StudioIds = studios.Split('|').Select(i =>
  368. {
  369. try
  370. {
  371. return _libraryManager.GetStudio(i);
  372. }
  373. catch
  374. {
  375. return null;
  376. }
  377. }).Where(i => i != null).Select(i => i!.Id).ToArray();
  378. }
  379. foreach (var filter in filters)
  380. {
  381. switch (filter)
  382. {
  383. case ItemFilter.Dislikes:
  384. query.IsLiked = false;
  385. break;
  386. case ItemFilter.IsFavorite:
  387. query.IsFavorite = true;
  388. break;
  389. case ItemFilter.IsFavoriteOrLikes:
  390. query.IsFavoriteOrLiked = true;
  391. break;
  392. case ItemFilter.IsFolder:
  393. query.IsFolder = true;
  394. break;
  395. case ItemFilter.IsNotFolder:
  396. query.IsFolder = false;
  397. break;
  398. case ItemFilter.IsPlayed:
  399. query.IsPlayed = true;
  400. break;
  401. case ItemFilter.IsResumable:
  402. query.IsResumable = true;
  403. break;
  404. case ItemFilter.IsUnplayed:
  405. query.IsPlayed = false;
  406. break;
  407. case ItemFilter.Likes:
  408. query.IsLiked = true;
  409. break;
  410. }
  411. }
  412. var result = _libraryManager.GetAlbumArtists(query);
  413. var dtos = result.Items.Select(i =>
  414. {
  415. var (baseItem, itemCounts) = i;
  416. var dto = _dtoService.GetItemByNameDto(baseItem, dtoOptions, null, user);
  417. if (!string.IsNullOrWhiteSpace(includeItemTypes))
  418. {
  419. dto.ChildCount = itemCounts.ItemCount;
  420. dto.ProgramCount = itemCounts.ProgramCount;
  421. dto.SeriesCount = itemCounts.SeriesCount;
  422. dto.EpisodeCount = itemCounts.EpisodeCount;
  423. dto.MovieCount = itemCounts.MovieCount;
  424. dto.TrailerCount = itemCounts.TrailerCount;
  425. dto.AlbumCount = itemCounts.AlbumCount;
  426. dto.SongCount = itemCounts.SongCount;
  427. dto.ArtistCount = itemCounts.ArtistCount;
  428. }
  429. return dto;
  430. });
  431. return new QueryResult<BaseItemDto>
  432. {
  433. Items = dtos.ToArray(),
  434. TotalRecordCount = result.TotalRecordCount
  435. };
  436. }
  437. /// <summary>
  438. /// Gets an artist by name.
  439. /// </summary>
  440. /// <param name="name">Studio name.</param>
  441. /// <param name="userId">Optional. Filter by user id, and attach user data.</param>
  442. /// <response code="200">Artist returned.</response>
  443. /// <returns>An <see cref="OkResult"/> containing the artist.</returns>
  444. [HttpGet("{name}")]
  445. [ProducesResponseType(StatusCodes.Status200OK)]
  446. public ActionResult<BaseItemDto> GetArtistByName([FromRoute, Required] string name, [FromQuery] Guid? userId)
  447. {
  448. var dtoOptions = new DtoOptions().AddClientFields(Request);
  449. var item = _libraryManager.GetArtist(name, dtoOptions);
  450. if (userId.HasValue && !userId.Equals(Guid.Empty))
  451. {
  452. var user = _userManager.GetUserById(userId.Value);
  453. return _dtoService.GetBaseItemDto(item, dtoOptions, user);
  454. }
  455. return _dtoService.GetBaseItemDto(item, dtoOptions);
  456. }
  457. }
  458. }