StudioComparer.cs 962 B

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