StudioComparer.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #nullable disable
  2. #pragma warning disable CS1591
  3. using System;
  4. using Jellyfin.Extensions;
  5. using MediaBrowser.Controller.Entities;
  6. using MediaBrowser.Controller.Sorting;
  7. using MediaBrowser.Model.Querying;
  8. namespace Emby.Server.Implementations.Sorting
  9. {
  10. public class StudioComparer : IBaseItemComparer
  11. {
  12. /// <summary>
  13. /// Gets the name.
  14. /// </summary>
  15. /// <value>The name.</value>
  16. public string Name => ItemSortBy.Studio;
  17. /// <summary>
  18. /// Compares the specified x.
  19. /// </summary>
  20. /// <param name="x">The x.</param>
  21. /// <param name="y">The y.</param>
  22. /// <returns>System.Int32.</returns>
  23. public int Compare(BaseItem x, BaseItem y)
  24. {
  25. if (x == null)
  26. {
  27. throw new ArgumentNullException(nameof(x));
  28. }
  29. if (y == null)
  30. {
  31. throw new ArgumentNullException(nameof(y));
  32. }
  33. return AlphanumericComparator.CompareValues(x.Studios.FirstOrDefault(), y.Studios.FirstOrDefault());
  34. }
  35. }
  36. }