jellyfin-server/MediaBrowser.Controller/Entities/InternalItemsQuery.cs

366 lines
10 KiB
C#
Raw Normal View History

2021-07-23 23:36:27 +00:00
#pragma warning disable CA1044, CA1819, CA2227, CS1591
using System;
2018-12-27 23:27:57 +00:00
using System.Collections.Generic;
using System.Linq;
2020-05-20 17:07:53 +00:00
using Jellyfin.Data.Entities;
2020-05-13 02:10:35 +00:00
using Jellyfin.Data.Enums;
2018-12-27 23:27:57 +00:00
using MediaBrowser.Controller.Dto;
using MediaBrowser.Model.Entities;
2018-12-27 23:27:57 +00:00
namespace MediaBrowser.Controller.Entities
{
public class InternalItemsQuery
{
2021-07-23 23:36:27 +00:00
public InternalItemsQuery()
{
AlbumArtistIds = Array.Empty<Guid>();
AlbumIds = Array.Empty<Guid>();
AncestorIds = Array.Empty<Guid>();
ArtistIds = Array.Empty<Guid>();
BlockUnratedItems = Array.Empty<UnratedItem>();
BoxSetLibraryFolders = Array.Empty<Guid>();
ChannelIds = Array.Empty<Guid>();
ContributingArtistIds = Array.Empty<Guid>();
DtoOptions = new DtoOptions();
EnableTotalRecordCount = true;
ExcludeArtistIds = Array.Empty<Guid>();
ExcludeInheritedTags = Array.Empty<string>();
ExcludeItemIds = Array.Empty<Guid>();
ExcludeItemTypes = Array.Empty<string>();
ExcludeTags = Array.Empty<string>();
GenreIds = Array.Empty<Guid>();
Genres = Array.Empty<string>();
GroupByPresentationUniqueKey = true;
ImageTypes = Array.Empty<ImageType>();
IncludeItemTypes = Array.Empty<string>();
ItemIds = Array.Empty<Guid>();
MediaTypes = Array.Empty<string>();
MinSimilarityScore = 20;
OfficialRatings = Array.Empty<string>();
OrderBy = Array.Empty<ValueTuple<string, SortOrder>>();
PersonIds = Array.Empty<Guid>();
PersonTypes = Array.Empty<string>();
PresetViews = Array.Empty<string>();
SeriesStatuses = Array.Empty<SeriesStatus>();
SourceTypes = Array.Empty<SourceType>();
StudioIds = Array.Empty<Guid>();
Tags = Array.Empty<string>();
TopParentIds = Array.Empty<Guid>();
TrailerTypes = Array.Empty<TrailerType>();
VideoTypes = Array.Empty<VideoType>();
Years = Array.Empty<int>();
}
public InternalItemsQuery(User? user)
: this()
{
if (user != null)
{
SetUser(user);
}
}
2018-12-27 23:27:57 +00:00
public bool Recursive { get; set; }
public int? StartIndex { get; set; }
public int? Limit { get; set; }
2021-05-18 10:23:26 +00:00
public User? User { get; set; }
2018-12-27 23:27:57 +00:00
2021-05-18 10:23:26 +00:00
public BaseItem? SimilarTo { get; set; }
2018-12-27 23:27:57 +00:00
public bool? IsFolder { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsFavorite { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsFavoriteOrLiked { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsLiked { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsPlayed { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsResumable { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IncludeItemsByName { get; set; }
public string[] MediaTypes { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public string[] IncludeItemTypes { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public string[] ExcludeItemTypes { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public string[] ExcludeTags { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public string[] ExcludeInheritedTags { get; set; }
2020-06-15 21:43:52 +00:00
public IReadOnlyList<string> Genres { get; set; }
2018-12-27 23:27:57 +00:00
public bool? IsSpecialSeason { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsMissing { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsUnaired { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? CollapseBoxSetItems { get; set; }
2021-05-18 10:23:26 +00:00
public string? NameStartsWithOrGreater { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? NameStartsWith { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? NameLessThan { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? NameContains { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? MinSortName { get; set; }
2018-12-27 23:27:57 +00:00
2021-05-18 10:23:26 +00:00
public string? PresentationUniqueKey { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? Path { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? Name { get; set; }
2018-12-27 23:27:57 +00:00
2021-05-18 10:23:26 +00:00
public string? Person { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public Guid[] PersonIds { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public Guid[] ItemIds { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public Guid[] ExcludeItemIds { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? AdjacentTo { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public string[] PersonTypes { get; set; }
public bool? Is3D { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsHD { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsLocked { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsPlaceHolder { get; set; }
public bool? HasImdbId { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? HasOverview { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? HasTmdbId { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? HasOfficialRating { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? HasTvdbId { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? HasThemeSong { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? HasThemeVideo { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? HasSubtitles { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? HasSpecialFeature { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? HasTrailer { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? HasParentalRating { get; set; }
public Guid[] StudioIds { get; set; }
2020-06-15 21:43:52 +00:00
public IReadOnlyList<Guid> GenreIds { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public ImageType[] ImageTypes { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public VideoType[] VideoTypes { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public UnratedItem[] BlockUnratedItems { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public int[] Years { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public string[] Tags { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public string[] OfficialRatings { get; set; }
public DateTime? MinPremiereDate { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public DateTime? MaxPremiereDate { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public DateTime? MinStartDate { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public DateTime? MaxStartDate { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public DateTime? MinEndDate { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public DateTime? MaxEndDate { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsAiring { get; set; }
public bool? IsMovie { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsSports { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsKids { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsNews { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsSeries { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public int? MinIndexNumber { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public int? AiredDuringSeason { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public double? MinCriticRating { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public double? MinCommunityRating { get; set; }
public IReadOnlyList<Guid> ChannelIds { get; set; }
2018-12-27 23:27:57 +00:00
public int? ParentIndexNumber { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public int? ParentIndexNumberNotEquals { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public int? IndexNumber { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public int? MinParentalRating { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public int? MaxParentalRating { get; set; }
public bool? HasDeadParentId { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsVirtualItem { get; set; }
public Guid ParentId { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? ParentType { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public Guid[] AncestorIds { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public Guid[] TopParentIds { get; set; }
public string[] PresetViews { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public TrailerType[] TrailerTypes { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public SourceType[] SourceTypes { get; set; }
public SeriesStatus[] SeriesStatuses { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? ExternalSeriesId { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? ExternalId { get; set; }
2018-12-27 23:27:57 +00:00
public Guid[] AlbumIds { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public Guid[] ArtistIds { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public Guid[] ExcludeArtistIds { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? AncestorWithPresentationUniqueKey { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? SeriesPresentationUniqueKey { get; set; }
2018-12-27 23:27:57 +00:00
public bool GroupByPresentationUniqueKey { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool GroupBySeriesPresentationUniqueKey { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool EnableTotalRecordCount { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool ForceDirect { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public Dictionary<string, string>? ExcludeProviderIds { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool EnableGroupByMetadataKey { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? HasChapterImages { get; set; }
2019-10-20 14:08:40 +00:00
public IReadOnlyList<(string, SortOrder)> OrderBy { get; set; }
2018-12-27 23:27:57 +00:00
public DateTime? MinDateCreated { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public DateTime? MinDateLastSaved { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public DateTime? MinDateLastSavedForUser { get; set; }
public DtoOptions DtoOptions { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public int MinSimilarityScore { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? HasNoAudioTrackWithLanguage { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? HasNoInternalSubtitleTrackWithLanguage { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? HasNoExternalSubtitleTrackWithLanguage { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? HasNoSubtitleTrackWithLanguage { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsDeadArtist { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsDeadStudio { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? IsDeadPerson { get; set; }
/// <summary>
/// Gets or sets a value indicating whether album sub-folders should be returned if they exist.
/// </summary>
public bool? DisplayAlbumFolders { get; set; }
public BaseItem? Parent
{
set
{
if (value == null)
{
ParentId = Guid.Empty;
ParentType = null;
}
else
{
ParentId = value.Id;
ParentType = value.GetType().Name;
}
}
}
2021-05-18 10:23:26 +00:00
public Dictionary<string, string>? HasAnyProviderId { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public Guid[] AlbumArtistIds { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public Guid[] BoxSetLibraryFolders { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public Guid[] ContributingArtistIds { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? HasAired { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? HasOwnerId { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public bool? Is4K { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public int? MaxHeight { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public int? MaxWidth { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public int? MinHeight { get; set; }
2020-06-15 21:43:52 +00:00
2018-12-27 23:27:57 +00:00
public int? MinWidth { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? SearchTerm { get; set; }
2020-06-15 21:43:52 +00:00
2021-05-18 10:23:26 +00:00
public string? SeriesTimerId { get; set; }
2021-07-23 23:36:27 +00:00
public void SetUser(User user)
{
MaxParentalRating = user.MaxParentalAgeRating;
if (MaxParentalRating.HasValue)
{
string other = UnratedItem.Other.ToString();
BlockUnratedItems = user.GetPreference(PreferenceKind.BlockUnratedItems)
.Where(i => i != other)
.Select(e => Enum.Parse<UnratedItem>(e, true)).ToArray();
}
ExcludeInheritedTags = user.GetPreference(PreferenceKind.BlockedTags);
User = user;
}
2018-12-27 23:27:57 +00:00
}
}