fixes #530 - Add ability to sort movie genres/studios/people by movie or trailer count

This commit is contained in:
Luke Pulverenti
2013-09-10 15:57:38 -04:00
parent 9d7b3fdda6
commit 06298d489c
14 changed files with 212 additions and 133 deletions

View File

@@ -86,6 +86,13 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "ImageTypes", Description = "Optional. If specified, results will be filtered based on those containing image types. This allows multiple, comma delimited.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string ImageTypes { get; set; }
/// <summary>
/// What to sort the results by
/// </summary>
/// <value>The sort by.</value>
[ApiMember(Name = "SortBy", Description = "Optional. Specify one or more sort orders, comma delimeted. Options: Album, AlbumArtist, Artist, Budget, CommunityRating, CriticRating, DateCreated, DatePlayed, PlayCount, PremiereDate, ProductionYear, SortName, Random, Revenue, Runtime", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string SortBy { get; set; }
/// <summary>
/// Gets the filters.
/// </summary>
@@ -143,5 +150,21 @@ namespace MediaBrowser.Api.UserLibrary
return val.Split(',').Select(v => (ImageType)Enum.Parse(typeof(ImageType), v, true));
}
/// <summary>
/// Gets the order by.
/// </summary>
/// <returns>IEnumerable{ItemSortBy}.</returns>
public IEnumerable<string> GetOrderBy()
{
var val = SortBy;
if (string.IsNullOrEmpty(val))
{
return new string[] { };
}
return val.Split(',');
}
}
}