StudioComparer.cs 993 B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma warning disable CS1591
  2. using System;
  3. using Jellyfin.Data.Enums;
  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 ItemSortBy Type => 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. ArgumentNullException.ThrowIfNull(x);
  26. ArgumentNullException.ThrowIfNull(y);
  27. return AlphanumericComparator.CompareValues(x.Studios.FirstOrDefault(), y.Studios.FirstOrDefault());
  28. }
  29. }
  30. }