InternalItemsQuery.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using MediaBrowser.Controller.Dto;
  5. using MediaBrowser.Model.Configuration;
  6. using MediaBrowser.Model.Entities;
  7. namespace MediaBrowser.Controller.Entities
  8. {
  9. public class InternalItemsQuery
  10. {
  11. public bool Recursive { get; set; }
  12. public int? StartIndex { get; set; }
  13. public int? Limit { get; set; }
  14. public User User { get; set; }
  15. public BaseItem SimilarTo { get; set; }
  16. public bool? IsFolder { get; set; }
  17. public bool? IsFavorite { get; set; }
  18. public bool? IsFavoriteOrLiked { get; set; }
  19. public bool? IsLiked { get; set; }
  20. public bool? IsPlayed { get; set; }
  21. public bool? IsResumable { get; set; }
  22. public bool? IncludeItemsByName { get; set; }
  23. public string[] MediaTypes { get; set; }
  24. public string[] IncludeItemTypes { get; set; }
  25. public string[] ExcludeItemTypes { get; set; }
  26. public string[] ExcludeTags { get; set; }
  27. public string[] ExcludeInheritedTags { get; set; }
  28. public string[] Genres { get; set; }
  29. public bool? IsSpecialSeason { get; set; }
  30. public bool? IsMissing { get; set; }
  31. public bool? IsUnaired { get; set; }
  32. public bool? CollapseBoxSetItems { get; set; }
  33. public string NameStartsWithOrGreater { get; set; }
  34. public string NameStartsWith { get; set; }
  35. public string NameLessThan { get; set; }
  36. public string NameContains { get; set; }
  37. public string MinSortName { get; set; }
  38. public string PresentationUniqueKey { get; set; }
  39. public string Path { get; set; }
  40. public string Name { get; set; }
  41. public string Person { get; set; }
  42. public Guid[] PersonIds { get; set; }
  43. public Guid[] ItemIds { get; set; }
  44. public Guid[] ExcludeItemIds { get; set; }
  45. public string AdjacentTo { get; set; }
  46. public string[] PersonTypes { get; set; }
  47. public bool? Is3D { get; set; }
  48. public bool? IsHD { get; set; }
  49. public bool? IsLocked { get; set; }
  50. public bool? IsPlaceHolder { get; set; }
  51. public bool? HasImdbId { get; set; }
  52. public bool? HasOverview { get; set; }
  53. public bool? HasTmdbId { get; set; }
  54. public bool? HasOfficialRating { get; set; }
  55. public bool? HasTvdbId { get; set; }
  56. public bool? HasThemeSong { get; set; }
  57. public bool? HasThemeVideo { get; set; }
  58. public bool? HasSubtitles { get; set; }
  59. public bool? HasSpecialFeature { get; set; }
  60. public bool? HasTrailer { get; set; }
  61. public bool? HasParentalRating { get; set; }
  62. public Guid[] StudioIds { get; set; }
  63. public Guid[] GenreIds { get; set; }
  64. public ImageType[] ImageTypes { get; set; }
  65. public VideoType[] VideoTypes { get; set; }
  66. public UnratedItem[] BlockUnratedItems { get; set; }
  67. public int[] Years { get; set; }
  68. public string[] Tags { get; set; }
  69. public string[] OfficialRatings { get; set; }
  70. public DateTime? MinPremiereDate { get; set; }
  71. public DateTime? MaxPremiereDate { get; set; }
  72. public DateTime? MinStartDate { get; set; }
  73. public DateTime? MaxStartDate { get; set; }
  74. public DateTime? MinEndDate { get; set; }
  75. public DateTime? MaxEndDate { get; set; }
  76. public bool? IsAiring { get; set; }
  77. public bool? IsMovie { get; set; }
  78. public bool? IsSports { get; set; }
  79. public bool? IsKids { get; set; }
  80. public bool? IsNews { get; set; }
  81. public bool? IsSeries { get; set; }
  82. public int? MinIndexNumber { get; set; }
  83. public int? AiredDuringSeason { get; set; }
  84. public double? MinCriticRating { get; set; }
  85. public double? MinCommunityRating { get; set; }
  86. public Guid[] ChannelIds { get; set; }
  87. public int? ParentIndexNumber { get; set; }
  88. public int? ParentIndexNumberNotEquals { get; set; }
  89. public int? IndexNumber { get; set; }
  90. public int? MinParentalRating { get; set; }
  91. public int? MaxParentalRating { get; set; }
  92. public bool? HasDeadParentId { get; set; }
  93. public bool? IsVirtualItem { get; set; }
  94. public Guid ParentId { get; set; }
  95. public string ParentType { get; set; }
  96. public Guid[] AncestorIds { get; set; }
  97. public Guid[] TopParentIds { get; set; }
  98. public BaseItem Parent
  99. {
  100. set
  101. {
  102. if (value == null)
  103. {
  104. ParentId = Guid.Empty;
  105. ParentType = null;
  106. }
  107. else
  108. {
  109. ParentId = value.Id;
  110. ParentType = value.GetType().Name;
  111. }
  112. }
  113. }
  114. public string[] PresetViews { get; set; }
  115. public TrailerType[] TrailerTypes { get; set; }
  116. public SourceType[] SourceTypes { get; set; }
  117. public SeriesStatus[] SeriesStatuses { get; set; }
  118. public string ExternalSeriesId { get; set; }
  119. public string ExternalId { get; set; }
  120. public Guid[] AlbumIds { get; set; }
  121. public Guid[] ArtistIds { get; set; }
  122. public Guid[] ExcludeArtistIds { get; set; }
  123. public string AncestorWithPresentationUniqueKey { get; set; }
  124. public string SeriesPresentationUniqueKey { get; set; }
  125. public bool GroupByPresentationUniqueKey { get; set; }
  126. public bool GroupBySeriesPresentationUniqueKey { get; set; }
  127. public bool EnableTotalRecordCount { get; set; }
  128. public bool ForceDirect { get; set; }
  129. public Dictionary<string, string> ExcludeProviderIds { get; set; }
  130. public bool EnableGroupByMetadataKey { get; set; }
  131. public bool? HasChapterImages { get; set; }
  132. public ValueTuple<string, SortOrder>[] OrderBy { get; set; }
  133. public DateTime? MinDateCreated { get; set; }
  134. public DateTime? MinDateLastSaved { get; set; }
  135. public DateTime? MinDateLastSavedForUser { get; set; }
  136. public DtoOptions DtoOptions { get; set; }
  137. public int MinSimilarityScore { get; set; }
  138. public string HasNoAudioTrackWithLanguage { get; set; }
  139. public string HasNoInternalSubtitleTrackWithLanguage { get; set; }
  140. public string HasNoExternalSubtitleTrackWithLanguage { get; set; }
  141. public string HasNoSubtitleTrackWithLanguage { get; set; }
  142. public bool? IsDeadArtist { get; set; }
  143. public bool? IsDeadStudio { get; set; }
  144. public bool? IsDeadPerson { get; set; }
  145. public InternalItemsQuery()
  146. {
  147. AlbumArtistIds = Array.Empty<Guid>();
  148. AlbumIds = Array.Empty<Guid>();
  149. AncestorIds = Array.Empty<Guid>();
  150. ArtistIds = Array.Empty<Guid>();
  151. BlockUnratedItems = Array.Empty<UnratedItem>();
  152. BoxSetLibraryFolders = Array.Empty<Guid>();
  153. ChannelIds = Array.Empty<Guid>();
  154. ContributingArtistIds = Array.Empty<Guid>();
  155. DtoOptions = new DtoOptions();
  156. EnableTotalRecordCount = true;
  157. ExcludeArtistIds = Array.Empty<Guid>();
  158. ExcludeInheritedTags = Array.Empty<string>();
  159. ExcludeItemIds = Array.Empty<Guid>();
  160. ExcludeItemTypes = Array.Empty<string>();
  161. ExcludeProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
  162. ExcludeTags = Array.Empty<string>();
  163. GenreIds = Array.Empty<Guid>();
  164. Genres = Array.Empty<string>();
  165. GroupByPresentationUniqueKey = true;
  166. HasAnyProviderId = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
  167. ImageTypes = Array.Empty<ImageType>();
  168. IncludeItemTypes = Array.Empty<string>();
  169. ItemIds = Array.Empty<Guid>();
  170. MediaTypes = Array.Empty<string>();
  171. MinSimilarityScore = 20;
  172. OfficialRatings = Array.Empty<string>();
  173. OrderBy = Array.Empty<ValueTuple<string, SortOrder>>();
  174. PersonIds = Array.Empty<Guid>();
  175. PersonTypes = Array.Empty<string>();
  176. PresetViews = Array.Empty<string>();
  177. SeriesStatuses = Array.Empty<SeriesStatus>();
  178. SourceTypes = Array.Empty<SourceType>();
  179. StudioIds = Array.Empty<Guid>();
  180. Tags = Array.Empty<string>();
  181. TopParentIds = Array.Empty<Guid>();
  182. TrailerTypes = Array.Empty<TrailerType>();
  183. VideoTypes = Array.Empty<VideoType>();
  184. Years = Array.Empty<int>();
  185. }
  186. public InternalItemsQuery(User user)
  187. : this()
  188. {
  189. SetUser(user);
  190. }
  191. public void SetUser(User user)
  192. {
  193. if (user != null)
  194. {
  195. var policy = user.Policy;
  196. MaxParentalRating = policy.MaxParentalRating;
  197. if (policy.MaxParentalRating.HasValue)
  198. {
  199. BlockUnratedItems = policy.BlockUnratedItems.Where(i => i != UnratedItem.Other).ToArray();
  200. }
  201. ExcludeInheritedTags = policy.BlockedTags;
  202. User = user;
  203. }
  204. }
  205. public Dictionary<string, string> HasAnyProviderId { get; set; }
  206. public Guid[] AlbumArtistIds { get; set; }
  207. public Guid[] BoxSetLibraryFolders { get; set; }
  208. public Guid[] ContributingArtistIds { get; set; }
  209. public bool? HasAired { get; set; }
  210. public bool? HasOwnerId { get; set; }
  211. public bool? Is4K { get; set; }
  212. public int? MaxHeight { get; set; }
  213. public int? MaxWidth { get; set; }
  214. public int? MinHeight { get; set; }
  215. public int? MinWidth { get; set; }
  216. public string SearchTerm { get; set; }
  217. public string SeriesTimerId { get; set; }
  218. }
  219. }