aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/UserLibrary/ItemsService.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-09-07 14:18:09 -0400
committerGitHub <noreply@github.com>2017-09-07 14:18:09 -0400
commit890069d312d3132391edf857730ffc9a34c9fce4 (patch)
treea46e31f6f2d155411a24e4ff3685013512a078e9 /MediaBrowser.Api/UserLibrary/ItemsService.cs
parent5116b175ce4a1f3a54c64c6f8fa8e8fba1a69e1a (diff)
parent6392f5e141b9971f7d69cc74e08118889d6d5580 (diff)
Merge pull request #2869 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/ItemsService.cs')
-rw-r--r--MediaBrowser.Api/UserLibrary/ItemsService.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs
index fb48f65e4..5919c50d4 100644
--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs
+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs
@@ -408,6 +408,20 @@ namespace MediaBrowser.Api.UserLibrary
}).Where(i => i != null).Select(i => i.Id.ToString("N")).ToArray();
}
+ // Apply default sorting if none requested
+ if (query.OrderBy.Length == 0)
+ {
+ // Albums by artist
+ if (query.ArtistIds.Length > 0 && query.IncludeItemTypes.Length == 1 && string.Equals(query.IncludeItemTypes[0], "MusicAlbum", StringComparison.OrdinalIgnoreCase))
+ {
+ query.OrderBy = new Tuple<string, SortOrder>[]
+ {
+ new Tuple<string, SortOrder>(ItemSortBy.ProductionYear, SortOrder.Descending),
+ new Tuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Ascending)
+ };
+ }
+ }
+
return query;
}
}