From 72e96b1afbaaf8c9f06388c83c134ed35a1b6e36 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 3 Nov 2013 11:19:33 -0500 Subject: [PATCH] updated nuget with new query params --- .../DefaultTheme/DefaultThemeService.cs | 12 ++++++++++- MediaBrowser.Api/DefaultTheme/Models.cs | 5 +++++ MediaBrowser.Api/UserLibrary/ItemsService.cs | 20 +++++++++++++++++++ MediaBrowser.Model/Querying/ItemQuery.cs | 5 ++++- Nuget/MediaBrowser.Common.Internal.nuspec | 4 ++-- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 ++-- 7 files changed, 45 insertions(+), 7 deletions(-) diff --git a/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs b/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs index 77f4f3dba..d0f095f5b 100644 --- a/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs +++ b/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs @@ -33,6 +33,9 @@ namespace MediaBrowser.Api.DefaultTheme [ApiMember(Name = "RomanceGenre", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string RomanceGenre { get; set; } + + [ApiMember(Name = "TopCommunityRating", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] + public double TopCommunityRating { get; set; } } [Route("/MBT/DefaultTheme/Movies", "GET")] @@ -260,7 +263,14 @@ namespace MediaBrowser.Api.DefaultTheme var seriesWithBackdrops = series.Where(i => i.BackdropImagePaths.Count > 0).ToList(); - var view = new TvView(); + var view = new TvView + { + SeriesCount = series.Count, + + FavoriteSeriesCount = series.Count(i => _userDataManager.GetUserData(user.Id, i.GetUserDataKey()).IsFavorite), + + TopCommunityRatedSeriesCount = series.Count(i => i.CommunityRating.HasValue && i.CommunityRating.Value >= request.TopCommunityRating) + }; var fields = new List(); diff --git a/MediaBrowser.Api/DefaultTheme/Models.cs b/MediaBrowser.Api/DefaultTheme/Models.cs index f44387326..70f95a90f 100644 --- a/MediaBrowser.Api/DefaultTheme/Models.cs +++ b/MediaBrowser.Api/DefaultTheme/Models.cs @@ -40,6 +40,11 @@ namespace MediaBrowser.Api.DefaultTheme public List RomanceItems { get; set; } public List ComedyItems { get; set; } + + public int SeriesCount { get; set; } + public int FavoriteSeriesCount { get; set; } + public int TopCommunityRatedSeriesCount { get; set; } + public int InProgressSeriesCount { get; set; } } public class GamesView : BaseView diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index b6963f8b2..29a894b1c 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -196,6 +196,12 @@ namespace MediaBrowser.Api.UserLibrary [ApiMember(Name = "IsVirtualUnaired", Description = "Optional filter by items that are virtual unaired episodes or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] public bool? IsVirtualUnaired { get; set; } + + [ApiMember(Name = "MinCommunityRating", Description = "Optional filter by minimum community rating.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] + public double? MinCommunityRating { get; set; } + + [ApiMember(Name = "MinCriticRating", Description = "Optional filter by minimum critic rating.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] + public double? MinCriticRating { get; set; } } /// @@ -564,6 +570,20 @@ namespace MediaBrowser.Api.UserLibrary /// IEnumerable{BaseItem}. private IEnumerable ApplyAdditionalFilters(GetItems request, IEnumerable items, User user) { + if (request.MinCommunityRating.HasValue) + { + var val = request.MinCommunityRating.Value; + + items = items.Where(i => i.CommunityRating.HasValue && i.CommunityRating >= val); + } + + if (request.MinCriticRating.HasValue) + { + var val = request.MinCriticRating.Value; + + items = items.Where(i => i.CriticRating.HasValue && i.CriticRating >= val); + } + // Artists if (!string.IsNullOrEmpty(request.Artists)) { diff --git a/MediaBrowser.Model/Querying/ItemQuery.cs b/MediaBrowser.Model/Querying/ItemQuery.cs index f4a1d20d2..13720ea2b 100644 --- a/MediaBrowser.Model/Querying/ItemQuery.cs +++ b/MediaBrowser.Model/Querying/ItemQuery.cs @@ -261,7 +261,10 @@ namespace MediaBrowser.Model.Querying /// /// The exclude location types. public LocationType[] ExcludeLocationTypes { get; set; } - + + public double? MinCommunityRating { get; set; } + public double? MinCriticRating { get; set; } + /// /// Initializes a new instance of the class. /// diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index e008610e3..ab32f9097 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.235 + 3.0.237 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index b3b7cd3a0..54ddf0303 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.235 + 3.0.237 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 2f2216f8e..6237b923a 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.235 + 3.0.237 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +