jellyfin/MediaBrowser.Controller/Entities/InternalItemsQuery.cs

244 lines
8.7 KiB
C#
Raw Normal View History

2015-07-28 19:42:24 +00:00
using MediaBrowser.Model.Entities;
using System;
2015-07-28 19:42:24 +00:00
using System.Collections.Generic;
2015-11-06 15:02:22 +00:00
using MediaBrowser.Model.Configuration;
2016-10-08 05:57:38 +00:00
using System.Linq;
2016-10-10 18:18:28 +00:00
using MediaBrowser.Controller.Dto;
2016-10-08 05:57:38 +00:00
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Controller.Entities
{
2014-10-06 23:58:46 +00:00
public class InternalItemsQuery
{
public bool Recursive { get; set; }
public int? StartIndex { get; set; }
public int? Limit { get; set; }
public string[] SortBy { get; set; }
public SortOrder SortOrder { get; set; }
public User User { get; set; }
2016-06-01 05:50:00 +00:00
public BaseItem SimilarTo { get; set; }
public bool? IsFolder { get; set; }
public bool? IsFavorite { get; set; }
2014-10-06 23:58:46 +00:00
public bool? IsFavoriteOrLiked { get; set; }
public bool? IsLiked { get; set; }
public bool? IsPlayed { get; set; }
public bool? IsResumable { get; set; }
2016-02-14 17:58:31 +00:00
public bool? IncludeItemsByName { get; set; }
public string[] MediaTypes { get; set; }
2014-10-06 23:58:46 +00:00
public string[] IncludeItemTypes { get; set; }
public string[] ExcludeItemTypes { get; set; }
2015-11-15 22:30:47 +00:00
public string[] ExcludeTags { get; set; }
2016-04-15 02:39:39 +00:00
public string[] ExcludeInheritedTags { get; set; }
2014-10-08 01:37:45 +00:00
public string[] Genres { get; set; }
2016-08-18 05:56:10 +00:00
public bool? IsSpecialSeason { get; set; }
2014-10-08 01:37:45 +00:00
public bool? IsMissing { get; set; }
public bool? IsUnaired { get; set; }
public bool? CollapseBoxSetItems { get; set; }
public string NameStartsWithOrGreater { get; set; }
public string NameStartsWith { get; set; }
public string NameLessThan { get; set; }
2015-07-18 19:32:59 +00:00
public string NameContains { get; set; }
2016-06-29 16:31:01 +00:00
public string MinSortName { get; set; }
2014-10-08 01:37:45 +00:00
2016-05-02 05:32:04 +00:00
public string PresentationUniqueKey { get; set; }
2016-03-01 19:39:46 +00:00
public string Path { get; set; }
2016-08-18 05:56:10 +00:00
public string PathNotStartsWith { get; set; }
2016-05-04 16:32:34 +00:00
public string Name { get; set; }
2014-10-08 01:37:45 +00:00
public string Person { get; set; }
2015-03-18 16:40:16 +00:00
public string[] PersonIds { get; set; }
2015-07-14 19:04:16 +00:00
public string[] ItemIds { get; set; }
2016-05-31 18:42:32 +00:00
public string[] ExcludeItemIds { get; set; }
2014-10-08 01:37:45 +00:00
public string AdjacentTo { get; set; }
public string[] PersonTypes { get; set; }
public bool? Is3D { get; set; }
public bool? IsHD { get; set; }
public bool? IsInBoxSet { get; set; }
public bool? IsLocked { get; set; }
public bool? IsPlaceHolder { get; set; }
public bool? HasImdbId { get; set; }
public bool? HasOverview { get; set; }
public bool? HasTmdbId { get; set; }
public bool? HasOfficialRating { get; set; }
public bool? HasTvdbId { get; set; }
public bool? HasThemeSong { get; set; }
public bool? HasThemeVideo { get; set; }
public bool? HasSubtitles { get; set; }
public bool? HasSpecialFeature { get; set; }
public bool? HasTrailer { get; set; }
public bool? HasParentalRating { get; set; }
2015-03-13 18:45:03 +00:00
public string[] StudioIds { get; set; }
2015-11-06 15:02:22 +00:00
public string[] GenreIds { get; set; }
2014-10-08 01:37:45 +00:00
public ImageType[] ImageTypes { get; set; }
public VideoType[] VideoTypes { get; set; }
2015-11-06 15:02:22 +00:00
public UnratedItem[] BlockUnratedItems { get; set; }
2014-10-08 01:37:45 +00:00
public int[] Years { get; set; }
public string[] Tags { get; set; }
public string[] OfficialRatings { get; set; }
2014-10-06 23:58:46 +00:00
2015-10-28 19:40:38 +00:00
public DateTime? MinPremiereDate { get; set; }
2016-03-20 06:46:51 +00:00
public DateTime? MaxPremiereDate { get; set; }
2015-06-01 14:49:23 +00:00
public DateTime? MinStartDate { get; set; }
public DateTime? MaxStartDate { get; set; }
public DateTime? MinEndDate { get; set; }
public DateTime? MaxEndDate { get; set; }
public bool? IsAiring { get; set; }
public bool? IsMovie { get; set; }
public bool? IsSports { get; set; }
2015-06-01 17:49:11 +00:00
public bool? IsKids { get; set; }
2016-09-29 12:55:49 +00:00
public bool? IsNews { get; set; }
public bool? IsSeries { get; set; }
2015-07-14 19:04:16 +00:00
public int? MinPlayers { get; set; }
public int? MaxPlayers { get; set; }
2015-11-06 15:53:23 +00:00
public int? MinIndexNumber { get; set; }
2016-03-20 20:04:27 +00:00
public int? AiredDuringSeason { get; set; }
2015-07-14 19:04:16 +00:00
public double? MinCriticRating { get; set; }
public double? MinCommunityRating { get; set; }
2016-03-01 18:42:39 +00:00
2015-06-01 14:49:23 +00:00
public string[] ChannelIds { get; set; }
2015-07-14 19:04:16 +00:00
internal List<Guid> ItemIdsFromPersonFilters { get; set; }
2016-03-20 19:53:22 +00:00
public int? ParentIndexNumber { get; set; }
2016-06-15 02:18:19 +00:00
public int? ParentIndexNumberNotEquals { get; set; }
2016-05-04 16:32:34 +00:00
public int? IndexNumber { get; set; }
2016-03-21 03:10:37 +00:00
public int? MinParentalRating { get; set; }
2015-07-28 12:33:30 +00:00
public int? MaxParentalRating { get; set; }
2015-07-14 19:04:16 +00:00
2015-08-28 04:19:08 +00:00
public bool? HasDeadParentId { get; set; }
2016-06-12 05:03:52 +00:00
public bool? IsVirtualItem { get; set; }
2015-09-16 17:16:39 +00:00
2015-09-24 02:31:40 +00:00
public Guid? ParentId { get; set; }
2017-05-23 16:43:24 +00:00
public string ParentType { get; set; }
2015-10-29 13:28:05 +00:00
public string[] AncestorIds { get; set; }
2015-11-14 18:57:26 +00:00
public string[] TopParentIds { get; set; }
2015-10-29 19:01:04 +00:00
2017-05-23 16:43:24 +00:00
public BaseItem Parent
{
set
{
if (value == null)
{
ParentId = null;
ParentType = null;
}
else
{
ParentId = value.Id;
ParentType = value.GetType().Name;
}
}
}
2016-03-01 18:42:39 +00:00
public string[] PresetViews { get; set; }
2016-03-19 19:32:37 +00:00
public TrailerType[] TrailerTypes { get; set; }
2017-06-09 19:26:54 +00:00
public SourceType[] SourceTypes { get; set; }
2016-03-01 18:42:39 +00:00
2016-03-20 19:53:22 +00:00
public SeriesStatus[] SeriesStatuses { get; set; }
2016-10-01 07:06:00 +00:00
public string ExternalSeriesId { get; set; }
public string ExternalId { get; set; }
2016-03-21 00:15:56 +00:00
public string[] AlbumIds { get; set; }
2016-12-20 19:59:25 +00:00
public string[] ArtistIds { get; set; }
2016-07-22 22:10:39 +00:00
public string[] ExcludeArtistIds { get; set; }
2016-05-07 17:47:41 +00:00
public string AncestorWithPresentationUniqueKey { get; set; }
2016-12-06 08:24:29 +00:00
public string SeriesPresentationUniqueKey { get; set; }
2016-05-06 04:50:39 +00:00
public bool GroupByPresentationUniqueKey { get; set; }
2017-08-01 16:45:57 +00:00
public bool GroupBySeriesPresentationUniqueKey { get; set; }
2016-05-09 03:13:38 +00:00
public bool EnableTotalRecordCount { get; set; }
2016-05-18 05:34:10 +00:00
public bool ForceDirect { get; set; }
2016-06-15 02:18:19 +00:00
public Dictionary<string, string> ExcludeProviderIds { get; set; }
2016-06-29 03:17:27 +00:00
public bool EnableGroupByMetadataKey { get; set; }
2016-05-06 04:50:39 +00:00
2016-09-30 06:50:06 +00:00
public List<Tuple<string, SortOrder>> OrderBy { get; set; }
2016-10-03 06:28:45 +00:00
public DateTime? MinDateCreated { get; set; }
public DateTime? MinDateLastSaved { get; set; }
2017-05-23 16:43:24 +00:00
public DateTime? MinDateLastSavedForUser { get; set; }
2016-10-03 06:28:45 +00:00
2016-10-10 18:18:28 +00:00
public DtoOptions DtoOptions { get; set; }
2017-01-07 08:04:54 +00:00
public int MinSimilarityScore { get; set; }
2016-10-08 05:57:38 +00:00
2014-10-06 23:58:46 +00:00
public InternalItemsQuery()
{
2017-01-21 20:27:07 +00:00
MinSimilarityScore = 20;
2017-01-07 08:04:54 +00:00
2016-05-06 04:50:39 +00:00
GroupByPresentationUniqueKey = true;
2016-05-09 03:13:38 +00:00
EnableTotalRecordCount = true;
2016-05-06 04:50:39 +00:00
2016-10-10 18:18:28 +00:00
DtoOptions = new DtoOptions();
AlbumIds = new string[] { };
2016-12-20 19:59:25 +00:00
ArtistIds = new string[] { };
2016-07-22 22:10:39 +00:00
ExcludeArtistIds = new string[] { };
2016-06-02 04:41:12 +00:00
ExcludeProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
2015-11-06 15:02:22 +00:00
BlockUnratedItems = new UnratedItem[] { };
Tags = new string[] { };
OfficialRatings = new string[] { };
SortBy = new string[] { };
MediaTypes = new string[] { };
2014-10-06 23:58:46 +00:00
IncludeItemTypes = new string[] { };
ExcludeItemTypes = new string[] { };
2014-10-08 01:37:45 +00:00
Genres = new string[] { };
2015-03-13 18:45:03 +00:00
StudioIds = new string[] { };
2015-11-06 15:02:22 +00:00
GenreIds = new string[] { };
2014-10-08 01:37:45 +00:00
ImageTypes = new ImageType[] { };
VideoTypes = new VideoType[] { };
Years = new int[] { };
PersonTypes = new string[] { };
2015-03-18 16:40:16 +00:00
PersonIds = new string[] { };
2015-06-01 14:49:23 +00:00
ChannelIds = new string[] { };
2015-07-14 19:04:16 +00:00
ItemIds = new string[] { };
2016-05-31 18:42:32 +00:00
ExcludeItemIds = new string[] { };
2015-10-29 13:28:05 +00:00
AncestorIds = new string[] { };
2015-11-14 18:57:26 +00:00
TopParentIds = new string[] { };
2015-11-15 22:30:47 +00:00
ExcludeTags = new string[] { };
2016-04-15 02:39:39 +00:00
ExcludeInheritedTags = new string[] { };
2016-03-01 18:42:39 +00:00
PresetViews = new string[] { };
2016-03-19 19:32:37 +00:00
TrailerTypes = new TrailerType[] { };
2017-06-09 19:26:54 +00:00
SourceTypes = new SourceType[] { };
2016-03-20 19:53:22 +00:00
SeriesStatuses = new SeriesStatus[] { };
2016-09-30 06:50:06 +00:00
OrderBy = new List<Tuple<string, SortOrder>>();
}
2015-10-28 19:40:38 +00:00
public InternalItemsQuery(User user)
: this()
2016-05-15 19:25:54 +00:00
{
SetUser(user);
}
public void SetUser(User user)
2015-10-28 19:40:38 +00:00
{
if (user != null)
{
var policy = user.Policy;
MaxParentalRating = policy.MaxParentalRating;
2015-10-29 13:28:05 +00:00
2015-11-15 22:30:47 +00:00
if (policy.MaxParentalRating.HasValue)
{
2017-05-15 02:28:32 +00:00
BlockUnratedItems = policy.BlockUnratedItems.Where(i => i != UnratedItem.Other).ToArray();
2015-11-15 22:30:47 +00:00
}
2016-04-15 02:39:39 +00:00
ExcludeInheritedTags = policy.BlockedTags;
2016-03-01 18:42:39 +00:00
2015-10-29 13:28:05 +00:00
User = user;
2015-10-28 19:40:38 +00:00
}
}
}
}