InternalItemsQuery.cs 9.9 KB

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