diff options
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/ItemsService.cs | 42 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Library/DtoBuilder.cs | 3 | ||||
| -rw-r--r-- | MediaBrowser.Model/Querying/ItemQuery.cs | 18 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Common.Internal.nuspec | 4 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Common.nuspec | 2 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Server.Core.nuspec | 4 |
6 files changed, 68 insertions, 5 deletions
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index a74516fa2..7c022af7e 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -106,6 +106,27 @@ namespace MediaBrowser.Api.UserLibrary /// <value>The item ids.</value> [ApiMember(Name = "Ids", Description = "Optional. If specific items are needed, specify a list of item id's to retrieve. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string Ids { get; set; } + + /// <summary> + /// Gets or sets the media types. + /// </summary> + /// <value>The media types.</value> + [ApiMember(Name = "MediaTypes", Description = "Optional filter by MediaType. Allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + public string MediaTypes { get; set; } + + /// <summary> + /// Gets or sets the video types. + /// </summary> + /// <value>The video types.</value> + [ApiMember(Name = "VideoTypes", Description = "Optional filter by VideoType (videofile, dvd, bluray, iso). Allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + public string VideoTypes { get; set; } + + /// <summary> + /// Gets or sets the video formats. + /// </summary> + /// <value>The video formats.</value> + [ApiMember(Name = "VideoFormats", Description = "Optional filter by VideoFormat (Standard, Digital3D, Sbs3D). Allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + public string VideoFormats { get; set; } } /// <summary> @@ -315,6 +336,27 @@ namespace MediaBrowser.Api.UserLibrary /// <returns>IEnumerable{BaseItem}.</returns> private IEnumerable<BaseItem> ApplyAdditionalFilters(GetItems request, IEnumerable<BaseItem> items) { + if (!string.IsNullOrEmpty(request.VideoFormats)) + { + var formats = request.VideoFormats.Split(','); + + items = items.OfType<Video>().Where(i => formats.Contains(i.VideoFormat.ToString(), StringComparer.OrdinalIgnoreCase)); + } + + if (!string.IsNullOrEmpty(request.VideoTypes)) + { + var types = request.VideoTypes.Split(','); + + items = items.OfType<Video>().Where(i => types.Contains(i.VideoType.ToString(), StringComparer.OrdinalIgnoreCase)); + } + + if (!string.IsNullOrEmpty(request.MediaTypes)) + { + var types = request.MediaTypes.Split(','); + + items = items.Where(i => !string.IsNullOrEmpty(i.MediaType) && types.Contains(i.MediaType, StringComparer.OrdinalIgnoreCase)); + } + var imageTypes = GetImageTypes(request).ToArray(); if (imageTypes.Length > 0) { diff --git a/MediaBrowser.Controller/Library/DtoBuilder.cs b/MediaBrowser.Controller/Library/DtoBuilder.cs index 6b28e0347..f089b531c 100644 --- a/MediaBrowser.Controller/Library/DtoBuilder.cs +++ b/MediaBrowser.Controller/Library/DtoBuilder.cs @@ -548,6 +548,9 @@ namespace MediaBrowser.Controller.Library // Attach People by transforming them into BaseItemPerson (DTO) dto.People = new BaseItemPerson[item.People.Count]; + // Ordering by person type to ensure actors and artists are at the front. + // This is taking advantage of the fact that they both begin with A + // This should be improved in the future var entities = await Task.WhenAll(item.People.OrderBy(i => i.Type).Select(c => Task.Run(async () => diff --git a/MediaBrowser.Model/Querying/ItemQuery.cs b/MediaBrowser.Model/Querying/ItemQuery.cs index 804a6b399..37024795c 100644 --- a/MediaBrowser.Model/Querying/ItemQuery.cs +++ b/MediaBrowser.Model/Querying/ItemQuery.cs @@ -58,6 +58,24 @@ namespace MediaBrowser.Model.Querying public ItemFields[] Fields { get; set; } /// <summary> + /// Gets or sets the media types. + /// </summary> + /// <value>The media types.</value> + public string[] MediaTypes { get; set; } + + /// <summary> + /// Gets or sets the video formats. + /// </summary> + /// <value>The video formats.</value> + public VideoFormat[] VideoFormats { get; set; } + + /// <summary> + /// Gets or sets the video types. + /// </summary> + /// <value>The video types.</value> + public VideoType[] VideoTypes { get; set; } + + /// <summary> /// Whether or not to perform the query recursively /// </summary> /// <value><c>true</c> if recursive; otherwise, <c>false</c>.</value> diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index ba481fc67..13a1ab540 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common.Internal</id> - <version>3.0.64</version> + <version>3.0.65</version> <title>MediaBrowser.Common.Internal</title> <authors>Luke</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description> <copyright>Copyright © Media Browser 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.64" /> + <dependency id="MediaBrowser.Common" version="3.0.65" /> <dependency id="NLog" version="2.0.0.2000" /> <dependency id="ServiceStack.Text" version="3.9.38" /> <dependency id="protobuf-net" version="2.0.0.621" /> diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index f2f25a02d..085aefdf8 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>MediaBrowser.Common</id> - <version>3.0.64</version> + <version>3.0.65</version> <title>MediaBrowser.Common</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 9b1f31365..fac9b9296 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>MediaBrowser.Server.Core</id> - <version>3.0.64</version> + <version>3.0.65</version> <title>Media Browser.Server.Core</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains core components required to build plugins for Media Browser Server.</description> <copyright>Copyright © Media Browser 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.64" /> + <dependency id="MediaBrowser.Common" version="3.0.65" /> </dependencies> </metadata> <files> |
