aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/UserLibrary/ItemsService.cs
diff options
context:
space:
mode:
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;
}
}