Book.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System;
  2. using MediaBrowser.Controller.Providers;
  3. using MediaBrowser.Model.Configuration;
  4. using System.Linq;
  5. using MediaBrowser.Model.Serialization;
  6. using MediaBrowser.Model.Entities;
  7. namespace MediaBrowser.Controller.Entities
  8. {
  9. public class Book : BaseItem, IHasLookupInfo<BookInfo>, IHasSeries
  10. {
  11. [IgnoreDataMember]
  12. public override string MediaType
  13. {
  14. get
  15. {
  16. return Model.Entities.MediaType.Book;
  17. }
  18. }
  19. [IgnoreDataMember]
  20. public string SeriesPresentationUniqueKey { get; set; }
  21. [IgnoreDataMember]
  22. public string SeriesName { get; set; }
  23. [IgnoreDataMember]
  24. public Guid? SeriesId { get; set; }
  25. public string FindSeriesSortName()
  26. {
  27. return SeriesName;
  28. }
  29. public string FindSeriesName()
  30. {
  31. return SeriesName;
  32. }
  33. public string FindSeriesPresentationUniqueKey()
  34. {
  35. return SeriesPresentationUniqueKey;
  36. }
  37. [IgnoreDataMember]
  38. public override bool EnableRefreshOnDateModifiedChange
  39. {
  40. get { return true; }
  41. }
  42. public Guid? FindSeriesId()
  43. {
  44. return SeriesId;
  45. }
  46. public override bool CanDownload()
  47. {
  48. var locationType = LocationType;
  49. return locationType != LocationType.Remote &&
  50. locationType != LocationType.Virtual;
  51. }
  52. public override UnratedItem GetBlockUnratedType()
  53. {
  54. return UnratedItem.Book;
  55. }
  56. public BookInfo GetLookupInfo()
  57. {
  58. var info = GetItemLookupInfo<BookInfo>();
  59. if (string.IsNullOrEmpty(SeriesName))
  60. {
  61. info.SeriesName = GetParents().Select(i => i.Name).FirstOrDefault();
  62. }
  63. else
  64. {
  65. info.SeriesName = SeriesName;
  66. }
  67. return info;
  68. }
  69. }
  70. }