BaseItemDto.cs 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224
  1. using MediaBrowser.Model.Drawing;
  2. using MediaBrowser.Model.Entities;
  3. using MediaBrowser.Model.Extensions;
  4. using MediaBrowser.Model.Library;
  5. using MediaBrowser.Model.LiveTv;
  6. using MediaBrowser.Model.Providers;
  7. using MediaBrowser.Model.Sync;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Diagnostics;
  11. using System.Runtime.Serialization;
  12. namespace MediaBrowser.Model.Dto
  13. {
  14. /// <summary>
  15. /// This is strictly used as a data transfer object from the api layer.
  16. /// This holds information about a BaseItem in a format that is convenient for the client.
  17. /// </summary>
  18. [DebuggerDisplay("Name = {Name}, ID = {Id}, Type = {Type}")]
  19. public class BaseItemDto : IHasProviderIds, IItemDto, IHasServerId, IHasSyncInfo
  20. {
  21. /// <summary>
  22. /// Gets or sets the name.
  23. /// </summary>
  24. /// <value>The name.</value>
  25. public string Name { get; set; }
  26. public string OriginalTitle { get; set; }
  27. /// <summary>
  28. /// Gets or sets the server identifier.
  29. /// </summary>
  30. /// <value>The server identifier.</value>
  31. public string ServerId { get; set; }
  32. /// <summary>
  33. /// Gets or sets the id.
  34. /// </summary>
  35. /// <value>The id.</value>
  36. public string Id { get; set; }
  37. /// <summary>
  38. /// Gets or sets the etag.
  39. /// </summary>
  40. /// <value>The etag.</value>
  41. public string Etag { get; set; }
  42. /// <summary>
  43. /// Gets or sets the type of the source.
  44. /// </summary>
  45. /// <value>The type of the source.</value>
  46. public string SourceType { get; set; }
  47. /// <summary>
  48. /// Gets or sets the playlist item identifier.
  49. /// </summary>
  50. /// <value>The playlist item identifier.</value>
  51. public string PlaylistItemId { get; set; }
  52. /// <summary>
  53. /// Gets or sets the date created.
  54. /// </summary>
  55. /// <value>The date created.</value>
  56. public DateTime? DateCreated { get; set; }
  57. public DateTime? DateLastMediaAdded { get; set; }
  58. public ExtraType? ExtraType { get; set; }
  59. public int? AirsBeforeSeasonNumber { get; set; }
  60. public int? AirsAfterSeasonNumber { get; set; }
  61. public int? AirsBeforeEpisodeNumber { get; set; }
  62. public int? AbsoluteEpisodeNumber { get; set; }
  63. public bool? DisplaySpecialsWithSeasons { get; set; }
  64. public bool? CanDelete { get; set; }
  65. public bool? CanDownload { get; set; }
  66. public bool? HasSubtitles { get; set; }
  67. public string PreferredMetadataLanguage { get; set; }
  68. public string PreferredMetadataCountryCode { get; set; }
  69. public string AwardSummary { get; set; }
  70. public string ShareUrl { get; set; }
  71. public float? Metascore { get; set; }
  72. public bool? HasDynamicCategories { get; set; }
  73. public int? AnimeSeriesIndex { get; set; }
  74. /// <summary>
  75. /// Gets or sets a value indicating whether [supports synchronize].
  76. /// </summary>
  77. /// <value><c>null</c> if [supports synchronize] contains no value, <c>true</c> if [supports synchronize]; otherwise, <c>false</c>.</value>
  78. public bool? SupportsSync { get; set; }
  79. /// <summary>
  80. /// Gets or sets a value indicating whether this instance has synchronize job.
  81. /// </summary>
  82. /// <value><c>null</c> if [has synchronize job] contains no value, <c>true</c> if [has synchronize job]; otherwise, <c>false</c>.</value>
  83. public bool? HasSyncJob { get; set; }
  84. /// <summary>
  85. /// Gets or sets a value indicating whether this instance is synced.
  86. /// </summary>
  87. /// <value><c>null</c> if [is synced] contains no value, <c>true</c> if [is synced]; otherwise, <c>false</c>.</value>
  88. public bool? IsSynced { get; set; }
  89. /// <summary>
  90. /// Gets or sets the synchronize status.
  91. /// </summary>
  92. /// <value>The synchronize status.</value>
  93. public SyncJobItemStatus? SyncStatus { get; set; }
  94. /// <summary>
  95. /// Gets or sets the synchronize percent.
  96. /// </summary>
  97. /// <value>The synchronize percent.</value>
  98. public double? SyncPercent { get; set; }
  99. public string Container { get; set; }
  100. /// <summary>
  101. /// Gets or sets the DVD season number.
  102. /// </summary>
  103. /// <value>The DVD season number.</value>
  104. public int? DvdSeasonNumber { get; set; }
  105. /// <summary>
  106. /// Gets or sets the DVD episode number.
  107. /// </summary>
  108. /// <value>The DVD episode number.</value>
  109. public float? DvdEpisodeNumber { get; set; }
  110. /// <summary>
  111. /// Gets or sets the name of the sort.
  112. /// </summary>
  113. /// <value>The name of the sort.</value>
  114. public string SortName { get; set; }
  115. public string ForcedSortName { get; set; }
  116. /// <summary>
  117. /// Gets or sets the video3 D format.
  118. /// </summary>
  119. /// <value>The video3 D format.</value>
  120. public Video3DFormat? Video3DFormat { get; set; }
  121. /// <summary>
  122. /// Gets or sets the premiere date.
  123. /// </summary>
  124. /// <value>The premiere date.</value>
  125. public DateTime? PremiereDate { get; set; }
  126. /// <summary>
  127. /// Gets or sets the external urls.
  128. /// </summary>
  129. /// <value>The external urls.</value>
  130. public ExternalUrl[] ExternalUrls { get; set; }
  131. /// <summary>
  132. /// Gets or sets the media versions.
  133. /// </summary>
  134. /// <value>The media versions.</value>
  135. public List<MediaSourceInfo> MediaSources { get; set; }
  136. /// <summary>
  137. /// Gets or sets the critic rating.
  138. /// </summary>
  139. /// <value>The critic rating.</value>
  140. public float? CriticRating { get; set; }
  141. /// <summary>
  142. /// Gets or sets the game system.
  143. /// </summary>
  144. /// <value>The game system.</value>
  145. public string GameSystem { get; set; }
  146. /// <summary>
  147. /// Gets or sets the critic rating summary.
  148. /// </summary>
  149. /// <value>The critic rating summary.</value>
  150. public string CriticRatingSummary { get; set; }
  151. public List<string> MultiPartGameFiles { get; set; }
  152. /// <summary>
  153. /// Gets or sets the path.
  154. /// </summary>
  155. /// <value>The path.</value>
  156. public string Path { get; set; }
  157. /// <summary>
  158. /// Gets or sets the official rating.
  159. /// </summary>
  160. /// <value>The official rating.</value>
  161. public string OfficialRating { get; set; }
  162. /// <summary>
  163. /// Gets or sets the custom rating.
  164. /// </summary>
  165. /// <value>The custom rating.</value>
  166. public string CustomRating { get; set; }
  167. /// <summary>
  168. /// Gets or sets the channel identifier.
  169. /// </summary>
  170. /// <value>The channel identifier.</value>
  171. public string ChannelId { get; set; }
  172. public string ChannelName { get; set; }
  173. public string ServiceName { get; set; }
  174. /// <summary>
  175. /// Gets or sets the overview.
  176. /// </summary>
  177. /// <value>The overview.</value>
  178. public string Overview { get; set; }
  179. /// <summary>
  180. /// Gets or sets the short overview.
  181. /// </summary>
  182. /// <value>The short overview.</value>
  183. public string ShortOverview { get; set; }
  184. /// <summary>
  185. /// Gets or sets the taglines.
  186. /// </summary>
  187. /// <value>The taglines.</value>
  188. public List<string> Taglines { get; set; }
  189. /// <summary>
  190. /// Gets or sets the genres.
  191. /// </summary>
  192. /// <value>The genres.</value>
  193. public List<string> Genres { get; set; }
  194. /// <summary>
  195. /// Gets or sets the series genres.
  196. /// </summary>
  197. /// <value>The series genres.</value>
  198. public List<string> SeriesGenres { get; set; }
  199. /// <summary>
  200. /// Gets or sets the community rating.
  201. /// </summary>
  202. /// <value>The community rating.</value>
  203. public float? CommunityRating { get; set; }
  204. /// <summary>
  205. /// Gets or sets the vote count.
  206. /// </summary>
  207. /// <value>The vote count.</value>
  208. public int? VoteCount { get; set; }
  209. /// <summary>
  210. /// Gets or sets the cumulative run time ticks.
  211. /// </summary>
  212. /// <value>The cumulative run time ticks.</value>
  213. public long? CumulativeRunTimeTicks { get; set; }
  214. /// <summary>
  215. /// Gets or sets the original run time ticks.
  216. /// </summary>
  217. /// <value>The original run time ticks.</value>
  218. public long? OriginalRunTimeTicks { get; set; }
  219. /// <summary>
  220. /// Gets or sets the run time ticks.
  221. /// </summary>
  222. /// <value>The run time ticks.</value>
  223. public long? RunTimeTicks { get; set; }
  224. /// <summary>
  225. /// Gets or sets the play access.
  226. /// </summary>
  227. /// <value>The play access.</value>
  228. public PlayAccess PlayAccess { get; set; }
  229. /// <summary>
  230. /// Gets or sets the aspect ratio.
  231. /// </summary>
  232. /// <value>The aspect ratio.</value>
  233. public string AspectRatio { get; set; }
  234. /// <summary>
  235. /// Gets or sets the production year.
  236. /// </summary>
  237. /// <value>The production year.</value>
  238. public int? ProductionYear { get; set; }
  239. /// <summary>
  240. /// Gets or sets the players supported by a game.
  241. /// </summary>
  242. /// <value>The players.</value>
  243. public int? Players { get; set; }
  244. /// <summary>
  245. /// Gets or sets a value indicating whether this instance is place holder.
  246. /// </summary>
  247. /// <value><c>null</c> if [is place holder] contains no value, <c>true</c> if [is place holder]; otherwise, <c>false</c>.</value>
  248. public bool? IsPlaceHolder { get; set; }
  249. /// <summary>
  250. /// Gets or sets the number.
  251. /// </summary>
  252. /// <value>The number.</value>
  253. public string Number { get; set; }
  254. public string ChannelNumber { get; set; }
  255. /// <summary>
  256. /// Gets or sets the index number.
  257. /// </summary>
  258. /// <value>The index number.</value>
  259. public int? IndexNumber { get; set; }
  260. /// <summary>
  261. /// Gets or sets the index number end.
  262. /// </summary>
  263. /// <value>The index number end.</value>
  264. public int? IndexNumberEnd { get; set; }
  265. /// <summary>
  266. /// Gets or sets the parent index number.
  267. /// </summary>
  268. /// <value>The parent index number.</value>
  269. public int? ParentIndexNumber { get; set; }
  270. /// <summary>
  271. /// Gets or sets the trailer urls.
  272. /// </summary>
  273. /// <value>The trailer urls.</value>
  274. public List<MediaUrl> RemoteTrailers { get; set; }
  275. /// <summary>
  276. /// Gets or sets the soundtrack ids.
  277. /// </summary>
  278. /// <value>The soundtrack ids.</value>
  279. public string[] SoundtrackIds { get; set; }
  280. /// <summary>
  281. /// Gets or sets the provider ids.
  282. /// </summary>
  283. /// <value>The provider ids.</value>
  284. public Dictionary<string, string> ProviderIds { get; set; }
  285. /// <summary>
  286. /// Gets or sets a value indicating whether this instance is HD.
  287. /// </summary>
  288. /// <value><c>null</c> if [is HD] contains no value, <c>true</c> if [is HD]; otherwise, <c>false</c>.</value>
  289. public bool? IsHD { get; set; }
  290. /// <summary>
  291. /// Gets or sets a value indicating whether this instance is folder.
  292. /// </summary>
  293. /// <value><c>true</c> if this instance is folder; otherwise, <c>false</c>.</value>
  294. public bool? IsFolder { get; set; }
  295. [IgnoreDataMember]
  296. public bool IsFolderItem
  297. {
  298. get
  299. {
  300. return IsFolder ?? false;
  301. }
  302. }
  303. /// <summary>
  304. /// Gets or sets the parent id.
  305. /// </summary>
  306. /// <value>The parent id.</value>
  307. public string ParentId { get; set; }
  308. /// <summary>
  309. /// Gets or sets the type.
  310. /// </summary>
  311. /// <value>The type.</value>
  312. public string Type { get; set; }
  313. /// <summary>
  314. /// Gets or sets the people.
  315. /// </summary>
  316. /// <value>The people.</value>
  317. public BaseItemPerson[] People { get; set; }
  318. /// <summary>
  319. /// Gets or sets the studios.
  320. /// </summary>
  321. /// <value>The studios.</value>
  322. public StudioDto[] Studios { get; set; }
  323. /// <summary>
  324. /// If the item does not have a logo, this will hold the Id of the Parent that has one.
  325. /// </summary>
  326. /// <value>The parent logo item id.</value>
  327. public string ParentLogoItemId { get; set; }
  328. /// <summary>
  329. /// If the item does not have any backdrops, this will hold the Id of the Parent that has one.
  330. /// </summary>
  331. /// <value>The parent backdrop item id.</value>
  332. public string ParentBackdropItemId { get; set; }
  333. /// <summary>
  334. /// Gets or sets the parent backdrop image tags.
  335. /// </summary>
  336. /// <value>The parent backdrop image tags.</value>
  337. public List<string> ParentBackdropImageTags { get; set; }
  338. /// <summary>
  339. /// Gets or sets the local trailer count.
  340. /// </summary>
  341. /// <value>The local trailer count.</value>
  342. public int? LocalTrailerCount { get; set; }
  343. /// <summary>
  344. /// User data for this item based on the user it's being requested for
  345. /// </summary>
  346. /// <value>The user data.</value>
  347. public UserItemDataDto UserData { get; set; }
  348. /// <summary>
  349. /// Gets or sets the season user data.
  350. /// </summary>
  351. /// <value>The season user data.</value>
  352. public UserItemDataDto SeasonUserData { get; set; }
  353. /// <summary>
  354. /// Gets or sets the recursive item count.
  355. /// </summary>
  356. /// <value>The recursive item count.</value>
  357. public int? RecursiveItemCount { get; set; }
  358. /// <summary>
  359. /// Gets or sets the child count.
  360. /// </summary>
  361. /// <value>The child count.</value>
  362. public int? ChildCount { get; set; }
  363. /// <summary>
  364. /// Gets or sets the name of the series.
  365. /// </summary>
  366. /// <value>The name of the series.</value>
  367. public string SeriesName { get; set; }
  368. /// <summary>
  369. /// Gets or sets the series id.
  370. /// </summary>
  371. /// <value>The series id.</value>
  372. public string SeriesId { get; set; }
  373. /// <summary>
  374. /// Gets or sets the season identifier.
  375. /// </summary>
  376. /// <value>The season identifier.</value>
  377. public string SeasonId { get; set; }
  378. /// <summary>
  379. /// Gets or sets the special feature count.
  380. /// </summary>
  381. /// <value>The special feature count.</value>
  382. public int? SpecialFeatureCount { get; set; }
  383. /// <summary>
  384. /// Gets or sets the display preferences id.
  385. /// </summary>
  386. /// <value>The display preferences id.</value>
  387. public string DisplayPreferencesId { get; set; }
  388. /// <summary>
  389. /// Gets or sets the status.
  390. /// </summary>
  391. /// <value>The status.</value>
  392. public string Status { get; set; }
  393. [IgnoreDataMember]
  394. public SeriesStatus? SeriesStatus
  395. {
  396. get
  397. {
  398. if (string.IsNullOrEmpty(Status))
  399. {
  400. return null;
  401. }
  402. return (SeriesStatus)Enum.Parse(typeof(SeriesStatus), Status, true);
  403. }
  404. set
  405. {
  406. if (value == null)
  407. {
  408. Status = null;
  409. }
  410. else
  411. {
  412. Status = value.Value.ToString();
  413. }
  414. }
  415. }
  416. [IgnoreDataMember]
  417. public RecordingStatus? RecordingStatus
  418. {
  419. get
  420. {
  421. if (string.IsNullOrEmpty(Status))
  422. {
  423. return null;
  424. }
  425. return (RecordingStatus)Enum.Parse(typeof(RecordingStatus), Status, true);
  426. }
  427. set
  428. {
  429. if (value == null)
  430. {
  431. Status = null;
  432. }
  433. else
  434. {
  435. Status = value.Value.ToString();
  436. }
  437. }
  438. }
  439. /// <summary>
  440. /// Gets or sets the air time.
  441. /// </summary>
  442. /// <value>The air time.</value>
  443. public string AirTime { get; set; }
  444. /// <summary>
  445. /// Gets or sets the air days.
  446. /// </summary>
  447. /// <value>The air days.</value>
  448. public List<DayOfWeek> AirDays { get; set; }
  449. /// <summary>
  450. /// Gets or sets the index options.
  451. /// </summary>
  452. /// <value>The index options.</value>
  453. public string[] IndexOptions { get; set; }
  454. /// <summary>
  455. /// Gets or sets the tags.
  456. /// </summary>
  457. /// <value>The tags.</value>
  458. public List<string> Tags { get; set; }
  459. /// <summary>
  460. /// Gets or sets the keywords.
  461. /// </summary>
  462. /// <value>The keywords.</value>
  463. public List<string> Keywords { get; set; }
  464. /// <summary>
  465. /// Gets or sets the primary image aspect ratio, after image enhancements.
  466. /// </summary>
  467. /// <value>The primary image aspect ratio.</value>
  468. public double? PrimaryImageAspectRatio { get; set; }
  469. /// <summary>
  470. /// Gets or sets the artists.
  471. /// </summary>
  472. /// <value>The artists.</value>
  473. public List<string> Artists { get; set; }
  474. /// <summary>
  475. /// Gets or sets the artist items.
  476. /// </summary>
  477. /// <value>The artist items.</value>
  478. public List<NameIdPair> ArtistItems { get; set; }
  479. /// <summary>
  480. /// Gets or sets the album.
  481. /// </summary>
  482. /// <value>The album.</value>
  483. public string Album { get; set; }
  484. /// <summary>
  485. /// Gets or sets the type of the collection.
  486. /// </summary>
  487. /// <value>The type of the collection.</value>
  488. public string CollectionType { get; set; }
  489. /// <summary>
  490. /// Gets or sets the type of the original collection.
  491. /// </summary>
  492. /// <value>The type of the original collection.</value>
  493. public string OriginalCollectionType { get; set; }
  494. /// <summary>
  495. /// Gets or sets the display order.
  496. /// </summary>
  497. /// <value>The display order.</value>
  498. public string DisplayOrder { get; set; }
  499. /// <summary>
  500. /// Gets or sets the album id.
  501. /// </summary>
  502. /// <value>The album id.</value>
  503. public string AlbumId { get; set; }
  504. /// <summary>
  505. /// Gets or sets the album image tag.
  506. /// </summary>
  507. /// <value>The album image tag.</value>
  508. public string AlbumPrimaryImageTag { get; set; }
  509. /// <summary>
  510. /// Gets or sets the series primary image tag.
  511. /// </summary>
  512. /// <value>The series primary image tag.</value>
  513. public string SeriesPrimaryImageTag { get; set; }
  514. /// <summary>
  515. /// Gets or sets the album artist.
  516. /// </summary>
  517. /// <value>The album artist.</value>
  518. public string AlbumArtist { get; set; }
  519. /// <summary>
  520. /// Gets or sets the album artists.
  521. /// </summary>
  522. /// <value>The album artists.</value>
  523. public List<NameIdPair> AlbumArtists { get; set; }
  524. /// <summary>
  525. /// Gets or sets the name of the season.
  526. /// </summary>
  527. /// <value>The name of the season.</value>
  528. public string SeasonName { get; set; }
  529. /// <summary>
  530. /// Gets or sets the media streams.
  531. /// </summary>
  532. /// <value>The media streams.</value>
  533. public List<MediaStream> MediaStreams { get; set; }
  534. /// <summary>
  535. /// Gets or sets the type of the video.
  536. /// </summary>
  537. /// <value>The type of the video.</value>
  538. public VideoType? VideoType { get; set; }
  539. /// <summary>
  540. /// Gets or sets the display type of the media.
  541. /// </summary>
  542. /// <value>The display type of the media.</value>
  543. public string DisplayMediaType { get; set; }
  544. /// <summary>
  545. /// Gets or sets the part count.
  546. /// </summary>
  547. /// <value>The part count.</value>
  548. public int? PartCount { get; set; }
  549. public int? MediaSourceCount { get; set; }
  550. /// <summary>
  551. /// Determines whether the specified type is type.
  552. /// </summary>
  553. /// <param name="type">The type.</param>
  554. /// <returns><c>true</c> if the specified type is type; otherwise, <c>false</c>.</returns>
  555. public bool IsType(Type type)
  556. {
  557. return IsType(type.Name);
  558. }
  559. /// <summary>
  560. /// Gets or sets a value indicating whether [supports playlists].
  561. /// </summary>
  562. /// <value><c>true</c> if [supports playlists]; otherwise, <c>false</c>.</value>
  563. [IgnoreDataMember]
  564. public bool SupportsPlaylists
  565. {
  566. get
  567. {
  568. return RunTimeTicks.HasValue || IsFolderItem || IsGenre || IsMusicGenre || IsArtist;
  569. }
  570. }
  571. /// <summary>
  572. /// Determines whether the specified type is type.
  573. /// </summary>
  574. /// <param name="type">The type.</param>
  575. /// <returns><c>true</c> if the specified type is type; otherwise, <c>false</c>.</returns>
  576. public bool IsType(string type)
  577. {
  578. return StringHelper.EqualsIgnoreCase(Type, type);
  579. }
  580. /// <summary>
  581. /// Gets or sets the image tags.
  582. /// </summary>
  583. /// <value>The image tags.</value>
  584. public Dictionary<ImageType, string> ImageTags { get; set; }
  585. /// <summary>
  586. /// Gets or sets the backdrop image tags.
  587. /// </summary>
  588. /// <value>The backdrop image tags.</value>
  589. public List<string> BackdropImageTags { get; set; }
  590. /// <summary>
  591. /// Gets or sets the screenshot image tags.
  592. /// </summary>
  593. /// <value>The screenshot image tags.</value>
  594. public List<string> ScreenshotImageTags { get; set; }
  595. /// <summary>
  596. /// Gets or sets the parent logo image tag.
  597. /// </summary>
  598. /// <value>The parent logo image tag.</value>
  599. public string ParentLogoImageTag { get; set; }
  600. /// <summary>
  601. /// If the item does not have a art, this will hold the Id of the Parent that has one.
  602. /// </summary>
  603. /// <value>The parent art item id.</value>
  604. public string ParentArtItemId { get; set; }
  605. /// <summary>
  606. /// Gets or sets the parent art image tag.
  607. /// </summary>
  608. /// <value>The parent art image tag.</value>
  609. public string ParentArtImageTag { get; set; }
  610. /// <summary>
  611. /// Gets or sets the series thumb image tag.
  612. /// </summary>
  613. /// <value>The series thumb image tag.</value>
  614. public string SeriesThumbImageTag { get; set; }
  615. /// <summary>
  616. /// Gets or sets the series studio.
  617. /// </summary>
  618. /// <value>The series studio.</value>
  619. public string SeriesStudio { get; set; }
  620. /// <summary>
  621. /// Gets or sets the parent thumb item id.
  622. /// </summary>
  623. /// <value>The parent thumb item id.</value>
  624. public string ParentThumbItemId { get; set; }
  625. /// <summary>
  626. /// Gets or sets the parent thumb image tag.
  627. /// </summary>
  628. /// <value>The parent thumb image tag.</value>
  629. public string ParentThumbImageTag { get; set; }
  630. /// <summary>
  631. /// Gets or sets the parent primary image item identifier.
  632. /// </summary>
  633. /// <value>The parent primary image item identifier.</value>
  634. public string ParentPrimaryImageItemId { get; set; }
  635. /// <summary>
  636. /// Gets or sets the parent primary image tag.
  637. /// </summary>
  638. /// <value>The parent primary image tag.</value>
  639. public string ParentPrimaryImageTag { get; set; }
  640. /// <summary>
  641. /// Gets or sets the chapters.
  642. /// </summary>
  643. /// <value>The chapters.</value>
  644. public List<ChapterInfoDto> Chapters { get; set; }
  645. /// <summary>
  646. /// Gets or sets the type of the location.
  647. /// </summary>
  648. /// <value>The type of the location.</value>
  649. public LocationType LocationType { get; set; }
  650. /// <summary>
  651. /// Gets or sets the type of the iso.
  652. /// </summary>
  653. /// <value>The type of the iso.</value>
  654. public IsoType? IsoType { get; set; }
  655. /// <summary>
  656. /// Gets or sets the type of the media.
  657. /// </summary>
  658. /// <value>The type of the media.</value>
  659. public string MediaType { get; set; }
  660. /// <summary>
  661. /// Gets or sets the end date.
  662. /// </summary>
  663. /// <value>The end date.</value>
  664. public DateTime? EndDate { get; set; }
  665. /// <summary>
  666. /// Gets or sets the home page URL.
  667. /// </summary>
  668. /// <value>The home page URL.</value>
  669. public string HomePageUrl { get; set; }
  670. /// <summary>
  671. /// Gets or sets the production locations.
  672. /// </summary>
  673. /// <value>The production locations.</value>
  674. public List<string> ProductionLocations { get; set; }
  675. /// <summary>
  676. /// Gets or sets the budget.
  677. /// </summary>
  678. /// <value>The budget.</value>
  679. public double? Budget { get; set; }
  680. /// <summary>
  681. /// Gets or sets the revenue.
  682. /// </summary>
  683. /// <value>The revenue.</value>
  684. public double? Revenue { get; set; }
  685. /// <summary>
  686. /// Gets or sets the locked fields.
  687. /// </summary>
  688. /// <value>The locked fields.</value>
  689. public List<MetadataFields> LockedFields { get; set; }
  690. /// <summary>
  691. /// Gets or sets the trailer count.
  692. /// </summary>
  693. /// <value>The trailer count.</value>
  694. public int? TrailerCount { get; set; }
  695. /// <summary>
  696. /// Gets or sets the movie count.
  697. /// </summary>
  698. /// <value>The movie count.</value>
  699. public int? MovieCount { get; set; }
  700. /// <summary>
  701. /// Gets or sets the series count.
  702. /// </summary>
  703. /// <value>The series count.</value>
  704. public int? SeriesCount { get; set; }
  705. public int? ProgramCount { get; set; }
  706. /// <summary>
  707. /// Gets or sets the episode count.
  708. /// </summary>
  709. /// <value>The episode count.</value>
  710. public int? EpisodeCount { get; set; }
  711. /// <summary>
  712. /// Gets or sets the game count.
  713. /// </summary>
  714. /// <value>The game count.</value>
  715. public int? GameCount { get; set; }
  716. /// <summary>
  717. /// Gets or sets the song count.
  718. /// </summary>
  719. /// <value>The song count.</value>
  720. public int? SongCount { get; set; }
  721. /// <summary>
  722. /// Gets or sets the album count.
  723. /// </summary>
  724. /// <value>The album count.</value>
  725. public int? AlbumCount { get; set; }
  726. public int? ArtistCount { get; set; }
  727. /// <summary>
  728. /// Gets or sets the music video count.
  729. /// </summary>
  730. /// <value>The music video count.</value>
  731. public int? MusicVideoCount { get; set; }
  732. /// <summary>
  733. /// Gets or sets a value indicating whether [enable internet providers].
  734. /// </summary>
  735. /// <value><c>true</c> if [enable internet providers]; otherwise, <c>false</c>.</value>
  736. public bool? LockData { get; set; }
  737. public int? Width { get; set; }
  738. public int? Height { get; set; }
  739. public string CameraMake { get; set; }
  740. public string CameraModel { get; set; }
  741. public string Software { get; set; }
  742. public double? ExposureTime { get; set; }
  743. public double? FocalLength { get; set; }
  744. public ImageOrientation? ImageOrientation { get; set; }
  745. public double? Aperture { get; set; }
  746. public double? ShutterSpeed { get; set; }
  747. public double? Latitude { get; set; }
  748. public double? Longitude { get; set; }
  749. public double? Altitude { get; set; }
  750. public int? IsoSpeedRating { get; set; }
  751. /// <summary>
  752. /// Used by RecordingGroup
  753. /// </summary>
  754. public int? RecordingCount { get; set; }
  755. /// <summary>
  756. /// Gets or sets the series timer identifier.
  757. /// </summary>
  758. /// <value>The series timer identifier.</value>
  759. public string SeriesTimerId { get; set; }
  760. /// <summary>
  761. /// Gets a value indicating whether this instance can resume.
  762. /// </summary>
  763. /// <value><c>true</c> if this instance can resume; otherwise, <c>false</c>.</value>
  764. [IgnoreDataMember]
  765. public bool CanResume
  766. {
  767. get { return UserData != null && UserData.PlaybackPositionTicks > 0; }
  768. }
  769. /// <summary>
  770. /// Gets the resume position ticks.
  771. /// </summary>
  772. /// <value>The resume position ticks.</value>
  773. [IgnoreDataMember]
  774. public long ResumePositionTicks
  775. {
  776. get { return UserData == null ? 0 : UserData.PlaybackPositionTicks; }
  777. }
  778. /// <summary>
  779. /// Gets the backdrop count.
  780. /// </summary>
  781. /// <value>The backdrop count.</value>
  782. [IgnoreDataMember]
  783. public int BackdropCount
  784. {
  785. get { return BackdropImageTags == null ? 0 : BackdropImageTags.Count; }
  786. }
  787. /// <summary>
  788. /// Gets the screenshot count.
  789. /// </summary>
  790. /// <value>The screenshot count.</value>
  791. [IgnoreDataMember]
  792. public int ScreenshotCount
  793. {
  794. get { return ScreenshotImageTags == null ? 0 : ScreenshotImageTags.Count; }
  795. }
  796. /// <summary>
  797. /// Gets a value indicating whether this instance has banner.
  798. /// </summary>
  799. /// <value><c>true</c> if this instance has banner; otherwise, <c>false</c>.</value>
  800. [IgnoreDataMember]
  801. public bool HasBanner
  802. {
  803. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Banner); }
  804. }
  805. /// <summary>
  806. /// Gets a value indicating whether this instance has art.
  807. /// </summary>
  808. /// <value><c>true</c> if this instance has art; otherwise, <c>false</c>.</value>
  809. [IgnoreDataMember]
  810. public bool HasArtImage
  811. {
  812. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Art); }
  813. }
  814. /// <summary>
  815. /// Gets a value indicating whether this instance has logo.
  816. /// </summary>
  817. /// <value><c>true</c> if this instance has logo; otherwise, <c>false</c>.</value>
  818. [IgnoreDataMember]
  819. public bool HasLogo
  820. {
  821. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Logo); }
  822. }
  823. /// <summary>
  824. /// Gets a value indicating whether this instance has thumb.
  825. /// </summary>
  826. /// <value><c>true</c> if this instance has thumb; otherwise, <c>false</c>.</value>
  827. [IgnoreDataMember]
  828. public bool HasThumb
  829. {
  830. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Thumb); }
  831. }
  832. /// <summary>
  833. /// Gets a value indicating whether this instance has thumb.
  834. /// </summary>
  835. /// <value><c>true</c> if this instance has thumb; otherwise, <c>false</c>.</value>
  836. [IgnoreDataMember]
  837. public bool HasBackdrop
  838. {
  839. get { return (BackdropImageTags != null && BackdropImageTags.Count > 0) || (ParentBackdropImageTags != null && ParentBackdropImageTags.Count > 0); }
  840. }
  841. /// <summary>
  842. /// Gets a value indicating whether this instance has primary image.
  843. /// </summary>
  844. /// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value>
  845. [IgnoreDataMember]
  846. public bool HasPrimaryImage
  847. {
  848. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Primary); }
  849. }
  850. /// <summary>
  851. /// Gets a value indicating whether this instance has disc image.
  852. /// </summary>
  853. /// <value><c>true</c> if this instance has disc image; otherwise, <c>false</c>.</value>
  854. [IgnoreDataMember]
  855. public bool HasDiscImage
  856. {
  857. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Disc); }
  858. }
  859. /// <summary>
  860. /// Gets a value indicating whether this instance has box image.
  861. /// </summary>
  862. /// <value><c>true</c> if this instance has box image; otherwise, <c>false</c>.</value>
  863. [IgnoreDataMember]
  864. public bool HasBoxImage
  865. {
  866. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Box); }
  867. }
  868. /// <summary>
  869. /// Gets a value indicating whether this instance has box image.
  870. /// </summary>
  871. /// <value><c>true</c> if this instance has box image; otherwise, <c>false</c>.</value>
  872. [IgnoreDataMember]
  873. public bool HasBoxRearImage
  874. {
  875. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.BoxRear); }
  876. }
  877. /// <summary>
  878. /// Gets a value indicating whether this instance has menu image.
  879. /// </summary>
  880. /// <value><c>true</c> if this instance has menu image; otherwise, <c>false</c>.</value>
  881. [IgnoreDataMember]
  882. public bool HasMenuImage
  883. {
  884. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Menu); }
  885. }
  886. /// <summary>
  887. /// Gets a value indicating whether this instance is video.
  888. /// </summary>
  889. /// <value><c>true</c> if this instance is video; otherwise, <c>false</c>.</value>
  890. [IgnoreDataMember]
  891. public bool IsVideo
  892. {
  893. get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Video); }
  894. }
  895. /// <summary>
  896. /// Gets a value indicating whether this instance is audio.
  897. /// </summary>
  898. /// <value><c>true</c> if this instance is audio; otherwise, <c>false</c>.</value>
  899. [IgnoreDataMember]
  900. public bool IsAudio
  901. {
  902. get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Audio); }
  903. }
  904. /// <summary>
  905. /// Gets a value indicating whether this instance is game.
  906. /// </summary>
  907. /// <value><c>true</c> if this instance is game; otherwise, <c>false</c>.</value>
  908. [IgnoreDataMember]
  909. public bool IsGame
  910. {
  911. get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Game); }
  912. }
  913. /// <summary>
  914. /// Gets a value indicating whether this instance is person.
  915. /// </summary>
  916. /// <value><c>true</c> if this instance is person; otherwise, <c>false</c>.</value>
  917. [IgnoreDataMember]
  918. public bool IsPerson
  919. {
  920. get { return StringHelper.EqualsIgnoreCase(Type, "Person"); }
  921. }
  922. /// <summary>
  923. /// Gets a value indicating whether this instance is root.
  924. /// </summary>
  925. /// <value><c>true</c> if this instance is root; otherwise, <c>false</c>.</value>
  926. [IgnoreDataMember]
  927. public bool IsRoot
  928. {
  929. get { return StringHelper.EqualsIgnoreCase(Type, "AggregateFolder"); }
  930. }
  931. [IgnoreDataMember]
  932. public bool IsMusicGenre
  933. {
  934. get { return StringHelper.EqualsIgnoreCase(Type, "MusicGenre"); }
  935. }
  936. [IgnoreDataMember]
  937. public bool IsGameGenre
  938. {
  939. get { return StringHelper.EqualsIgnoreCase(Type, "GameGenre"); }
  940. }
  941. [IgnoreDataMember]
  942. public bool IsGenre
  943. {
  944. get { return StringHelper.EqualsIgnoreCase(Type, "Genre"); }
  945. }
  946. [IgnoreDataMember]
  947. public bool IsArtist
  948. {
  949. get { return StringHelper.EqualsIgnoreCase(Type, "MusicArtist"); }
  950. }
  951. [IgnoreDataMember]
  952. public bool IsAlbum
  953. {
  954. get { return StringHelper.EqualsIgnoreCase(Type, "MusicAlbum"); }
  955. }
  956. [IgnoreDataMember]
  957. public bool IsStudio
  958. {
  959. get { return StringHelper.EqualsIgnoreCase(Type, "Studio"); }
  960. }
  961. [IgnoreDataMember]
  962. public bool SupportsSimilarItems
  963. {
  964. get
  965. {
  966. return IsType("Movie") || IsType("Series") || IsType("MusicAlbum") || IsType("MusicArtist") || IsType("Program") || IsType("Recording") || IsType("ChannelVideoItem") || IsType("Game");
  967. }
  968. }
  969. /// <summary>
  970. /// Gets or sets the program identifier.
  971. /// </summary>
  972. /// <value>The program identifier.</value>
  973. public string ProgramId { get; set; }
  974. /// <summary>
  975. /// Gets or sets the channel primary image tag.
  976. /// </summary>
  977. /// <value>The channel primary image tag.</value>
  978. public string ChannelPrimaryImageTag { get; set; }
  979. /// <summary>
  980. /// The start date of the recording, in UTC.
  981. /// </summary>
  982. public DateTime? StartDate { get; set; }
  983. /// <summary>
  984. /// Gets or sets the completion percentage.
  985. /// </summary>
  986. /// <value>The completion percentage.</value>
  987. public double? CompletionPercentage { get; set; }
  988. /// <summary>
  989. /// Gets or sets a value indicating whether this instance is repeat.
  990. /// </summary>
  991. /// <value><c>true</c> if this instance is repeat; otherwise, <c>false</c>.</value>
  992. public bool? IsRepeat { get; set; }
  993. /// <summary>
  994. /// Gets or sets the episode title.
  995. /// </summary>
  996. /// <value>The episode title.</value>
  997. public string EpisodeTitle { get; set; }
  998. /// <summary>
  999. /// Gets or sets the type of the channel.
  1000. /// </summary>
  1001. /// <value>The type of the channel.</value>
  1002. public ChannelType? ChannelType { get; set; }
  1003. /// <summary>
  1004. /// Gets or sets the audio.
  1005. /// </summary>
  1006. /// <value>The audio.</value>
  1007. public ProgramAudio? Audio { get; set; }
  1008. /// <summary>
  1009. /// Gets or sets a value indicating whether this instance is movie.
  1010. /// </summary>
  1011. /// <value><c>true</c> if this instance is movie; otherwise, <c>false</c>.</value>
  1012. public bool? IsMovie { get; set; }
  1013. /// <summary>
  1014. /// Gets or sets a value indicating whether this instance is sports.
  1015. /// </summary>
  1016. /// <value><c>true</c> if this instance is sports; otherwise, <c>false</c>.</value>
  1017. public bool? IsSports { get; set; }
  1018. /// <summary>
  1019. /// Gets or sets a value indicating whether this instance is series.
  1020. /// </summary>
  1021. /// <value><c>true</c> if this instance is series; otherwise, <c>false</c>.</value>
  1022. public bool? IsSeries { get; set; }
  1023. /// <summary>
  1024. /// Gets or sets a value indicating whether this instance is live.
  1025. /// </summary>
  1026. /// <value><c>true</c> if this instance is live; otherwise, <c>false</c>.</value>
  1027. public bool? IsLive { get; set; }
  1028. /// <summary>
  1029. /// Gets or sets a value indicating whether this instance is news.
  1030. /// </summary>
  1031. /// <value><c>true</c> if this instance is news; otherwise, <c>false</c>.</value>
  1032. public bool? IsNews { get; set; }
  1033. /// <summary>
  1034. /// Gets or sets a value indicating whether this instance is kids.
  1035. /// </summary>
  1036. /// <value><c>true</c> if this instance is kids; otherwise, <c>false</c>.</value>
  1037. public bool? IsKids { get; set; }
  1038. /// <summary>
  1039. /// Gets or sets a value indicating whether this instance is premiere.
  1040. /// </summary>
  1041. /// <value><c>true</c> if this instance is premiere; otherwise, <c>false</c>.</value>
  1042. public bool? IsPremiere { get; set; }
  1043. /// <summary>
  1044. /// Gets or sets the timer identifier.
  1045. /// </summary>
  1046. /// <value>The timer identifier.</value>
  1047. public string TimerId { get; set; }
  1048. /// <summary>
  1049. /// Gets or sets the current program.
  1050. /// </summary>
  1051. /// <value>The current program.</value>
  1052. public BaseItemDto CurrentProgram { get; set; }
  1053. }
  1054. }