Added budget as a sort order

This commit is contained in:
Luke Pulverenti 2013-04-12 10:32:04 -04:00
parent 192e1676a4
commit b789550a56
5 changed files with 36 additions and 2 deletions

View File

@ -29,7 +29,7 @@ namespace MediaBrowser.Api.UserLibrary
/// 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, CommunityRating, DateCreated, DatePlayed, PlayCount, PremiereDate, ProductionYear, SortName, Random, Runtime", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
[ApiMember(Name = "SortBy", Description = "Optional. Specify one or more sort orders, comma delimeted. Options: Album, AlbumArtist, Artist, Budget, CommunityRating, DateCreated, DatePlayed, PlayCount, PremiereDate, ProductionYear, SortName, Random, Runtime", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string SortBy { get; set; }
/// <summary>

View File

@ -567,7 +567,7 @@ namespace MediaBrowser.Controller.Entities
/// Gets or sets the budget.
/// </summary>
/// <value>The budget.</value>
public double Budget { get; set; }
public double? Budget { get; set; }
/// <summary>
/// Gets or sets the production locations.

View File

@ -19,6 +19,10 @@ namespace MediaBrowser.Model.Querying
/// </summary>
public const string Artist = "Artist";
/// <summary>
/// The budget
/// </summary>
public const string Budget = "Budget";
/// <summary>
/// The date created
/// </summary>
public const string DateCreated = "DateCreated";

View File

@ -160,6 +160,7 @@
<Compile Include="Sorting\AlbumArtistComparer.cs" />
<Compile Include="Sorting\AlbumComparer.cs" />
<Compile Include="Sorting\ArtistComparer.cs" />
<Compile Include="Sorting\BudgetComparer.cs" />
<Compile Include="Sorting\CommunityRatingComparer.cs" />
<Compile Include="Sorting\DateCreatedComparer.cs" />
<Compile Include="Sorting\DatePlayedComparer.cs" />

View File

@ -0,0 +1,29 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Sorting
{
public class BudgetDateComparer : IBaseItemComparer
{
/// <summary>
/// Compares the specified x.
/// </summary>
/// <param name="x">The x.</param>
/// <param name="y">The y.</param>
/// <returns>System.Int32.</returns>
public int Compare(BaseItem x, BaseItem y)
{
return (x.Budget ?? 0).CompareTo(y.Budget ?? 0);
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get { return ItemSortBy.Budget; }
}
}
}