diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2019-01-13 12:14:53 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-13 12:14:53 -0500 |
| commit | 9dcaafe700b7130b49bafbadf0d47b37c6ecf53b (patch) | |
| tree | 6ca1b2b3decac1a86b886dafd2645954a13601fd /Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs | |
| parent | 17d8de4962ea9d78f6ddb557fe26465be1944b38 (diff) | |
| parent | b936c439321b55bf89c99dac96fc78cefe752e84 (diff) | |
Merge pull request #458 from EraYaN/code-cleanup
Clean up several minor issues and add TODOs
Diffstat (limited to 'Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs')
| -rw-r--r-- | Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs | 23 |
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; } } |
