aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs')
-rw-r--r--Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs23
1 files changed, 15 insertions, 8 deletions
diff --git a/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs b/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs
index 494668cb9..1b2974c27 100644
--- a/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs
+++ b/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
@@ -16,6 +16,16 @@ namespace Emby.Server.Implementations.Sorting
/// <returns>System.Int32.</returns>
public int Compare(BaseItem x, BaseItem y)
{
+ if (x == null)
+ {
+ throw new ArgumentNullException(nameof(x));
+ }
+
+ if (y == null)
+ {
+ throw new ArgumentNullException(nameof(y));
+ }
+
if (x.PremiereDate.HasValue && y.PremiereDate.HasValue)
{
var val = DateTime.Compare(x.PremiereDate.Value, y.PremiereDate.Value);
@@ -70,7 +80,7 @@ namespace Emby.Server.Implementations.Sorting
return CompareEpisodeToSpecial(y, x) * -1;
}
- private int CompareEpisodeToSpecial(Episode x, Episode y)
+ private static int CompareEpisodeToSpecial(Episode x, Episode y)
{
// http://thetvdb.com/wiki/index.php?title=Special_Episodes
@@ -119,7 +129,7 @@ namespace Emby.Server.Implementations.Sorting
return GetSpecialCompareValue(x).CompareTo(GetSpecialCompareValue(y));
}
- private int GetSpecialCompareValue(Episode item)
+ private static int GetSpecialCompareValue(Episode item)
{
// First sort by season number
// Since there are three sort orders, pad with 9 digits (3 for each, figure 1000 episode buffer should be enough)
@@ -140,7 +150,7 @@ namespace Emby.Server.Implementations.Sorting
return val;
}
- private int CompareEpisodes(Episode x, Episode y)
+ private static int CompareEpisodes(Episode x, Episode y)
{
var xValue = (x.ParentIndexNumber ?? -1) * 1000 + (x.IndexNumber ?? -1);
var yValue = (y.ParentIndexNumber ?? -1) * 1000 + (y.IndexNumber ?? -1);
@@ -152,9 +162,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.AiredEpisodeOrder; }
- }
+ public string Name => ItemSortBy.AiredEpisodeOrder;
}
}