| | | 1 | | #pragma warning disable CS1591 |
| | | 2 | | |
| | | 3 | | using System; |
| | | 4 | | using Jellyfin.Data.Enums; |
| | | 5 | | using MediaBrowser.Controller.Entities; |
| | | 6 | | using MediaBrowser.Controller.Sorting; |
| | | 7 | | using MediaBrowser.Model.Querying; |
| | | 8 | | |
| | | 9 | | namespace Emby.Server.Implementations.Sorting |
| | | 10 | | { |
| | | 11 | | public class SeriesSortNameComparer : IBaseItemComparer |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Gets the name. |
| | | 15 | | /// </summary> |
| | | 16 | | /// <value>The name.</value> |
| | 1 | 17 | | public ItemSortBy Type => ItemSortBy.SeriesSortName; |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Compares the specified x. |
| | | 21 | | /// </summary> |
| | | 22 | | /// <param name="x">The x.</param> |
| | | 23 | | /// <param name="y">The y.</param> |
| | | 24 | | /// <returns>System.Int32.</returns> |
| | | 25 | | public int Compare(BaseItem? x, BaseItem? y) |
| | | 26 | | { |
| | 0 | 27 | | return string.Compare(GetValue(x), GetValue(y), StringComparison.OrdinalIgnoreCase); |
| | | 28 | | } |
| | | 29 | | |
| | | 30 | | private static string? GetValue(BaseItem? item) |
| | | 31 | | { |
| | 0 | 32 | | var hasSeries = item as IHasSeries; |
| | 0 | 33 | | return hasSeries?.FindSeriesSortName(); |
| | | 34 | | } |
| | | 35 | | } |
| | | 36 | | } |