| | | 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 CommunityRatingComparer : IBaseItemComparer |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Gets the name. |
| | | 15 | | /// </summary> |
| | | 16 | | /// <value>The name.</value> |
| | 1 | 17 | | public ItemSortBy Type => ItemSortBy.CommunityRating; |
| | | 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 | | ArgumentNullException.ThrowIfNull(x); |
| | | 28 | | |
| | 0 | 29 | | ArgumentNullException.ThrowIfNull(y); |
| | | 30 | | |
| | 0 | 31 | | return (x.CommunityRating ?? 0).CompareTo(y.CommunityRating ?? 0); |
| | | 32 | | } |
| | | 33 | | } |
| | | 34 | | } |