BaseItemDto.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897
  1. using MediaBrowser.Model.Entities;
  2. using MediaBrowser.Model.Library;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Diagnostics;
  7. using System.Runtime.Serialization;
  8. using MediaBrowser.Model.Providers;
  9. namespace MediaBrowser.Model.Dto
  10. {
  11. /// <summary>
  12. /// This is strictly used as a data transfer object from the api layer.
  13. /// This holds information about a BaseItem in a format that is convenient for the client.
  14. /// </summary>
  15. [DebuggerDisplay("Name = {Name}, ID = {Id}, Type = {Type}")]
  16. public class BaseItemDto : IHasProviderIds, INotifyPropertyChanged, IItemDto
  17. {
  18. /// <summary>
  19. /// Gets or sets the name.
  20. /// </summary>
  21. /// <value>The name.</value>
  22. public string Name { get; set; }
  23. /// <summary>
  24. /// Gets or sets the id.
  25. /// </summary>
  26. /// <value>The id.</value>
  27. public string Id { get; set; }
  28. /// <summary>
  29. /// Gets or sets the date created.
  30. /// </summary>
  31. /// <value>The date created.</value>
  32. public DateTime? DateCreated { get; set; }
  33. public DateTime? DateLastMediaAdded { get; set; }
  34. public int? AirsBeforeSeasonNumber { get; set; }
  35. public int? AirsAfterSeasonNumber { get; set; }
  36. public int? AirsBeforeEpisodeNumber { get; set; }
  37. public int? AbsoluteEpisodeNumber { get; set; }
  38. public bool? DisplaySpecialsWithSeasons { get; set; }
  39. public string PreferredMetadataLanguage { get; set; }
  40. public string PreferredMetadataCountryCode { get; set; }
  41. public string AwardSummary { get; set; }
  42. public float? Metascore { get; set; }
  43. /// <summary>
  44. /// Gets or sets the DVD season number.
  45. /// </summary>
  46. /// <value>The DVD season number.</value>
  47. public int? DvdSeasonNumber { get; set; }
  48. /// <summary>
  49. /// Gets or sets the DVD episode number.
  50. /// </summary>
  51. /// <value>The DVD episode number.</value>
  52. public float? DvdEpisodeNumber { get; set; }
  53. /// <summary>
  54. /// Gets or sets the name of the sort.
  55. /// </summary>
  56. /// <value>The name of the sort.</value>
  57. public string SortName { get; set; }
  58. /// <summary>
  59. /// Gets or sets the video3 D format.
  60. /// </summary>
  61. /// <value>The video3 D format.</value>
  62. public Video3DFormat? Video3DFormat { get; set; }
  63. /// <summary>
  64. /// Gets or sets the premiere date.
  65. /// </summary>
  66. /// <value>The premiere date.</value>
  67. public DateTime? PremiereDate { get; set; }
  68. /// <summary>
  69. /// Gets or sets the external urls.
  70. /// </summary>
  71. /// <value>The external urls.</value>
  72. public ExternalUrl[] ExternalUrls { get; set; }
  73. /// <summary>
  74. /// Gets or sets the critic rating.
  75. /// </summary>
  76. /// <value>The critic rating.</value>
  77. public float? CriticRating { get; set; }
  78. /// <summary>
  79. /// Gets or sets the game system.
  80. /// </summary>
  81. /// <value>The game system.</value>
  82. public string GameSystem { get; set; }
  83. /// <summary>
  84. /// Gets or sets the critic rating summary.
  85. /// </summary>
  86. /// <value>The critic rating summary.</value>
  87. public string CriticRatingSummary { get; set; }
  88. /// <summary>
  89. /// Gets or sets the path.
  90. /// </summary>
  91. /// <value>The path.</value>
  92. public string Path { get; set; }
  93. /// <summary>
  94. /// Gets or sets the official rating.
  95. /// </summary>
  96. /// <value>The official rating.</value>
  97. public string OfficialRating { get; set; }
  98. /// <summary>
  99. /// Gets or sets the custom rating.
  100. /// </summary>
  101. /// <value>The custom rating.</value>
  102. public string CustomRating { get; set; }
  103. /// <summary>
  104. /// Gets or sets the overview.
  105. /// </summary>
  106. /// <value>The overview.</value>
  107. public string Overview { get; set; }
  108. /// <summary>
  109. /// Gets or sets the name of the TMDB collection.
  110. /// </summary>
  111. /// <value>The name of the TMDB collection.</value>
  112. public string TmdbCollectionName { get; set; }
  113. /// <summary>
  114. /// Gets or sets the taglines.
  115. /// </summary>
  116. /// <value>The taglines.</value>
  117. public List<string> Taglines { get; set; }
  118. /// <summary>
  119. /// Gets or sets the genres.
  120. /// </summary>
  121. /// <value>The genres.</value>
  122. public List<string> Genres { get; set; }
  123. /// <summary>
  124. /// Gets or sets the community rating.
  125. /// </summary>
  126. /// <value>The community rating.</value>
  127. public float? CommunityRating { get; set; }
  128. /// <summary>
  129. /// Gets or sets the vote count.
  130. /// </summary>
  131. /// <value>The vote count.</value>
  132. public int? VoteCount { get; set; }
  133. /// <summary>
  134. /// Gets or sets the cumulative run time ticks.
  135. /// </summary>
  136. /// <value>The cumulative run time ticks.</value>
  137. public long? CumulativeRunTimeTicks { get; set; }
  138. /// <summary>
  139. /// Gets or sets the original run time ticks.
  140. /// </summary>
  141. /// <value>The original run time ticks.</value>
  142. public long? OriginalRunTimeTicks { get; set; }
  143. /// <summary>
  144. /// Gets or sets the run time ticks.
  145. /// </summary>
  146. /// <value>The run time ticks.</value>
  147. public long? RunTimeTicks { get; set; }
  148. /// <summary>
  149. /// Gets or sets the play access.
  150. /// </summary>
  151. /// <value>The play access.</value>
  152. public PlayAccess PlayAccess { get; set; }
  153. /// <summary>
  154. /// Gets or sets the aspect ratio.
  155. /// </summary>
  156. /// <value>The aspect ratio.</value>
  157. public string AspectRatio { get; set; }
  158. /// <summary>
  159. /// Gets or sets the production year.
  160. /// </summary>
  161. /// <value>The production year.</value>
  162. public int? ProductionYear { get; set; }
  163. /// <summary>
  164. /// Gets or sets the season count.
  165. /// </summary>
  166. /// <value>The season count.</value>
  167. public int? SeasonCount { get; set; }
  168. /// <summary>
  169. /// Gets or sets the players supported by a game.
  170. /// </summary>
  171. /// <value>The players.</value>
  172. public int? Players { get; set; }
  173. /// <summary>
  174. /// Gets or sets the index number.
  175. /// </summary>
  176. /// <value>The index number.</value>
  177. public int? IndexNumber { get; set; }
  178. /// <summary>
  179. /// Gets or sets the index number end.
  180. /// </summary>
  181. /// <value>The index number end.</value>
  182. public int? IndexNumberEnd { get; set; }
  183. /// <summary>
  184. /// Gets or sets the parent index number.
  185. /// </summary>
  186. /// <value>The parent index number.</value>
  187. public int? ParentIndexNumber { get; set; }
  188. /// <summary>
  189. /// Gets or sets the trailer urls.
  190. /// </summary>
  191. /// <value>The trailer urls.</value>
  192. public List<MediaUrl> RemoteTrailers { get; set; }
  193. /// <summary>
  194. /// Gets or sets the soundtrack ids.
  195. /// </summary>
  196. /// <value>The soundtrack ids.</value>
  197. public string[] SoundtrackIds { get; set; }
  198. /// <summary>
  199. /// Gets or sets the provider ids.
  200. /// </summary>
  201. /// <value>The provider ids.</value>
  202. public Dictionary<string, string> ProviderIds { get; set; }
  203. /// <summary>
  204. /// Gets or sets a value indicating whether this instance is HD.
  205. /// </summary>
  206. /// <value><c>null</c> if [is HD] contains no value, <c>true</c> if [is HD]; otherwise, <c>false</c>.</value>
  207. public bool? IsHD { get; set; }
  208. /// <summary>
  209. /// Gets or sets a value indicating whether this instance is folder.
  210. /// </summary>
  211. /// <value><c>true</c> if this instance is folder; otherwise, <c>false</c>.</value>
  212. public bool IsFolder { get; set; }
  213. /// <summary>
  214. /// Gets or sets the parent id.
  215. /// </summary>
  216. /// <value>The parent id.</value>
  217. public string ParentId { get; set; }
  218. /// <summary>
  219. /// Gets or sets the type.
  220. /// </summary>
  221. /// <value>The type.</value>
  222. public string Type { get; set; }
  223. /// <summary>
  224. /// Gets or sets the people.
  225. /// </summary>
  226. /// <value>The people.</value>
  227. public BaseItemPerson[] People { get; set; }
  228. /// <summary>
  229. /// Gets or sets the studios.
  230. /// </summary>
  231. /// <value>The studios.</value>
  232. public StudioDto[] Studios { get; set; }
  233. /// <summary>
  234. /// If the item does not have a logo, this will hold the Id of the Parent that has one.
  235. /// </summary>
  236. /// <value>The parent logo item id.</value>
  237. public string ParentLogoItemId { get; set; }
  238. /// <summary>
  239. /// If the item does not have any backdrops, this will hold the Id of the Parent that has one.
  240. /// </summary>
  241. /// <value>The parent backdrop item id.</value>
  242. public string ParentBackdropItemId { get; set; }
  243. /// <summary>
  244. /// Gets or sets the parent backdrop image tags.
  245. /// </summary>
  246. /// <value>The parent backdrop image tags.</value>
  247. public List<Guid> ParentBackdropImageTags { get; set; }
  248. /// <summary>
  249. /// Gets or sets the local trailer count.
  250. /// </summary>
  251. /// <value>The local trailer count.</value>
  252. public int? LocalTrailerCount { get; set; }
  253. /// <summary>
  254. /// User data for this item based on the user it's being requested for
  255. /// </summary>
  256. /// <value>The user data.</value>
  257. public UserItemDataDto UserData { get; set; }
  258. /// <summary>
  259. /// Gets or sets the recently added item count.
  260. /// </summary>
  261. /// <value>The recently added item count.</value>
  262. public int? RecentlyAddedItemCount { get; set; }
  263. /// <summary>
  264. /// Gets or sets the played percentage.
  265. /// </summary>
  266. /// <value>The played percentage.</value>
  267. public double? PlayedPercentage { get; set; }
  268. /// <summary>
  269. /// Gets or sets the recursive item count.
  270. /// </summary>
  271. /// <value>The recursive item count.</value>
  272. public int? RecursiveItemCount { get; set; }
  273. /// <summary>
  274. /// Gets or sets the recursive unplayed item count.
  275. /// </summary>
  276. /// <value>The recursive unplayed item count.</value>
  277. public int? RecursiveUnplayedItemCount { get; set; }
  278. /// <summary>
  279. /// Gets or sets the child count.
  280. /// </summary>
  281. /// <value>The child count.</value>
  282. public int? ChildCount { get; set; }
  283. /// <summary>
  284. /// Gets or sets the name of the series.
  285. /// </summary>
  286. /// <value>The name of the series.</value>
  287. public string SeriesName { get; set; }
  288. /// <summary>
  289. /// Gets or sets the series id.
  290. /// </summary>
  291. /// <value>The series id.</value>
  292. public string SeriesId { get; set; }
  293. /// <summary>
  294. /// Gets or sets the season identifier.
  295. /// </summary>
  296. /// <value>The season identifier.</value>
  297. public string SeasonId { get; set; }
  298. /// <summary>
  299. /// Gets or sets the special feature count.
  300. /// </summary>
  301. /// <value>The special feature count.</value>
  302. public int? SpecialFeatureCount { get; set; }
  303. /// <summary>
  304. /// Gets or sets the display preferences id.
  305. /// </summary>
  306. /// <value>The display preferences id.</value>
  307. public string DisplayPreferencesId { get; set; }
  308. /// <summary>
  309. /// Gets or sets the status.
  310. /// </summary>
  311. /// <value>The status.</value>
  312. public SeriesStatus? Status { get; set; }
  313. /// <summary>
  314. /// Gets or sets the air time.
  315. /// </summary>
  316. /// <value>The air time.</value>
  317. public string AirTime { get; set; }
  318. /// <summary>
  319. /// Gets or sets the air days.
  320. /// </summary>
  321. /// <value>The air days.</value>
  322. public List<DayOfWeek> AirDays { get; set; }
  323. /// <summary>
  324. /// Gets or sets the index options.
  325. /// </summary>
  326. /// <value>The index options.</value>
  327. public string[] IndexOptions { get; set; }
  328. /// <summary>
  329. /// Gets or sets the tags.
  330. /// </summary>
  331. /// <value>The tags.</value>
  332. public List<string> Tags { get; set; }
  333. /// <summary>
  334. /// Gets or sets the keywords.
  335. /// </summary>
  336. /// <value>The keywords.</value>
  337. public List<string> Keywords { get; set; }
  338. /// <summary>
  339. /// Gets or sets the primary image aspect ratio, after image enhancements.
  340. /// </summary>
  341. /// <value>The primary image aspect ratio.</value>
  342. public double? PrimaryImageAspectRatio { get; set; }
  343. /// <summary>
  344. /// Gets or sets the primary image aspect ratio, before image enhancements.
  345. /// </summary>
  346. /// <value>The original primary image aspect ratio.</value>
  347. public double? OriginalPrimaryImageAspectRatio { get; set; }
  348. /// <summary>
  349. /// Gets or sets the artists.
  350. /// </summary>
  351. /// <value>The artists.</value>
  352. public List<string> Artists { get; set; }
  353. /// <summary>
  354. /// Gets or sets the album.
  355. /// </summary>
  356. /// <value>The album.</value>
  357. public string Album { get; set; }
  358. /// <summary>
  359. /// Gets or sets the type of the collection.
  360. /// </summary>
  361. /// <value>The type of the collection.</value>
  362. public string CollectionType { get; set; }
  363. /// <summary>
  364. /// Gets or sets the display order.
  365. /// </summary>
  366. /// <value>The display order.</value>
  367. public string DisplayOrder { get; set; }
  368. /// <summary>
  369. /// Gets or sets the album id.
  370. /// </summary>
  371. /// <value>The album id.</value>
  372. public string AlbumId { get; set; }
  373. /// <summary>
  374. /// Gets or sets the album image tag.
  375. /// </summary>
  376. /// <value>The album image tag.</value>
  377. public Guid? AlbumPrimaryImageTag { get; set; }
  378. /// <summary>
  379. /// Gets or sets the series primary image tag.
  380. /// </summary>
  381. /// <value>The series primary image tag.</value>
  382. public Guid? SeriesPrimaryImageTag { get; set; }
  383. /// <summary>
  384. /// Gets or sets the album artist.
  385. /// </summary>
  386. /// <value>The album artist.</value>
  387. public string AlbumArtist { get; set; }
  388. /// <summary>
  389. /// Gets or sets the media streams.
  390. /// </summary>
  391. /// <value>The media streams.</value>
  392. public List<MediaStream> MediaStreams { get; set; }
  393. /// <summary>
  394. /// Gets or sets the type of the video.
  395. /// </summary>
  396. /// <value>The type of the video.</value>
  397. public VideoType? VideoType { get; set; }
  398. /// <summary>
  399. /// Gets or sets the display type of the media.
  400. /// </summary>
  401. /// <value>The display type of the media.</value>
  402. public string DisplayMediaType { get; set; }
  403. /// <summary>
  404. /// Gets or sets the part count.
  405. /// </summary>
  406. /// <value>The part count.</value>
  407. public int? PartCount { get; set; }
  408. /// <summary>
  409. /// Determines whether the specified type is type.
  410. /// </summary>
  411. /// <param name="type">The type.</param>
  412. /// <returns><c>true</c> if the specified type is type; otherwise, <c>false</c>.</returns>
  413. public bool IsType(Type type)
  414. {
  415. return IsType(type.Name);
  416. }
  417. /// <summary>
  418. /// Determines whether the specified type is type.
  419. /// </summary>
  420. /// <param name="type">The type.</param>
  421. /// <returns><c>true</c> if the specified type is type; otherwise, <c>false</c>.</returns>
  422. public bool IsType(string type)
  423. {
  424. return Type.Equals(type, StringComparison.OrdinalIgnoreCase);
  425. }
  426. /// <summary>
  427. /// Gets or sets the image tags.
  428. /// </summary>
  429. /// <value>The image tags.</value>
  430. public Dictionary<ImageType, Guid> ImageTags { get; set; }
  431. /// <summary>
  432. /// Gets or sets the backdrop image tags.
  433. /// </summary>
  434. /// <value>The backdrop image tags.</value>
  435. public List<Guid> BackdropImageTags { get; set; }
  436. /// <summary>
  437. /// Gets or sets the screenshot image tags.
  438. /// </summary>
  439. /// <value>The screenshot image tags.</value>
  440. public List<Guid> ScreenshotImageTags { get; set; }
  441. /// <summary>
  442. /// Gets or sets the parent logo image tag.
  443. /// </summary>
  444. /// <value>The parent logo image tag.</value>
  445. public Guid? ParentLogoImageTag { get; set; }
  446. /// <summary>
  447. /// If the item does not have a art, this will hold the Id of the Parent that has one.
  448. /// </summary>
  449. /// <value>The parent art item id.</value>
  450. public string ParentArtItemId { get; set; }
  451. /// <summary>
  452. /// Gets or sets the parent art image tag.
  453. /// </summary>
  454. /// <value>The parent art image tag.</value>
  455. public Guid? ParentArtImageTag { get; set; }
  456. /// <summary>
  457. /// Gets or sets the series thumb image tag.
  458. /// </summary>
  459. /// <value>The series thumb image tag.</value>
  460. public Guid? SeriesThumbImageTag { get; set; }
  461. /// <summary>
  462. /// Gets or sets the series studio.
  463. /// </summary>
  464. /// <value>The series studio.</value>
  465. public string SeriesStudio { get; set; }
  466. /// <summary>
  467. /// Gets or sets the parent thumb item id.
  468. /// </summary>
  469. /// <value>The parent thumb item id.</value>
  470. public string ParentThumbItemId { get; set; }
  471. /// <summary>
  472. /// Gets or sets the parent thumb image tag.
  473. /// </summary>
  474. /// <value>The parent thumb image tag.</value>
  475. public Guid? ParentThumbImageTag { get; set; }
  476. /// <summary>
  477. /// Gets or sets the chapters.
  478. /// </summary>
  479. /// <value>The chapters.</value>
  480. public List<ChapterInfoDto> Chapters { get; set; }
  481. /// <summary>
  482. /// Gets or sets the type of the location.
  483. /// </summary>
  484. /// <value>The type of the location.</value>
  485. public LocationType LocationType { get; set; }
  486. /// <summary>
  487. /// Gets or sets the type of the iso.
  488. /// </summary>
  489. /// <value>The type of the iso.</value>
  490. public IsoType? IsoType { get; set; }
  491. /// <summary>
  492. /// Gets or sets the type of the media.
  493. /// </summary>
  494. /// <value>The type of the media.</value>
  495. public string MediaType { get; set; }
  496. /// <summary>
  497. /// Gets or sets the overview HTML.
  498. /// </summary>
  499. /// <value>The overview HTML.</value>
  500. public string OverviewHtml { get; set; }
  501. /// <summary>
  502. /// Gets or sets the end date.
  503. /// </summary>
  504. /// <value>The end date.</value>
  505. public DateTime? EndDate { get; set; }
  506. /// <summary>
  507. /// Gets or sets the home page URL.
  508. /// </summary>
  509. /// <value>The home page URL.</value>
  510. public string HomePageUrl { get; set; }
  511. /// <summary>
  512. /// Gets or sets the production locations.
  513. /// </summary>
  514. /// <value>The production locations.</value>
  515. public List<string> ProductionLocations { get; set; }
  516. /// <summary>
  517. /// Gets or sets the budget.
  518. /// </summary>
  519. /// <value>The budget.</value>
  520. public double? Budget { get; set; }
  521. /// <summary>
  522. /// Gets or sets the revenue.
  523. /// </summary>
  524. /// <value>The revenue.</value>
  525. public double? Revenue { get; set; }
  526. /// <summary>
  527. /// Gets or sets the locked fields.
  528. /// </summary>
  529. /// <value>The locked fields.</value>
  530. public List<MetadataFields> LockedFields { get; set; }
  531. public int? AdultVideoCount { get; set; }
  532. /// <summary>
  533. /// Gets or sets the movie count.
  534. /// </summary>
  535. /// <value>The movie count.</value>
  536. public int? MovieCount { get; set; }
  537. /// <summary>
  538. /// Gets or sets the series count.
  539. /// </summary>
  540. /// <value>The series count.</value>
  541. public int? SeriesCount { get; set; }
  542. /// <summary>
  543. /// Gets or sets the episode count.
  544. /// </summary>
  545. /// <value>The episode count.</value>
  546. public int? EpisodeCount { get; set; }
  547. /// <summary>
  548. /// Gets or sets the game count.
  549. /// </summary>
  550. /// <value>The game count.</value>
  551. public int? GameCount { get; set; }
  552. /// <summary>
  553. /// Gets or sets the trailer count.
  554. /// </summary>
  555. /// <value>The trailer count.</value>
  556. public int? TrailerCount { get; set; }
  557. /// <summary>
  558. /// Gets or sets the song count.
  559. /// </summary>
  560. /// <value>The song count.</value>
  561. public int? SongCount { get; set; }
  562. /// <summary>
  563. /// Gets or sets the album count.
  564. /// </summary>
  565. /// <value>The album count.</value>
  566. public int? AlbumCount { get; set; }
  567. /// <summary>
  568. /// Gets or sets the music video count.
  569. /// </summary>
  570. /// <value>The music video count.</value>
  571. public int? MusicVideoCount { get; set; }
  572. /// <summary>
  573. /// Gets or sets a value indicating whether [enable internet providers].
  574. /// </summary>
  575. /// <value><c>true</c> if [enable internet providers]; otherwise, <c>false</c>.</value>
  576. public bool? LockData { get; set; }
  577. /// <summary>
  578. /// Gets a value indicating whether this instance can resume.
  579. /// </summary>
  580. /// <value><c>true</c> if this instance can resume; otherwise, <c>false</c>.</value>
  581. [IgnoreDataMember]
  582. public bool CanResume
  583. {
  584. get { return UserData != null && UserData.PlaybackPositionTicks > 0; }
  585. }
  586. /// <summary>
  587. /// Gets the resume position ticks.
  588. /// </summary>
  589. /// <value>The resume position ticks.</value>
  590. [IgnoreDataMember]
  591. public long ResumePositionTicks
  592. {
  593. get { return UserData == null ? 0 : UserData.PlaybackPositionTicks; }
  594. }
  595. /// <summary>
  596. /// Gets the backdrop count.
  597. /// </summary>
  598. /// <value>The backdrop count.</value>
  599. [IgnoreDataMember]
  600. public int BackdropCount
  601. {
  602. get { return BackdropImageTags == null ? 0 : BackdropImageTags.Count; }
  603. }
  604. /// <summary>
  605. /// Gets the screenshot count.
  606. /// </summary>
  607. /// <value>The screenshot count.</value>
  608. [IgnoreDataMember]
  609. public int ScreenshotCount
  610. {
  611. get { return ScreenshotImageTags == null ? 0 : ScreenshotImageTags.Count; }
  612. }
  613. /// <summary>
  614. /// Gets a value indicating whether this instance has banner.
  615. /// </summary>
  616. /// <value><c>true</c> if this instance has banner; otherwise, <c>false</c>.</value>
  617. [IgnoreDataMember]
  618. public bool HasBanner
  619. {
  620. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Banner); }
  621. }
  622. /// <summary>
  623. /// Gets a value indicating whether this instance has art.
  624. /// </summary>
  625. /// <value><c>true</c> if this instance has art; otherwise, <c>false</c>.</value>
  626. [IgnoreDataMember]
  627. public bool HasArtImage
  628. {
  629. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Art); }
  630. }
  631. /// <summary>
  632. /// Gets a value indicating whether this instance has logo.
  633. /// </summary>
  634. /// <value><c>true</c> if this instance has logo; otherwise, <c>false</c>.</value>
  635. [IgnoreDataMember]
  636. public bool HasLogo
  637. {
  638. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Logo); }
  639. }
  640. /// <summary>
  641. /// Gets a value indicating whether this instance has thumb.
  642. /// </summary>
  643. /// <value><c>true</c> if this instance has thumb; otherwise, <c>false</c>.</value>
  644. [IgnoreDataMember]
  645. public bool HasThumb
  646. {
  647. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Thumb); }
  648. }
  649. /// <summary>
  650. /// Gets a value indicating whether this instance has primary image.
  651. /// </summary>
  652. /// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value>
  653. [IgnoreDataMember]
  654. public bool HasPrimaryImage
  655. {
  656. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Primary); }
  657. }
  658. /// <summary>
  659. /// Gets a value indicating whether this instance has disc image.
  660. /// </summary>
  661. /// <value><c>true</c> if this instance has disc image; otherwise, <c>false</c>.</value>
  662. [IgnoreDataMember]
  663. public bool HasDiscImage
  664. {
  665. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Disc); }
  666. }
  667. /// <summary>
  668. /// Gets a value indicating whether this instance has box image.
  669. /// </summary>
  670. /// <value><c>true</c> if this instance has box image; otherwise, <c>false</c>.</value>
  671. [IgnoreDataMember]
  672. public bool HasBoxImage
  673. {
  674. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Box); }
  675. }
  676. /// <summary>
  677. /// Gets a value indicating whether this instance has box image.
  678. /// </summary>
  679. /// <value><c>true</c> if this instance has box image; otherwise, <c>false</c>.</value>
  680. [IgnoreDataMember]
  681. public bool HasBoxRearImage
  682. {
  683. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.BoxRear); }
  684. }
  685. /// <summary>
  686. /// Gets a value indicating whether this instance has menu image.
  687. /// </summary>
  688. /// <value><c>true</c> if this instance has menu image; otherwise, <c>false</c>.</value>
  689. [IgnoreDataMember]
  690. public bool HasMenuImage
  691. {
  692. get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Menu); }
  693. }
  694. /// <summary>
  695. /// Gets a value indicating whether this instance is video.
  696. /// </summary>
  697. /// <value><c>true</c> if this instance is video; otherwise, <c>false</c>.</value>
  698. [IgnoreDataMember]
  699. public bool IsVideo
  700. {
  701. get { return string.Equals(MediaType, Entities.MediaType.Video, StringComparison.OrdinalIgnoreCase); }
  702. }
  703. /// <summary>
  704. /// Gets a value indicating whether this instance is audio.
  705. /// </summary>
  706. /// <value><c>true</c> if this instance is audio; otherwise, <c>false</c>.</value>
  707. [IgnoreDataMember]
  708. public bool IsAudio
  709. {
  710. get { return string.Equals(MediaType, Entities.MediaType.Audio, StringComparison.OrdinalIgnoreCase); }
  711. }
  712. /// <summary>
  713. /// Gets a value indicating whether this instance is game.
  714. /// </summary>
  715. /// <value><c>true</c> if this instance is game; otherwise, <c>false</c>.</value>
  716. [IgnoreDataMember]
  717. public bool IsGame
  718. {
  719. get { return string.Equals(MediaType, Entities.MediaType.Game, StringComparison.OrdinalIgnoreCase); }
  720. }
  721. /// <summary>
  722. /// Gets a value indicating whether this instance is person.
  723. /// </summary>
  724. /// <value><c>true</c> if this instance is person; otherwise, <c>false</c>.</value>
  725. [IgnoreDataMember]
  726. public bool IsPerson
  727. {
  728. get { return string.Equals(Type, "Person", StringComparison.OrdinalIgnoreCase); }
  729. }
  730. /// <summary>
  731. /// Gets a value indicating whether this instance is root.
  732. /// </summary>
  733. /// <value><c>true</c> if this instance is root; otherwise, <c>false</c>.</value>
  734. [IgnoreDataMember]
  735. public bool IsRoot
  736. {
  737. get { return string.Equals(Type, "AggregateFolder", StringComparison.OrdinalIgnoreCase); }
  738. }
  739. [IgnoreDataMember]
  740. public bool IsMusicGenre
  741. {
  742. get { return string.Equals(Type, "MusicGenre", StringComparison.OrdinalIgnoreCase); }
  743. }
  744. [IgnoreDataMember]
  745. public bool IsGameGenre
  746. {
  747. get { return string.Equals(Type, "GameGenre", StringComparison.OrdinalIgnoreCase); }
  748. }
  749. [IgnoreDataMember]
  750. public bool IsGenre
  751. {
  752. get { return string.Equals(Type, "Genre", StringComparison.OrdinalIgnoreCase); }
  753. }
  754. [IgnoreDataMember]
  755. public bool IsArtist
  756. {
  757. get { return string.Equals(Type, "Artist", StringComparison.OrdinalIgnoreCase); }
  758. }
  759. [IgnoreDataMember]
  760. public bool IsStudio
  761. {
  762. get { return string.Equals(Type, "Studio", StringComparison.OrdinalIgnoreCase); }
  763. }
  764. /// <summary>
  765. /// Occurs when [property changed].
  766. /// </summary>
  767. public event PropertyChangedEventHandler PropertyChanged;
  768. }
  769. }