InternalItemsQuery.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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 string[] SortBy { get; set; }
  16. public SortOrder SortOrder { get; set; }
  17. public User User { get; set; }
  18. public BaseItem SimilarTo { get; set; }
  19. public bool? IsFolder { get; set; }
  20. public bool? IsFavorite { get; set; }
  21. public bool? IsFavoriteOrLiked { get; set; }
  22. public bool? IsLiked { get; set; }
  23. public bool? IsPlayed { get; set; }
  24. public bool? IsResumable { get; set; }
  25. public bool? IncludeItemsByName { get; set; }
  26. public string[] MediaTypes { get; set; }
  27. public string[] IncludeItemTypes { get; set; }
  28. public string[] ExcludeItemTypes { get; set; }
  29. public string[] ExcludeTags { get; set; }
  30. public string[] ExcludeInheritedTags { get; set; }
  31. public string[] Genres { get; set; }
  32. public bool? IsSpecialSeason { get; set; }
  33. public bool? IsMissing { get; set; }
  34. public bool? IsUnaired { get; set; }
  35. public bool? IsVirtualUnaired { get; set; }
  36. public bool? CollapseBoxSetItems { get; set; }
  37. public string NameStartsWithOrGreater { get; set; }
  38. public string NameStartsWith { get; set; }
  39. public string NameLessThan { get; set; }
  40. public string NameContains { get; set; }
  41. public string MinSortName { get; set; }
  42. public string PresentationUniqueKey { get; set; }
  43. public string Path { get; set; }
  44. public string PathNotStartsWith { get; set; }
  45. public string Name { get; set; }
  46. public string Person { get; set; }
  47. public string[] PersonIds { get; set; }
  48. public string[] ItemIds { get; set; }
  49. public string[] ExcludeItemIds { get; set; }
  50. public string AdjacentTo { get; set; }
  51. public string[] PersonTypes { get; set; }
  52. public bool? Is3D { get; set; }
  53. public bool? IsHD { get; set; }
  54. public bool? IsInBoxSet { get; set; }
  55. public bool? IsLocked { get; set; }
  56. public bool? IsPlaceHolder { get; set; }
  57. public bool? HasImdbId { get; set; }
  58. public bool? HasOverview { get; set; }
  59. public bool? HasTmdbId { get; set; }
  60. public bool? HasOfficialRating { get; set; }
  61. public bool? HasTvdbId { get; set; }
  62. public bool? HasThemeSong { get; set; }
  63. public bool? HasThemeVideo { get; set; }
  64. public bool? HasSubtitles { get; set; }
  65. public bool? HasSpecialFeature { get; set; }
  66. public bool? HasTrailer { get; set; }
  67. public bool? HasParentalRating { get; set; }
  68. public string[] StudioIds { get; set; }
  69. public string[] GenreIds { get; set; }
  70. public ImageType[] ImageTypes { get; set; }
  71. public VideoType[] VideoTypes { get; set; }
  72. public UnratedItem[] BlockUnratedItems { get; set; }
  73. public int[] Years { get; set; }
  74. public string[] Tags { get; set; }
  75. public string[] OfficialRatings { get; set; }
  76. public DateTime? MinPremiereDate { get; set; }
  77. public DateTime? MaxPremiereDate { get; set; }
  78. public DateTime? MinStartDate { get; set; }
  79. public DateTime? MaxStartDate { get; set; }
  80. public DateTime? MinEndDate { get; set; }
  81. public DateTime? MaxEndDate { get; set; }
  82. public bool? IsAiring { get; set; }
  83. public bool? IsMovie { get; set; }
  84. public bool? IsSports { get; set; }
  85. public bool? IsKids { get; set; }
  86. public bool? IsNews { get; set; }
  87. public bool? IsSeries { get; set; }
  88. public int? MinPlayers { get; set; }
  89. public int? MaxPlayers { get; set; }
  90. public int? MinIndexNumber { get; set; }
  91. public int? AiredDuringSeason { get; set; }
  92. public double? MinCriticRating { get; set; }
  93. public double? MinCommunityRating { get; set; }
  94. public string[] ChannelIds { get; set; }
  95. internal List<Guid> ItemIdsFromPersonFilters { get; set; }
  96. public int? ParentIndexNumber { get; set; }
  97. public int? ParentIndexNumberNotEquals { get; set; }
  98. public int? IndexNumber { get; set; }
  99. public int? MinParentalRating { get; set; }
  100. public int? MaxParentalRating { get; set; }
  101. public bool? HasDeadParentId { get; set; }
  102. public bool? IsVirtualItem { get; set; }
  103. public Guid? ParentId { get; set; }
  104. public string ParentType { get; set; }
  105. public string[] AncestorIds { get; set; }
  106. public string[] TopParentIds { get; set; }
  107. public BaseItem Parent
  108. {
  109. set
  110. {
  111. if (value == null)
  112. {
  113. ParentId = null;
  114. ParentType = null;
  115. }
  116. else
  117. {
  118. ParentId = value.Id;
  119. ParentType = value.GetType().Name;
  120. }
  121. }
  122. }
  123. public string[] PresetViews { get; set; }
  124. public TrailerType[] TrailerTypes { get; set; }
  125. public SourceType[] SourceTypes { get; set; }
  126. public DayOfWeek[] AirDays { get; set; }
  127. public SeriesStatus[] SeriesStatuses { get; set; }
  128. public string ExternalSeriesId { get; set; }
  129. public string ExternalId { get; set; }
  130. public string[] AlbumIds { get; set; }
  131. public string[] ArtistIds { get; set; }
  132. public string[] ExcludeArtistIds { get; set; }
  133. public string AncestorWithPresentationUniqueKey { get; set; }
  134. public string SeriesPresentationUniqueKey { get; set; }
  135. public bool GroupByPresentationUniqueKey { get; set; }
  136. public bool GroupBySeriesPresentationUniqueKey { get; set; }
  137. public bool EnableTotalRecordCount { get; set; }
  138. public bool ForceDirect { get; set; }
  139. public Dictionary<string, string> ExcludeProviderIds { get; set; }
  140. public bool EnableGroupByMetadataKey { get; set; }
  141. public List<Tuple<string, SortOrder>> OrderBy { get; set; }
  142. public DateTime? MinDateCreated { get; set; }
  143. public DateTime? MinDateLastSaved { get; set; }
  144. public DateTime? MinDateLastSavedForUser { get; set; }
  145. public DtoOptions DtoOptions { get; set; }
  146. public int MinSimilarityScore { get; set; }
  147. public InternalItemsQuery()
  148. {
  149. MinSimilarityScore = 20;
  150. GroupByPresentationUniqueKey = true;
  151. EnableTotalRecordCount = true;
  152. DtoOptions = new DtoOptions();
  153. AlbumIds = new string[] { };
  154. ArtistIds = new string[] { };
  155. ExcludeArtistIds = new string[] { };
  156. ExcludeProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
  157. BlockUnratedItems = new UnratedItem[] { };
  158. Tags = new string[] { };
  159. OfficialRatings = new string[] { };
  160. SortBy = new string[] { };
  161. MediaTypes = new string[] { };
  162. IncludeItemTypes = new string[] { };
  163. ExcludeItemTypes = new string[] { };
  164. Genres = new string[] { };
  165. StudioIds = new string[] { };
  166. GenreIds = new string[] { };
  167. ImageTypes = new ImageType[] { };
  168. VideoTypes = new VideoType[] { };
  169. Years = new int[] { };
  170. PersonTypes = new string[] { };
  171. PersonIds = new string[] { };
  172. ChannelIds = new string[] { };
  173. ItemIds = new string[] { };
  174. ExcludeItemIds = new string[] { };
  175. AncestorIds = new string[] { };
  176. TopParentIds = new string[] { };
  177. ExcludeTags = new string[] { };
  178. ExcludeInheritedTags = new string[] { };
  179. PresetViews = new string[] { };
  180. TrailerTypes = new TrailerType[] { };
  181. SourceTypes = new SourceType[] { };
  182. AirDays = new DayOfWeek[] { };
  183. SeriesStatuses = new SeriesStatus[] { };
  184. OrderBy = new List<Tuple<string, SortOrder>>();
  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. }
  206. }