From 7da834507838c9d5c2246bf958bdac44046de4c2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 19 Jan 2014 14:25:29 -0500 Subject: [PATCH] updated nuget --- .../UserLibrary/BaseItemsByNameService.cs | 9 +++++++++ .../UserLibrary/BaseItemsRequest.cs | 3 +++ MediaBrowser.Api/UserLibrary/ItemsService.cs | 19 ++++++++++++++++++- MediaBrowser.Model/Querying/ItemQuery.cs | 4 ++++ .../Querying/ItemsByNameQuery.cs | 6 ++++++ Nuget/MediaBrowser.Common.Internal.nuspec | 4 ++-- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 ++-- 8 files changed, 45 insertions(+), 6 deletions(-) diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs index c483a4bb7..9263a574b 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs @@ -147,6 +147,15 @@ namespace MediaBrowser.Api.UserLibrary items = items.Where(i => GetLibraryItems(i, libraryItems).All(l => l.IsUnplayed(user))); } + if (request.IsPlayed.HasValue) + { + var val = request.IsPlayed.Value; + + var libraryItems = user.RootFolder.GetRecursiveChildren(user).ToList(); + + items = items.Where(i => GetLibraryItems(i, libraryItems).All(l => l.IsPlayed(user) == val)); + } + return items; } diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs index 9c8157c9c..f1fe904f3 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs @@ -93,6 +93,9 @@ namespace MediaBrowser.Api.UserLibrary [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; } + [ApiMember(Name = "IsPlayed", Description = "Optional filter by items that are played, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] + public bool? IsPlayed { get; set; } + /// /// Gets the filters. /// diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 7f80f75ac..278821f52 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -216,6 +216,9 @@ namespace MediaBrowser.Api.UserLibrary [ApiMember(Name = "IsYearMismatched", Description = "Optional filter by items that are potentially misidentified.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] public bool? IsYearMismatched { get; set; } + + [ApiMember(Name = "IsInBoxSet", Description = "Optional filter by items that are in boxsets, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] + public bool? IsInBoxSet { get; set; } } /// @@ -969,6 +972,8 @@ namespace MediaBrowser.Api.UserLibrary if (request.HasParentalRating.HasValue) { + var val = request.HasParentalRating.Value; + items = items.Where(i => { var rating = i.CustomRating; @@ -978,7 +983,7 @@ namespace MediaBrowser.Api.UserLibrary rating = i.OfficialRating; } - if (request.HasParentalRating.Value) + if (val) { return !string.IsNullOrEmpty(rating); } @@ -993,6 +998,18 @@ namespace MediaBrowser.Api.UserLibrary items = items.OfType