Capture revenue and add it as a sort order
This commit is contained in:
parent
aa8c3d9cf0
commit
dea10e5040
|
@ -55,7 +55,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// Fields to return within the items, in addition to basic information
|
/// Fields to return within the items, in addition to basic information
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The fields.</value>
|
/// <value>The fields.</value>
|
||||||
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: AudioInfo, Budget, Chapters, DateCreated, DisplayMediaType, DisplayPreferences, EndDate, Genres, HomePageUrl, ItemCounts, IndexOptions, Locations, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, SeriesInfo, SortName, Studios, Taglines, TrailerUrls, UserData", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: AudioInfo, Budget, Chapters, DateCreated, DisplayMediaType, DisplayPreferences, EndDate, Genres, HomePageUrl, ItemCounts, IndexOptions, Locations, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SeriesInfo, SortName, Studios, Taglines, TrailerUrls, UserData", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||||
public string Fields { get; set; }
|
public string Fields { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// What to sort the results by
|
/// What to sort the results by
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The sort by.</value>
|
/// <value>The sort by.</value>
|
||||||
[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)]
|
[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, Revenue, Runtime", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||||
public string SortBy { get; set; }
|
public string SortBy { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -264,6 +264,11 @@ namespace MediaBrowser.Controller.Dto
|
||||||
dto.Budget = item.Budget;
|
dto.Budget = item.Budget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fields.Contains(ItemFields.Revenue))
|
||||||
|
{
|
||||||
|
dto.Revenue = item.Revenue;
|
||||||
|
}
|
||||||
|
|
||||||
if (fields.Contains(ItemFields.EndDate))
|
if (fields.Contains(ItemFields.EndDate))
|
||||||
{
|
{
|
||||||
dto.EndDate = item.EndDate;
|
dto.EndDate = item.EndDate;
|
||||||
|
|
|
@ -564,6 +564,12 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <value>The budget.</value>
|
/// <value>The budget.</value>
|
||||||
public double? Budget { get; set; }
|
public double? Budget { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the revenue.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The revenue.</value>
|
||||||
|
public double? Revenue { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the production locations.
|
/// Gets or sets the production locations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -907,6 +907,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
movie.Overview = movie.Overview != null ? movie.Overview.Replace("\n\n", "\n") : null;
|
movie.Overview = movie.Overview != null ? movie.Overview.Replace("\n\n", "\n") : null;
|
||||||
movie.HomePageUrl = movieData.homepage;
|
movie.HomePageUrl = movieData.homepage;
|
||||||
movie.Budget = movieData.budget;
|
movie.Budget = movieData.budget;
|
||||||
|
movie.Revenue = movieData.revenue;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(movieData.tagline)) movie.AddTagline(movieData.tagline);
|
if (!string.IsNullOrEmpty(movieData.tagline)) movie.AddTagline(movieData.tagline);
|
||||||
movie.SetProviderId(MetadataProviders.Imdb, movieData.imdb_id);
|
movie.SetProviderId(MetadataProviders.Imdb, movieData.imdb_id);
|
||||||
|
|
|
@ -458,9 +458,16 @@ namespace MediaBrowser.Model.Dto
|
||||||
/// Gets or sets the budget.
|
/// Gets or sets the budget.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The budget.</value>
|
/// <value>The budget.</value>
|
||||||
[ProtoMember(73)]
|
[ProtoMember(74)]
|
||||||
public double? Budget { get; set; }
|
public double? Budget { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the revenue.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The revenue.</value>
|
||||||
|
[ProtoMember(75)]
|
||||||
|
public double? Revenue { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this instance can resume.
|
/// Gets a value indicating whether this instance can resume.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -101,6 +101,11 @@ namespace MediaBrowser.Model.Querying
|
||||||
/// </summary>
|
/// </summary>
|
||||||
PrimaryImageAspectRatio,
|
PrimaryImageAspectRatio,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The revenue
|
||||||
|
/// </summary>
|
||||||
|
Revenue,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AirDays, status, SeriesName, etc
|
/// AirDays, status, SeriesName, etc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -23,6 +23,10 @@ namespace MediaBrowser.Model.Querying
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string Budget = "Budget";
|
public const string Budget = "Budget";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// The revenue
|
||||||
|
/// </summary>
|
||||||
|
public const string Revenue = "Revenue";
|
||||||
|
/// <summary>
|
||||||
/// The date created
|
/// The date created
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string DateCreated = "DateCreated";
|
public const string DateCreated = "DateCreated";
|
||||||
|
|
|
@ -164,6 +164,7 @@
|
||||||
<Compile Include="Sorting\PremiereDateComparer.cs" />
|
<Compile Include="Sorting\PremiereDateComparer.cs" />
|
||||||
<Compile Include="Sorting\ProductionYearComparer.cs" />
|
<Compile Include="Sorting\ProductionYearComparer.cs" />
|
||||||
<Compile Include="Sorting\RandomComparer.cs" />
|
<Compile Include="Sorting\RandomComparer.cs" />
|
||||||
|
<Compile Include="Sorting\RevenueComparer.cs" />
|
||||||
<Compile Include="Sorting\RuntimeComparer.cs" />
|
<Compile Include="Sorting\RuntimeComparer.cs" />
|
||||||
<Compile Include="Sorting\SortNameComparer.cs" />
|
<Compile Include="Sorting\SortNameComparer.cs" />
|
||||||
<Compile Include="Sqlite\SQLiteDisplayPreferencesRepository.cs" />
|
<Compile Include="Sqlite\SQLiteDisplayPreferencesRepository.cs" />
|
||||||
|
|
|
@ -4,7 +4,7 @@ using MediaBrowser.Model.Querying;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Sorting
|
namespace MediaBrowser.Server.Implementations.Sorting
|
||||||
{
|
{
|
||||||
public class BudgetDateComparer : IBaseItemComparer
|
public class BudgetComparer : IBaseItemComparer
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
using MediaBrowser.Model.Querying;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Server.Implementations.Sorting
|
||||||
|
{
|
||||||
|
public class RevenueComparer : 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.Revenue ?? 0).CompareTo(y.Revenue ?? 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The name.</value>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return ItemSortBy.Revenue; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user