BaseItemDto.cs 41 KB

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