Book.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System;
  2. using System.Linq;
  3. using MediaBrowser.Controller.Providers;
  4. using MediaBrowser.Model.Configuration;
  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. public Guid? FindSeriesId()
  38. {
  39. return SeriesId;
  40. }
  41. public override bool CanDownload()
  42. {
  43. var locationType = LocationType;
  44. return locationType != LocationType.Remote &&
  45. locationType != LocationType.Virtual;
  46. }
  47. public override UnratedItem GetBlockUnratedType()
  48. {
  49. return UnratedItem.Book;
  50. }
  51. public BookInfo GetLookupInfo()
  52. {
  53. var info = GetItemLookupInfo<BookInfo>();
  54. if (string.IsNullOrEmpty(SeriesName))
  55. {
  56. info.SeriesName = GetParents().Select(i => i.Name).FirstOrDefault();
  57. }
  58. else
  59. {
  60. info.SeriesName = SeriesName;
  61. }
  62. return info;
  63. }
  64. }
  65. }