diff --git a/MediaBrowser.Api/ChannelService.cs b/MediaBrowser.Api/ChannelService.cs index c59baed9d..442a95f4a 100644 --- a/MediaBrowser.Api/ChannelService.cs +++ b/MediaBrowser.Api/ChannelService.cs @@ -49,7 +49,7 @@ namespace MediaBrowser.Api } [Route("/Channels/{Id}/Items", "GET", Summary = "Gets channel items")] - public class GetChannelItems : IReturn> + public class GetChannelItems : IReturn>, IHasItemFields { [ApiMember(Name = "Id", Description = "Channel Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] public string Id { get; set; } @@ -87,6 +87,9 @@ namespace MediaBrowser.Api [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 = "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, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + public string Fields { get; set; } + /// /// Gets the filters. /// @@ -163,7 +166,8 @@ namespace MediaBrowser.Api FolderId = request.FolderId, SortOrder = request.SortOrder, SortBy = (request.SortBy ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray(), - Filters = request.GetFilters().ToArray() + Filters = request.GetFilters().ToArray(), + Fields = request.GetItemFields().ToList() }, CancellationToken.None).Result; diff --git a/MediaBrowser.Api/PackageService.cs b/MediaBrowser.Api/PackageService.cs index 0a8f0d83f..b54b05fcf 100644 --- a/MediaBrowser.Api/PackageService.cs +++ b/MediaBrowser.Api/PackageService.cs @@ -50,6 +50,9 @@ namespace MediaBrowser.Api [ApiMember(Name = "IsPremium", Description = "Optional. Filter by premium status", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")] public bool? IsPremium { get; set; } + + [ApiMember(Name = "IsAdult", Description = "Optional. Filter by package that contain adult content.", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")] + public bool? IsAdult { get; set; } } /// @@ -193,6 +196,11 @@ namespace MediaBrowser.Api packages = packages.Where(p => p.isPremium == request.IsPremium.Value); } + if (request.IsAdult.HasValue) + { + packages = packages.Where(p => p.adult == request.IsAdult.Value); + } + return ToOptimizedResult(packages.ToList()); } diff --git a/MediaBrowser.Model/Channels/ChannelItemQuery.cs b/MediaBrowser.Model/Channels/ChannelItemQuery.cs index 0cabe1d04..a76c6cd2d 100644 --- a/MediaBrowser.Model/Channels/ChannelItemQuery.cs +++ b/MediaBrowser.Model/Channels/ChannelItemQuery.cs @@ -1,5 +1,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; +using System.Collections.Generic; namespace MediaBrowser.Model.Channels { @@ -38,11 +39,13 @@ namespace MediaBrowser.Model.Channels public SortOrder? SortOrder { get; set; } public string[] SortBy { get; set; } public ItemFilter[] Filters { get; set; } + public List Fields { get; set; } public ChannelItemQuery() { Filters = new ItemFilter[] { }; SortBy = new string[] { }; + Fields = new List(); } } diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index 0ddef73c5..69a681ead 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -797,12 +797,7 @@ namespace MediaBrowser.Server.Implementations.Channels await RefreshIfNeeded(all, cancellationToken).ConfigureAwait(false); - // Get everything - var fields = Enum.GetNames(typeof(ItemFields)) - .Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true)) - .ToList(); - - var returnItemArray = all.Select(i => _dtoService.GetBaseItemDto(i, fields, user)) + var returnItemArray = all.Select(i => _dtoService.GetBaseItemDto(i, query.Fields, user)) .ToArray(); return new QueryResult diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index 23ea3f91e..b886d4f6b 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -823,5 +823,6 @@ "HeaderOtherDisplaySettings": "Display Settings", "HeaderLibraryViews": "Library Views", "LabelSelectFolderGroups": "Automatically group content from the following folders into views such as Movies, Music and TV:", - "LabelSelectFolderGroupsHelp": "Folders that are unchecked will be displayed by themselves in their own view." + "LabelSelectFolderGroupsHelp": "Folders that are unchecked will be displayed by themselves in their own view.", + "OptionDisplayAdultContent": "Display adult content" } \ No newline at end of file