aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Sorting/ArtistComparer.cs
diff options
context:
space:
mode:
authorWWWesten <4700006+WWWesten@users.noreply.github.com>2021-11-01 23:43:29 +0500
committerGitHub <noreply@github.com>2021-11-01 23:43:29 +0500
commit0a14279e2a21bcb9654a06a2d49e1e4f0cc5329c (patch)
treee1b1bd603b011ca98e5793e356326bf4a35a7050 /Emby.Server.Implementations/Sorting/ArtistComparer.cs
parentf2817fef743eeb75a00782ceea363b2d3e7dc9f2 (diff)
parent76eeb8f655424d295e73ced8349c6fefee6ddb12 (diff)
Merge branch 'jellyfin:master' into master
Diffstat (limited to 'Emby.Server.Implementations/Sorting/ArtistComparer.cs')
-rw-r--r--Emby.Server.Implementations/Sorting/ArtistComparer.cs28
1 files changed, 9 insertions, 19 deletions
diff --git a/Emby.Server.Implementations/Sorting/ArtistComparer.cs b/Emby.Server.Implementations/Sorting/ArtistComparer.cs
index 9d5befc9a..7b7ba5753 100644
--- a/Emby.Server.Implementations/Sorting/ArtistComparer.cs
+++ b/Emby.Server.Implementations/Sorting/ArtistComparer.cs
@@ -7,17 +7,15 @@ using MediaBrowser.Model.Querying;
namespace Emby.Server.Implementations.Sorting
{
/// <summary>
- /// Class ArtistComparer
+ /// Class ArtistComparer.
/// </summary>
public class ArtistComparer : IBaseItemComparer
{
- /// <summary>
- /// Compares the specified x.
- /// </summary>
- /// <param name="x">The x.</param>
- /// <param name="y">The y.</param>
- /// <returns>System.Int32.</returns>
- public int Compare(BaseItem x, BaseItem y)
+ /// <inheritdoc />
+ public string Name => ItemSortBy.Artist;
+
+ /// <inheritdoc />
+ public int Compare(BaseItem? x, BaseItem? y)
{
return string.Compare(GetValue(x), GetValue(y), StringComparison.CurrentCultureIgnoreCase);
}
@@ -27,22 +25,14 @@ namespace Emby.Server.Implementations.Sorting
/// </summary>
/// <param name="x">The x.</param>
/// <returns>System.String.</returns>
- private static string GetValue(BaseItem x)
+ private static string? GetValue(BaseItem? x)
{
- var audio = x as Audio;
-
- if (audio == null)
+ if (x is not Audio audio)
{
return string.Empty;
}
- return audio.Artists.Length == 0 ? null : audio.Artists[0];
+ return audio.Artists.Count == 0 ? null : audio.Artists[0];
}
-
- /// <summary>
- /// Gets the name.
- /// </summary>
- /// <value>The name.</value>
- public string Name => ItemSortBy.Artist;
}
}