Added critic rating as a sort order
This commit is contained in:
parent
378beb7bad
commit
e49848b8bf
|
@ -48,7 +48,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, Revenue, 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, CriticRatingSummary, DateCreated, DisplayMediaType, 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>
|
||||||
|
|
|
@ -41,7 +41,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, Revenue, 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, 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; }
|
public string SortBy { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -312,6 +312,12 @@ namespace MediaBrowser.Controller.Dto
|
||||||
dto.Language = item.Language;
|
dto.Language = item.Language;
|
||||||
dto.MediaType = item.MediaType;
|
dto.MediaType = item.MediaType;
|
||||||
dto.LocationType = item.LocationType;
|
dto.LocationType = item.LocationType;
|
||||||
|
dto.CriticRating = item.CriticRating;
|
||||||
|
|
||||||
|
if (fields.Contains(ItemFields.CriticRatingSummary))
|
||||||
|
{
|
||||||
|
dto.CriticRatingSummary = item.CriticRatingSummary;
|
||||||
|
}
|
||||||
|
|
||||||
var localTrailerCount = item.LocalTrailers == null ? 0 : item.LocalTrailers.Count;
|
var localTrailerCount = item.LocalTrailers == null ? 0 : item.LocalTrailers.Count;
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,10 @@ using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.IO;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Providers.Movies
|
namespace MediaBrowser.Controller.Providers.Movies
|
||||||
{
|
{
|
||||||
|
@ -35,7 +34,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _rotten tomatoes resource pool
|
/// The _rotten tomatoes resource pool
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly SemaphoreSlim _rottenTomatoesResourcePool = new SemaphoreSlim(3, 3);
|
private readonly SemaphoreSlim _rottenTomatoesResourcePool = new SemaphoreSlim(1, 1);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the json serializer.
|
/// Gets the json serializer.
|
||||||
|
@ -71,7 +70,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "2";
|
return "4";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +250,8 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
Publisher = rtReview.publication,
|
Publisher = rtReview.publication,
|
||||||
Date = DateTime.Parse(rtReview.date).ToUniversalTime(),
|
Date = DateTime.Parse(rtReview.date).ToUniversalTime(),
|
||||||
Caption = rtReview.quote,
|
Caption = rtReview.quote,
|
||||||
Url = rtReview.links.review
|
Url = rtReview.links.review,
|
||||||
|
Likes = string.Equals(rtReview.freshness, "fresh", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,18 @@ namespace MediaBrowser.Model.Dto
|
||||||
/// <value>The premiere date.</value>
|
/// <value>The premiere date.</value>
|
||||||
public DateTime? PremiereDate { get; set; }
|
public DateTime? PremiereDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the critic rating.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The critic rating.</value>
|
||||||
|
public float? CriticRating { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the critic rating summary.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The critic rating summary.</value>
|
||||||
|
public string CriticRatingSummary { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the path.
|
/// Gets or sets the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -29,7 +29,13 @@ namespace MediaBrowser.Model.Entities
|
||||||
/// Gets or sets the score.
|
/// Gets or sets the score.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The score.</value>
|
/// <value>The score.</value>
|
||||||
public float Score { get; set; }
|
public float? Score { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether this <see cref="ItemReview"/> is likes.
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>null</c> if [likes] contains no value, <c>true</c> if [likes]; otherwise, <c>false</c>.</value>
|
||||||
|
public bool? Likes { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the URL.
|
/// Gets or sets the URL.
|
||||||
|
|
|
@ -21,6 +21,11 @@ namespace MediaBrowser.Model.Querying
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Chapters,
|
Chapters,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The critic rating summary
|
||||||
|
/// </summary>
|
||||||
|
CriticRatingSummary,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The date created of the item
|
/// The date created of the item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -62,5 +62,10 @@ namespace MediaBrowser.Model.Querying
|
||||||
/// The play count
|
/// The play count
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string PlayCount = "PlayCount";
|
public const string PlayCount = "PlayCount";
|
||||||
|
/// <summary>
|
||||||
|
/// The critic rating
|
||||||
|
/// </summary>
|
||||||
|
public const string CriticRating = "CriticRating";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,7 @@
|
||||||
<Compile Include="Sorting\ArtistComparer.cs" />
|
<Compile Include="Sorting\ArtistComparer.cs" />
|
||||||
<Compile Include="Sorting\BudgetComparer.cs" />
|
<Compile Include="Sorting\BudgetComparer.cs" />
|
||||||
<Compile Include="Sorting\CommunityRatingComparer.cs" />
|
<Compile Include="Sorting\CommunityRatingComparer.cs" />
|
||||||
|
<Compile Include="Sorting\CriticRatingComparer.cs" />
|
||||||
<Compile Include="Sorting\DateCreatedComparer.cs" />
|
<Compile Include="Sorting\DateCreatedComparer.cs" />
|
||||||
<Compile Include="Sorting\DatePlayedComparer.cs" />
|
<Compile Include="Sorting\DatePlayedComparer.cs" />
|
||||||
<Compile Include="Sorting\PlayCountComparer.cs" />
|
<Compile Include="Sorting\PlayCountComparer.cs" />
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
using MediaBrowser.Model.Querying;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Server.Implementations.Sorting
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class CriticRatingComparer
|
||||||
|
/// </summary>
|
||||||
|
public class CriticRatingComparer : 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.CriticRating ?? 0).CompareTo(y.CriticRating ?? 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The name.</value>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return ItemSortBy.CriticRating; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user