The Free Software Media System - Server Backend & API
Added budget as a sort order
Luke Pulverentib789550a5639
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.csindex dc29ba341e..aed84e07f2 100644--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs@@ -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>diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.csindex 15963a8073..2cb8ac7949 100644--- a/MediaBrowser.Controller/Entities/BaseItem.cs+++ b/MediaBrowser.Controller/Entities/BaseItem.cs@@ -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.diff --git a/MediaBrowser.Model/Querying/ItemSortBy.cs b/MediaBrowser.Model/Querying/ItemSortBy.csindex c85ed8780a..b1ad7c550b 100644--- a/MediaBrowser.Model/Querying/ItemSortBy.cs+++ b/MediaBrowser.Model/Querying/ItemSortBy.cs@@ -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";diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csprojindex a4c4fc614b..ba79ff5d59 100644--- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj+++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj@@ -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" />diff --git a/MediaBrowser.Server.Implementations/Sorting/BudgetComparer.cs b/MediaBrowser.Server.Implementations/Sorting/BudgetComparer.csnew file mode 100644index 0000000000..3637f29396--- /dev/null+++ b/MediaBrowser.Server.Implementations/Sorting/BudgetComparer.cs@@ -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; }+ }+ }+}