From 6146b57e7c908d301f5aee3a8cdd996b395db363 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 22 Sep 2013 12:49:55 -0400 Subject: update to servicestack 3.9.62 --- MediaBrowser.Api/UserLibrary/ItemsService.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'MediaBrowser.Api/UserLibrary') diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 65ece13acb..b69dbaa67c 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -12,7 +12,6 @@ using ServiceStack.ServiceHost; using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; namespace MediaBrowser.Api.UserLibrary { -- cgit v1.2.3 From 5d837309e43e288fce513d0217c4e62f4ef6c2b4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 22 Sep 2013 13:00:42 -0400 Subject: added AllGenres filter --- MediaBrowser.Api/UserLibrary/ItemsService.cs | 40 +++++++++++++++------------- MediaBrowser.Model/Querying/ItemQuery.cs | 6 +++++ Nuget/MediaBrowser.Common.Internal.nuspec | 4 +-- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +-- 5 files changed, 32 insertions(+), 24 deletions(-) (limited to 'MediaBrowser.Api/UserLibrary') diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index b69dbaa67c..3437cdd5ab 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -63,6 +63,9 @@ namespace MediaBrowser.Api.UserLibrary [ApiMember(Name = "Genres", Description = "Optional. If specified, results will be filtered based on genre. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string Genres { get; set; } + [ApiMember(Name = "AllGenres", Description = "Optional. If specified, results will be filtered based on genre. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + public string AllGenres { get; set; } + /// /// Limit results to items containing specific studios /// @@ -608,43 +611,42 @@ namespace MediaBrowser.Api.UserLibrary items = items.Where(item => imageTypes.Any(imageType => HasImage(item, imageType))); } - var genres = request.Genres; - // Apply genre filter - if (!string.IsNullOrEmpty(genres)) + if (!string.IsNullOrEmpty(request.Genres)) { - var vals = genres.Split(','); - items = items.Where(f => f.Genres != null && vals.Any(v => f.Genres.Contains(v, StringComparer.OrdinalIgnoreCase))); + var vals = request.Genres.Split(','); + items = items.Where(f => vals.Any(v => f.Genres.Contains(v, StringComparer.OrdinalIgnoreCase))); } - var studios = request.Studios; - + // Apply genre filter + if (!string.IsNullOrEmpty(request.AllGenres)) + { + var vals = request.AllGenres.Split(','); + items = items.Where(f => vals.All(v => f.Genres.Contains(v, StringComparer.OrdinalIgnoreCase))); + } + // Apply studio filter - if (!string.IsNullOrEmpty(studios)) + if (!string.IsNullOrEmpty(request.Studios)) { - var vals = studios.Split(','); - items = items.Where(f => f.Studios != null && vals.Any(v => f.Studios.Contains(v, StringComparer.OrdinalIgnoreCase))); + var vals = request.Studios.Split(','); + items = items.Where(f => vals.Any(v => f.Studios.Contains(v, StringComparer.OrdinalIgnoreCase))); } - var years = request.Years; - // Apply year filter - if (!string.IsNullOrEmpty(years)) + if (!string.IsNullOrEmpty(request.Years)) { - var vals = years.Split(',').Select(int.Parse); + var vals = request.Years.Split(',').Select(int.Parse).ToList(); items = items.Where(f => f.ProductionYear.HasValue && vals.Contains(f.ProductionYear.Value)); } - var personName = request.Person; - // Apply person filter - if (!string.IsNullOrEmpty(personName)) + if (!string.IsNullOrEmpty(request.Person)) { var personTypes = request.PersonTypes; if (string.IsNullOrEmpty(personTypes)) { - items = items.Where(item => item.People != null && item.People.Any(p => string.Equals(p.Name, personName, StringComparison.OrdinalIgnoreCase))); + items = items.Where(item => item.People != null && item.People.Any(p => string.Equals(p.Name, request.Person, StringComparison.OrdinalIgnoreCase))); } else { @@ -653,7 +655,7 @@ namespace MediaBrowser.Api.UserLibrary items = items.Where(item => item.People != null && item.People.Any(p => - p.Name.Equals(personName, StringComparison.OrdinalIgnoreCase) && (types.Contains(p.Type, StringComparer.OrdinalIgnoreCase) || types.Contains(p.Role, StringComparer.OrdinalIgnoreCase)))); + p.Name.Equals(request.Person, StringComparison.OrdinalIgnoreCase) && (types.Contains(p.Type, StringComparer.OrdinalIgnoreCase) || types.Contains(p.Role, StringComparer.OrdinalIgnoreCase)))); } } diff --git a/MediaBrowser.Model/Querying/ItemQuery.cs b/MediaBrowser.Model/Querying/ItemQuery.cs index 45af17b0f2..69c79104a4 100644 --- a/MediaBrowser.Model/Querying/ItemQuery.cs +++ b/MediaBrowser.Model/Querying/ItemQuery.cs @@ -92,6 +92,12 @@ namespace MediaBrowser.Model.Querying /// The genres. public string[] Genres { get; set; } + /// + /// Limit results to items containing specific genres + /// + /// The genres. + public string[] AllGenres { get; set; } + /// /// Limit results to items containing specific studios /// diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index fc0650d5ef..1d104c45bc 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.205 + 3.0.206 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 64342cef9a..0670bcacf4 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.205 + 3.0.206 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 40919486ce..f5aa2d4609 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.205 + 3.0.206 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 - + -- cgit v1.2.3 From 28e788e43517fd304baf4c1e8f754a38afe64624 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 23 Sep 2013 10:26:20 -0400 Subject: fixes #541 - ItemQuery returns incorrect UserData --- MediaBrowser.Api/SimilarItemsHelper.cs | 2 +- MediaBrowser.Api/TvShowsService.cs | 2 +- MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs | 2 +- MediaBrowser.Model/Querying/ItemFields.cs | 5 ---- .../Dto/DtoService.cs | 29 ++++++++-------------- .../HttpServer/HttpServer.cs | 12 +++++---- 6 files changed, 21 insertions(+), 31 deletions(-) (limited to 'MediaBrowser.Api/UserLibrary') diff --git a/MediaBrowser.Api/SimilarItemsHelper.cs b/MediaBrowser.Api/SimilarItemsHelper.cs index 4103eff35d..9fc52caae7 100644 --- a/MediaBrowser.Api/SimilarItemsHelper.cs +++ b/MediaBrowser.Api/SimilarItemsHelper.cs @@ -45,7 +45,7 @@ namespace MediaBrowser.Api /// Fields to return within the items, in addition to basic information /// /// The fields. - [ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, ItemCounts, IndexOptions, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls", 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: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string Fields { get; set; } /// diff --git a/MediaBrowser.Api/TvShowsService.cs b/MediaBrowser.Api/TvShowsService.cs index e62959bee3..fcddd2ca65 100644 --- a/MediaBrowser.Api/TvShowsService.cs +++ b/MediaBrowser.Api/TvShowsService.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Api /// Fields to return within the items, in addition to basic information /// /// The fields. - [ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, ItemCounts, IndexOptions, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls", 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: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string Fields { get; set; } /// diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs index f92b7da450..eba36d8568 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs @@ -48,7 +48,7 @@ namespace MediaBrowser.Api.UserLibrary /// Fields to return within the items, in addition to basic information /// /// The fields. - [ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, ItemCounts, IndexOptions, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls", 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: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string Fields { get; set; } /// diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs index 8b0910acc8..71c3d59cd9 100644 --- a/MediaBrowser.Model/Querying/ItemFields.cs +++ b/MediaBrowser.Model/Querying/ItemFields.cs @@ -51,11 +51,6 @@ namespace MediaBrowser.Model.Querying /// HomePageUrl, - /// - /// Child count, recursive child count, etc - /// - ItemCounts, - /// /// The fields that the server supports indexing on /// diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index 99878e2ec4..e5260004a6 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -107,13 +107,10 @@ namespace MediaBrowser.Server.Implementations.Dto .ToArray(); } - if (fields.Contains(ItemFields.ItemCounts)) + var itemByName = item as IItemByName; + if (itemByName != null) { - var itemByName = item as IItemByName; - if (itemByName != null) - { - AttachItemByNameCounts(dto, itemByName, user); - } + AttachItemByNameCounts(dto, itemByName, user); } return dto; @@ -166,18 +163,13 @@ namespace MediaBrowser.Server.Implementations.Dto { if (item.IsFolder) { - var hasItemCounts = fields.Contains(ItemFields.ItemCounts); + var folder = (Folder)item; - if (hasItemCounts || fields.Contains(ItemFields.CumulativeRunTimeTicks)) - { - var folder = (Folder)item; + dto.ChildCount = folder.GetChildren(user, true).Count(); - if (hasItemCounts) - { - dto.ChildCount = folder.GetChildren(user, true).Count(); - } - - SetSpecialCounts(folder, user, dto); + if (!(folder is UserRootFolder)) + { + SetSpecialCounts(folder, user, dto, fields); } } @@ -1068,8 +1060,9 @@ namespace MediaBrowser.Server.Implementations.Dto /// The folder. /// The user. /// The dto. + /// The fields. /// Task. - private void SetSpecialCounts(Folder folder, User user, BaseItemDto dto) + private void SetSpecialCounts(Folder folder, User user, BaseItemDto dto, List fields) { var rcentlyAddedItemCount = 0; var recursiveItemCount = 0; @@ -1127,7 +1120,7 @@ namespace MediaBrowser.Server.Implementations.Dto dto.PlayedPercentage = totalPercentPlayed / recursiveItemCount; } - if (runtime > 0) + if (runtime > 0 && fields.Contains(ItemFields.CumulativeRunTimeTicks)) { dto.CumulativeRunTimeTicks = runtime; } diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs index aa30cee26f..035c0e9dce 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs @@ -356,6 +356,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer try { ProcessRequest(context); + + var url = context.Request.Url.ToString(); + var endPoint = context.Request.RemoteEndPoint; + + LogResponse(context, url, endPoint); + } catch (Exception ex) { @@ -433,9 +439,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer var httpRes = new HttpListenerResponseWrapper(context.Response); var handler = ServiceStackHttpHandlerFactory.GetHandler(httpReq); - var url = context.Request.Url.ToString(); - var endPoint = context.Request.RemoteEndPoint; - var serviceStackHandler = handler as IServiceStackHttpHandler; if (serviceStackHandler != null) @@ -446,7 +449,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer httpReq.OperationName = operationName = restHandler.RestPath.RequestType.Name; } serviceStackHandler.ProcessRequest(httpReq, httpRes, operationName); - LogResponse(context, url, endPoint); return; } @@ -529,7 +531,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer { new ClientWebSocket(); - _supportsNativeWebSocket = true; + _supportsNativeWebSocket = false; } catch (PlatformNotSupportedException) { -- cgit v1.2.3