CommunityRatingComparer.cs 817 B

1234567891011121314151617181920212223242526272829
  1. using MediaBrowser.Controller.Entities;
  2. using MediaBrowser.Controller.Sorting;
  3. using MediaBrowser.Model.Querying;
  4. namespace Emby.Server.Implementations.Sorting
  5. {
  6. public class CommunityRatingComparer : IBaseItemComparer
  7. {
  8. /// <summary>
  9. /// Compares the specified x.
  10. /// </summary>
  11. /// <param name="x">The x.</param>
  12. /// <param name="y">The y.</param>
  13. /// <returns>System.Int32.</returns>
  14. public int Compare(BaseItem x, BaseItem y)
  15. {
  16. return (x.CommunityRating ?? 0).CompareTo(y.CommunityRating ?? 0);
  17. }
  18. /// <summary>
  19. /// Gets the name.
  20. /// </summary>
  21. /// <value>The name.</value>
  22. public string Name
  23. {
  24. get { return ItemSortBy.CommunityRating; }
  25. }
  26. }
  27. }