aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/UserLibrary/UserLibraryService.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-08-31 10:55:10 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-08-31 10:55:10 -0400
commitcf989d6b265547a0ef0ceec337873c2ef5435841 (patch)
treeec1dd8206e1be479cf1a2a02328e5ef806676b71 /MediaBrowser.Api/UserLibrary/UserLibraryService.cs
parent87d77cdb95aae20ebeed3d0e552344f1e76d3ccd (diff)
adjusted special feature sort order
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/UserLibraryService.cs')
-rw-r--r--MediaBrowser.Api/UserLibrary/UserLibraryService.cs15
1 files changed, 14 insertions, 1 deletions
diff --git a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs
index de25651ed..b80d90e41 100644
--- a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs
+++ b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs
@@ -432,7 +432,20 @@ namespace MediaBrowser.Api.UserLibrary
.RecursiveChildren
.OfType<Episode>()
.Where(i => i.ParentIndexNumber.HasValue && i.ParentIndexNumber.Value == 0)
- .OrderBy(i => i.SortName)
+ .OrderBy(i =>
+ {
+ if (i.PremiereDate.HasValue)
+ {
+ return i.PremiereDate.Value;
+ }
+
+ if (i.ProductionYear.HasValue)
+ {
+ return new DateTime(i.ProductionYear.Value, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+ }
+ return DateTime.MinValue;
+ })
+ .ThenBy(i => i.SortName)
.Select(i => dtoBuilder.GetBaseItemDto(i, fields, user));
return Task.WhenAll(tasks);