| | 1 | | #pragma warning disable CA1044, CA1819, CA2227, CS1591 |
| | 2 | |
|
| | 3 | | using System; |
| | 4 | | using System.Collections.Generic; |
| | 5 | | using System.Linq; |
| | 6 | | using Jellyfin.Data.Entities; |
| | 7 | | using Jellyfin.Data.Enums; |
| | 8 | | using MediaBrowser.Controller.Dto; |
| | 9 | | using MediaBrowser.Model.Entities; |
| | 10 | |
|
| | 11 | | namespace MediaBrowser.Controller.Entities |
| | 12 | | { |
| | 13 | | public class InternalItemsQuery |
| | 14 | | { |
| | 15 | | public InternalItemsQuery() |
| | 16 | | { |
| 351 | 17 | | AlbumArtistIds = Array.Empty<Guid>(); |
| 351 | 18 | | AlbumIds = Array.Empty<Guid>(); |
| 351 | 19 | | AncestorIds = Array.Empty<Guid>(); |
| 351 | 20 | | ArtistIds = Array.Empty<Guid>(); |
| 351 | 21 | | BlockUnratedItems = Array.Empty<UnratedItem>(); |
| 351 | 22 | | BoxSetLibraryFolders = Array.Empty<Guid>(); |
| 351 | 23 | | ChannelIds = Array.Empty<Guid>(); |
| 351 | 24 | | ContributingArtistIds = Array.Empty<Guid>(); |
| 351 | 25 | | DtoOptions = new DtoOptions(); |
| 351 | 26 | | EnableTotalRecordCount = true; |
| 351 | 27 | | ExcludeArtistIds = Array.Empty<Guid>(); |
| 351 | 28 | | ExcludeInheritedTags = Array.Empty<string>(); |
| 351 | 29 | | IncludeInheritedTags = Array.Empty<string>(); |
| 351 | 30 | | ExcludeItemIds = Array.Empty<Guid>(); |
| 351 | 31 | | ExcludeItemTypes = Array.Empty<BaseItemKind>(); |
| 351 | 32 | | ExcludeTags = Array.Empty<string>(); |
| 351 | 33 | | GenreIds = Array.Empty<Guid>(); |
| 351 | 34 | | Genres = Array.Empty<string>(); |
| 351 | 35 | | GroupByPresentationUniqueKey = true; |
| 351 | 36 | | ImageTypes = Array.Empty<ImageType>(); |
| 351 | 37 | | IncludeItemTypes = Array.Empty<BaseItemKind>(); |
| 351 | 38 | | ItemIds = Array.Empty<Guid>(); |
| 351 | 39 | | MediaTypes = Array.Empty<MediaType>(); |
| 351 | 40 | | MinSimilarityScore = 20; |
| 351 | 41 | | OfficialRatings = Array.Empty<string>(); |
| 351 | 42 | | OrderBy = Array.Empty<(ItemSortBy, SortOrder)>(); |
| 351 | 43 | | PersonIds = Array.Empty<Guid>(); |
| 351 | 44 | | PersonTypes = Array.Empty<string>(); |
| 351 | 45 | | PresetViews = Array.Empty<CollectionType?>(); |
| 351 | 46 | | SeriesStatuses = Array.Empty<SeriesStatus>(); |
| 351 | 47 | | SourceTypes = Array.Empty<SourceType>(); |
| 351 | 48 | | StudioIds = Array.Empty<Guid>(); |
| 351 | 49 | | Tags = Array.Empty<string>(); |
| 351 | 50 | | TopParentIds = Array.Empty<Guid>(); |
| 351 | 51 | | TrailerTypes = Array.Empty<TrailerType>(); |
| 351 | 52 | | VideoTypes = Array.Empty<VideoType>(); |
| 351 | 53 | | Years = Array.Empty<int>(); |
| 351 | 54 | | SkipDeserialization = false; |
| 351 | 55 | | } |
| | 56 | |
|
| | 57 | | public InternalItemsQuery(User? user) |
| 17 | 58 | | : this() |
| | 59 | | { |
| 17 | 60 | | if (user is not null) |
| | 61 | | { |
| 17 | 62 | | SetUser(user); |
| | 63 | | } |
| 17 | 64 | | } |
| | 65 | |
|
| | 66 | | public bool Recursive { get; set; } |
| | 67 | |
|
| | 68 | | public int? StartIndex { get; set; } |
| | 69 | |
|
| | 70 | | public int? Limit { get; set; } |
| | 71 | |
|
| | 72 | | public User? User { get; set; } |
| | 73 | |
|
| | 74 | | public BaseItem? SimilarTo { get; set; } |
| | 75 | |
|
| | 76 | | public bool? IsFolder { get; set; } |
| | 77 | |
|
| | 78 | | public bool? IsFavorite { get; set; } |
| | 79 | |
|
| | 80 | | public bool? IsFavoriteOrLiked { get; set; } |
| | 81 | |
|
| | 82 | | public bool? IsLiked { get; set; } |
| | 83 | |
|
| | 84 | | public bool? IsPlayed { get; set; } |
| | 85 | |
|
| | 86 | | public bool? IsResumable { get; set; } |
| | 87 | |
|
| | 88 | | public bool? IncludeItemsByName { get; set; } |
| | 89 | |
|
| | 90 | | public MediaType[] MediaTypes { get; set; } |
| | 91 | |
|
| | 92 | | public BaseItemKind[] IncludeItemTypes { get; set; } |
| | 93 | |
|
| | 94 | | public BaseItemKind[] ExcludeItemTypes { get; set; } |
| | 95 | |
|
| | 96 | | public string[] ExcludeTags { get; set; } |
| | 97 | |
|
| | 98 | | public string[] ExcludeInheritedTags { get; set; } |
| | 99 | |
|
| | 100 | | public string[] IncludeInheritedTags { get; set; } |
| | 101 | |
|
| | 102 | | public IReadOnlyList<string> Genres { get; set; } |
| | 103 | |
|
| | 104 | | public bool? IsSpecialSeason { get; set; } |
| | 105 | |
|
| | 106 | | public bool? IsMissing { get; set; } |
| | 107 | |
|
| | 108 | | public bool? IsUnaired { get; set; } |
| | 109 | |
|
| | 110 | | public bool? CollapseBoxSetItems { get; set; } |
| | 111 | |
|
| | 112 | | public string? NameStartsWithOrGreater { get; set; } |
| | 113 | |
|
| | 114 | | public string? NameStartsWith { get; set; } |
| | 115 | |
|
| | 116 | | public string? NameLessThan { get; set; } |
| | 117 | |
|
| | 118 | | public string? NameContains { get; set; } |
| | 119 | |
|
| | 120 | | public string? MinSortName { get; set; } |
| | 121 | |
|
| | 122 | | public string? PresentationUniqueKey { get; set; } |
| | 123 | |
|
| | 124 | | public string? Path { get; set; } |
| | 125 | |
|
| | 126 | | public string? Name { get; set; } |
| | 127 | |
|
| | 128 | | public string? Person { get; set; } |
| | 129 | |
|
| | 130 | | public Guid[] PersonIds { get; set; } |
| | 131 | |
|
| | 132 | | public Guid[] ItemIds { get; set; } |
| | 133 | |
|
| | 134 | | public Guid[] ExcludeItemIds { get; set; } |
| | 135 | |
|
| | 136 | | public Guid? AdjacentTo { get; set; } |
| | 137 | |
|
| | 138 | | public string[] PersonTypes { get; set; } |
| | 139 | |
|
| | 140 | | public bool? Is3D { get; set; } |
| | 141 | |
|
| | 142 | | public bool? IsHD { get; set; } |
| | 143 | |
|
| | 144 | | public bool? IsLocked { get; set; } |
| | 145 | |
|
| | 146 | | public bool? IsPlaceHolder { get; set; } |
| | 147 | |
|
| | 148 | | public bool? HasImdbId { get; set; } |
| | 149 | |
|
| | 150 | | public bool? HasOverview { get; set; } |
| | 151 | |
|
| | 152 | | public bool? HasTmdbId { get; set; } |
| | 153 | |
|
| | 154 | | public bool? HasOfficialRating { get; set; } |
| | 155 | |
|
| | 156 | | public bool? HasTvdbId { get; set; } |
| | 157 | |
|
| | 158 | | public bool? HasThemeSong { get; set; } |
| | 159 | |
|
| | 160 | | public bool? HasThemeVideo { get; set; } |
| | 161 | |
|
| | 162 | | public bool? HasSubtitles { get; set; } |
| | 163 | |
|
| | 164 | | public bool? HasSpecialFeature { get; set; } |
| | 165 | |
|
| | 166 | | public bool? HasTrailer { get; set; } |
| | 167 | |
|
| | 168 | | public bool? HasParentalRating { get; set; } |
| | 169 | |
|
| | 170 | | public Guid[] StudioIds { get; set; } |
| | 171 | |
|
| | 172 | | public IReadOnlyList<Guid> GenreIds { get; set; } |
| | 173 | |
|
| | 174 | | public ImageType[] ImageTypes { get; set; } |
| | 175 | |
|
| | 176 | | public VideoType[] VideoTypes { get; set; } |
| | 177 | |
|
| | 178 | | public UnratedItem[] BlockUnratedItems { get; set; } |
| | 179 | |
|
| | 180 | | public int[] Years { get; set; } |
| | 181 | |
|
| | 182 | | public string[] Tags { get; set; } |
| | 183 | |
|
| | 184 | | public string[] OfficialRatings { get; set; } |
| | 185 | |
|
| | 186 | | public DateTime? MinPremiereDate { get; set; } |
| | 187 | |
|
| | 188 | | public DateTime? MaxPremiereDate { get; set; } |
| | 189 | |
|
| | 190 | | public DateTime? MinStartDate { get; set; } |
| | 191 | |
|
| | 192 | | public DateTime? MaxStartDate { get; set; } |
| | 193 | |
|
| | 194 | | public DateTime? MinEndDate { get; set; } |
| | 195 | |
|
| | 196 | | public DateTime? MaxEndDate { get; set; } |
| | 197 | |
|
| | 198 | | public bool? IsAiring { get; set; } |
| | 199 | |
|
| | 200 | | public bool? IsMovie { get; set; } |
| | 201 | |
|
| | 202 | | public bool? IsSports { get; set; } |
| | 203 | |
|
| | 204 | | public bool? IsKids { get; set; } |
| | 205 | |
|
| | 206 | | public bool? IsNews { get; set; } |
| | 207 | |
|
| | 208 | | public bool? IsSeries { get; set; } |
| | 209 | |
|
| | 210 | | public int? MinIndexNumber { get; set; } |
| | 211 | |
|
| | 212 | | /// <summary> |
| | 213 | | /// Gets or sets the minimum ParentIndexNumber and IndexNumber. |
| | 214 | | /// </summary> |
| | 215 | | /// <remarks> |
| | 216 | | /// It produces this where clause: |
| | 217 | | /// <para>(ParentIndexNumber = X and IndexNumber >= Y) or ParentIndexNumber > X. |
| | 218 | | /// </para> |
| | 219 | | /// </remarks> |
| | 220 | | public (int ParentIndexNumber, int IndexNumber)? MinParentAndIndexNumber { get; set; } |
| | 221 | |
|
| | 222 | | public int? AiredDuringSeason { get; set; } |
| | 223 | |
|
| | 224 | | public double? MinCriticRating { get; set; } |
| | 225 | |
|
| | 226 | | public double? MinCommunityRating { get; set; } |
| | 227 | |
|
| | 228 | | public IReadOnlyList<Guid> ChannelIds { get; set; } |
| | 229 | |
|
| | 230 | | public int? ParentIndexNumber { get; set; } |
| | 231 | |
|
| | 232 | | public int? ParentIndexNumberNotEquals { get; set; } |
| | 233 | |
|
| | 234 | | public int? IndexNumber { get; set; } |
| | 235 | |
|
| | 236 | | public int? MinParentalRating { get; set; } |
| | 237 | |
|
| | 238 | | public int? MaxParentalRating { get; set; } |
| | 239 | |
|
| | 240 | | public bool? HasDeadParentId { get; set; } |
| | 241 | |
|
| | 242 | | public bool? IsVirtualItem { get; set; } |
| | 243 | |
|
| | 244 | | public Guid ParentId { get; set; } |
| | 245 | |
|
| | 246 | | public BaseItemKind? ParentType { get; set; } |
| | 247 | |
|
| | 248 | | public Guid[] AncestorIds { get; set; } |
| | 249 | |
|
| | 250 | | public Guid[] TopParentIds { get; set; } |
| | 251 | |
|
| | 252 | | public CollectionType?[] PresetViews { get; set; } |
| | 253 | |
|
| | 254 | | public TrailerType[] TrailerTypes { get; set; } |
| | 255 | |
|
| | 256 | | public SourceType[] SourceTypes { get; set; } |
| | 257 | |
|
| | 258 | | public SeriesStatus[] SeriesStatuses { get; set; } |
| | 259 | |
|
| | 260 | | public string? ExternalSeriesId { get; set; } |
| | 261 | |
|
| | 262 | | public string? ExternalId { get; set; } |
| | 263 | |
|
| | 264 | | public Guid[] AlbumIds { get; set; } |
| | 265 | |
|
| | 266 | | public Guid[] ArtistIds { get; set; } |
| | 267 | |
|
| | 268 | | public Guid[] ExcludeArtistIds { get; set; } |
| | 269 | |
|
| | 270 | | public string? AncestorWithPresentationUniqueKey { get; set; } |
| | 271 | |
|
| | 272 | | public string? SeriesPresentationUniqueKey { get; set; } |
| | 273 | |
|
| | 274 | | public bool GroupByPresentationUniqueKey { get; set; } |
| | 275 | |
|
| | 276 | | public bool GroupBySeriesPresentationUniqueKey { get; set; } |
| | 277 | |
|
| | 278 | | public bool EnableTotalRecordCount { get; set; } |
| | 279 | |
|
| | 280 | | public bool ForceDirect { get; set; } |
| | 281 | |
|
| | 282 | | public Dictionary<string, string>? ExcludeProviderIds { get; set; } |
| | 283 | |
|
| | 284 | | public bool EnableGroupByMetadataKey { get; set; } |
| | 285 | |
|
| | 286 | | public bool? HasChapterImages { get; set; } |
| | 287 | |
|
| | 288 | | public IReadOnlyList<(ItemSortBy OrderBy, SortOrder SortOrder)> OrderBy { get; set; } |
| | 289 | |
|
| | 290 | | public DateTime? MinDateCreated { get; set; } |
| | 291 | |
|
| | 292 | | public DateTime? MinDateLastSaved { get; set; } |
| | 293 | |
|
| | 294 | | public DateTime? MinDateLastSavedForUser { get; set; } |
| | 295 | |
|
| | 296 | | public DtoOptions DtoOptions { get; set; } |
| | 297 | |
|
| | 298 | | public int MinSimilarityScore { get; set; } |
| | 299 | |
|
| | 300 | | public string? HasNoAudioTrackWithLanguage { get; set; } |
| | 301 | |
|
| | 302 | | public string? HasNoInternalSubtitleTrackWithLanguage { get; set; } |
| | 303 | |
|
| | 304 | | public string? HasNoExternalSubtitleTrackWithLanguage { get; set; } |
| | 305 | |
|
| | 306 | | public string? HasNoSubtitleTrackWithLanguage { get; set; } |
| | 307 | |
|
| | 308 | | public bool? IsDeadArtist { get; set; } |
| | 309 | |
|
| | 310 | | public bool? IsDeadStudio { get; set; } |
| | 311 | |
|
| | 312 | | public bool? IsDeadPerson { get; set; } |
| | 313 | |
|
| | 314 | | /// <summary> |
| | 315 | | /// Gets or sets a value indicating whether album sub-folders should be returned if they exist. |
| | 316 | | /// </summary> |
| | 317 | | public bool? DisplayAlbumFolders { get; set; } |
| | 318 | |
|
| | 319 | | public BaseItem? Parent |
| | 320 | | { |
| | 321 | | set |
| | 322 | | { |
| 247 | 323 | | if (value is null) |
| | 324 | | { |
| 30 | 325 | | ParentId = Guid.Empty; |
| 30 | 326 | | ParentType = null; |
| | 327 | | } |
| | 328 | | else |
| | 329 | | { |
| 217 | 330 | | ParentId = value.Id; |
| 217 | 331 | | ParentType = value.GetBaseItemKind(); |
| | 332 | | } |
| 217 | 333 | | } |
| | 334 | | } |
| | 335 | |
|
| | 336 | | public Dictionary<string, string>? HasAnyProviderId { get; set; } |
| | 337 | |
|
| | 338 | | public Guid[] AlbumArtistIds { get; set; } |
| | 339 | |
|
| | 340 | | public Guid[] BoxSetLibraryFolders { get; set; } |
| | 341 | |
|
| | 342 | | public Guid[] ContributingArtistIds { get; set; } |
| | 343 | |
|
| | 344 | | public bool? HasAired { get; set; } |
| | 345 | |
|
| | 346 | | public bool? HasOwnerId { get; set; } |
| | 347 | |
|
| | 348 | | public bool? Is4K { get; set; } |
| | 349 | |
|
| | 350 | | public int? MaxHeight { get; set; } |
| | 351 | |
|
| | 352 | | public int? MaxWidth { get; set; } |
| | 353 | |
|
| | 354 | | public int? MinHeight { get; set; } |
| | 355 | |
|
| | 356 | | public int? MinWidth { get; set; } |
| | 357 | |
|
| | 358 | | public string? SearchTerm { get; set; } |
| | 359 | |
|
| | 360 | | public string? SeriesTimerId { get; set; } |
| | 361 | |
|
| | 362 | | public bool SkipDeserialization { get; set; } |
| | 363 | |
|
| | 364 | | public void SetUser(User user) |
| | 365 | | { |
| 17 | 366 | | MaxParentalRating = user.MaxParentalAgeRating; |
| | 367 | |
|
| 17 | 368 | | if (MaxParentalRating.HasValue) |
| | 369 | | { |
| 0 | 370 | | string other = UnratedItem.Other.ToString(); |
| 0 | 371 | | BlockUnratedItems = user.GetPreference(PreferenceKind.BlockUnratedItems) |
| 0 | 372 | | .Where(i => i != other) |
| 0 | 373 | | .Select(e => Enum.Parse<UnratedItem>(e, true)).ToArray(); |
| | 374 | | } |
| | 375 | |
|
| 17 | 376 | | ExcludeInheritedTags = user.GetPreference(PreferenceKind.BlockedTags); |
| 17 | 377 | | IncludeInheritedTags = user.GetPreference(PreferenceKind.AllowedTags); |
| | 378 | |
|
| 17 | 379 | | User = user; |
| 17 | 380 | | } |
| | 381 | | } |
| | 382 | | } |