Merge pull request #7894 from crobibero/search-hints
(cherry picked from commit 0f75f17736
)
Signed-off-by: crobibero <cody@robibe.ro>
This commit is contained in:
parent
b35d608b19
commit
e4b095a766
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||
using Jellyfin.Api.Constants;
|
||||
using Jellyfin.Api.ModelBinders;
|
||||
using Jellyfin.Data.Enums;
|
||||
using Jellyfin.Extensions;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
@ -187,7 +188,7 @@ namespace Jellyfin.Api.Controllers
|
|||
result.AlbumArtist = album.AlbumArtist;
|
||||
break;
|
||||
case Audio song:
|
||||
result.AlbumArtist = song.AlbumArtists?[0];
|
||||
result.AlbumArtist = song.AlbumArtists?.FirstOrDefault();
|
||||
result.Artists = song.Artists;
|
||||
|
||||
MusicAlbum musicAlbum = song.AlbumEntity;
|
||||
|
|
|
@ -57,5 +57,21 @@ namespace Jellyfin.Extensions
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the first or default item from a list.
|
||||
/// </summary>
|
||||
/// <param name="source">The source list.</param>
|
||||
/// <typeparam name="T">The type of item.</typeparam>
|
||||
/// <returns>The first item or default if list is empty.</returns>
|
||||
public static T? FirstOrDefault<T>(this IReadOnlyList<T>? source)
|
||||
{
|
||||
if (source is null || source.Count == 0)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
return source[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user