Book.cs 1.6 KB

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