Book.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using MediaBrowser.Controller.Providers;
  2. using MediaBrowser.Model.Configuration;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace MediaBrowser.Controller.Entities
  6. {
  7. public class Book : BaseItem, IHasTags, IHasPreferredMetadataLanguage, IHasLookupInfo<BookInfo>, IHasSeries
  8. {
  9. public override string MediaType
  10. {
  11. get
  12. {
  13. return Model.Entities.MediaType.Book;
  14. }
  15. }
  16. /// <summary>
  17. /// Gets or sets the tags.
  18. /// </summary>
  19. /// <value>The tags.</value>
  20. public List<string> Tags { get; set; }
  21. public string SeriesName { get; set; }
  22. public string PreferredMetadataLanguage { get; set; }
  23. /// <summary>
  24. /// Gets or sets the preferred metadata country code.
  25. /// </summary>
  26. /// <value>The preferred metadata country code.</value>
  27. public string PreferredMetadataCountryCode { get; set; }
  28. public Book()
  29. {
  30. Tags = new List<string>();
  31. }
  32. protected override bool GetBlockUnratedValue(UserConfiguration config)
  33. {
  34. return config.BlockUnratedItems.Contains(UnratedItem.Book);
  35. }
  36. public BookInfo GetLookupInfo()
  37. {
  38. var info = GetItemLookupInfo<BookInfo>();
  39. if (string.IsNullOrEmpty(SeriesName))
  40. {
  41. info.SeriesName = Parents.Select(i => i.Name).FirstOrDefault();
  42. }
  43. else
  44. {
  45. info.SeriesName = SeriesName;
  46. }
  47. return info;
  48. }
  49. }
  50. }