StudioComparer.cs 880 B

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