Book.cs 1.7 KB

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