add adult content filter to catalog
This commit is contained in:
parent
e210825e54
commit
4f0e6f61e7
|
@ -49,7 +49,7 @@ namespace MediaBrowser.Api
|
|||
}
|
||||
|
||||
[Route("/Channels/{Id}/Items", "GET", Summary = "Gets channel items")]
|
||||
public class GetChannelItems : IReturn<QueryResult<BaseItemDto>>
|
||||
public class GetChannelItems : IReturn<QueryResult<BaseItemDto>>, 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; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the filters.
|
||||
/// </summary>
|
||||
|
@ -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;
|
||||
|
||||
|
|
|
@ -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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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<ItemFields> Fields { get; set; }
|
||||
|
||||
public ChannelItemQuery()
|
||||
{
|
||||
Filters = new ItemFilter[] { };
|
||||
SortBy = new string[] { };
|
||||
Fields = new List<ItemFields>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<BaseItemDto>
|
||||
|
|
|
@ -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"
|
||||
}
|
Loading…
Reference in New Issue
Block a user