From 8fe7dfd4ce39d4bb3d9a96e3ada8783c26e291a2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 11 Apr 2013 23:50:47 -0400 Subject: added people pages --- MediaBrowser.Api/UserLibrary/ItemsService.cs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Api/UserLibrary/ItemsService.cs') diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 6a86c27f0..dc29ba341 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -25,6 +25,13 @@ namespace MediaBrowser.Api.UserLibrary [ApiMember(Name = "Person", Description = "Optional. If specified, results will be filtered to include only those containing the specified person.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string Person { get; set; } + /// + /// What to sort the results by + /// + /// The sort by. + [ApiMember(Name = "SortBy", Description = "Optional. Specify one or more sort orders, comma delimeted. Options: Album, AlbumArtist, Artist, CommunityRating, DateCreated, DatePlayed, PlayCount, PremiereDate, ProductionYear, SortName, Random, Runtime", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + public string SortBy { get; set; } + /// /// If the Person filter is used, this can also be used to restrict to a specific person type /// @@ -114,6 +121,22 @@ namespace MediaBrowser.Api.UserLibrary /// The air days. [ApiMember(Name = "AirDays", Description = "Optional filter by Series Air Days. Allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string AirDays { get; set; } + + /// + /// Gets the order by. + /// + /// IEnumerable{ItemSortBy}. + public IEnumerable GetOrderBy() + { + var val = SortBy; + + if (string.IsNullOrEmpty(val)) + { + return new string[] { }; + } + + return val.Split(','); + } } /// @@ -238,7 +261,7 @@ namespace MediaBrowser.Api.UserLibrary /// The user. /// The library manager. /// IEnumerable{BaseItem}. - internal static IEnumerable ApplySortOrder(BaseItemsRequest request, IEnumerable items, User user, ILibraryManager libraryManager) + internal static IEnumerable ApplySortOrder(GetItems request, IEnumerable items, User user, ILibraryManager libraryManager) { var orderBy = request.GetOrderBy().ToArray(); -- cgit v1.2.3