diff --git a/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs b/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs index a2f7b153f1..21ddcd0283 100644 --- a/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs +++ b/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs @@ -36,8 +36,8 @@ namespace MediaBrowser.Api.DefaultTheme [ApiMember(Name = "UserId", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] public Guid UserId { get; set; } - [ApiMember(Name = "FamilyRating", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public string FamilyRating { get; set; } + [ApiMember(Name = "FamilyGenre", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + public string FamilyGenre { get; set; } [ApiMember(Name = "ComedyGenre", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string ComedyGenre { get; set; } @@ -185,8 +185,6 @@ namespace MediaBrowser.Api.DefaultTheme var itemsWithBackdrops = items.Where(i => i.BackdropImagePaths.Count > 0 && !(i is Trailer)) .ToList(); - var baselineRating = _localization.GetRatingLevel(request.FamilyRating ?? "PG"); - var view = new MoviesView(); var movies = items.OfType() @@ -194,7 +192,9 @@ namespace MediaBrowser.Api.DefaultTheme var hdMovies = movies.Where(i => i.IsHd).ToList(); - var familyMovies = movies.Where(i => IsFamilyMovie(i, baselineRating)).ToList(); + var familyGenres = request.FamilyGenre.Split(',').ToDictionary(i => i, StringComparer.OrdinalIgnoreCase); + + var familyMovies = movies.Where(i => i.Genres.Any(familyGenres.ContainsKey)).ToList(); view.HDMoviePercentage = 100 * hdMovies.Count; view.HDMoviePercentage /= movies.Count; @@ -323,30 +323,6 @@ namespace MediaBrowser.Api.DefaultTheme } } - private bool IsFamilyMovie(BaseItem item, int? baselineRating) - { - var ratingString = item.CustomRating; - - if (string.IsNullOrEmpty(ratingString)) - { - ratingString = item.OfficialRating; - } - - if (string.IsNullOrEmpty(ratingString)) - { - return false; - } - - var rating = _localization.GetRatingLevel(ratingString); - - if (!baselineRating.HasValue || !rating.HasValue) - { - return false; - } - - return rating.Value <= baselineRating.Value; - } - private async Task GetActors(IEnumerable mediaItems) { var actorStubs = new List(); diff --git a/MediaBrowser.Api/DefaultTheme/Models.cs b/MediaBrowser.Api/DefaultTheme/Models.cs index a4167bf33c..a25bb4bb12 100644 --- a/MediaBrowser.Api/DefaultTheme/Models.cs +++ b/MediaBrowser.Api/DefaultTheme/Models.cs @@ -43,6 +43,11 @@ namespace MediaBrowser.Api.DefaultTheme public ItemStub[] ComedyItems { get; set; } } + public class GamesView + { + public BaseItemDto[] SpotlightItems { get; set; } + } + public class HomeView { public BaseItemDto[] SpotlightItems { get; set; } diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 879df7e3ce..40ce844054 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -164,6 +164,9 @@ namespace MediaBrowser.Api.UserLibrary [ApiMember(Name = "MinIndexNumber", Description = "Optional filter by minimum index number.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] public int? MinIndexNumber { get; set; } + [ApiMember(Name = "MinPlayers", Description = "Optional filter by minimum number of game players.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] + public int? MinPlayers { get; set; } + [ApiMember(Name = "ParentIndexNumber", Description = "Optional filter by parent index number.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] public int? ParentIndexNumber { get; set; } @@ -670,6 +673,25 @@ namespace MediaBrowser.Api.UserLibrary items = items.Where(i => request.HasThemeVideo.Value ? i.ThemeVideoIds.Count > 0 : i.ThemeVideoIds.Count == 0); } + if (request.MinPlayers.HasValue) + { + var filterValue = request.MinPlayers.Value; + + items = items.Where(i => + { + var game = i as Game; + + if (game != null) + { + var players = game.PlayersSupported ?? 1; + + return players >= filterValue; + } + + return false; + }); + } + if (request.HasSpecialFeature.HasValue) { var filterValue = request.HasSpecialFeature.Value; diff --git a/MediaBrowser.Providers/TV/RemoteSeriesProvider.cs b/MediaBrowser.Providers/TV/RemoteSeriesProvider.cs index beacd962cf..e1ebdba5e7 100644 --- a/MediaBrowser.Providers/TV/RemoteSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/RemoteSeriesProvider.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; @@ -10,6 +9,7 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using System; +using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; @@ -149,7 +149,7 @@ namespace MediaBrowser.Providers.TV { get { - return "1"; + return "2"; } }