MusicGenre.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.Serialization;
  5. namespace MediaBrowser.Controller.Entities.Audio
  6. {
  7. /// <summary>
  8. /// Class MusicGenre
  9. /// </summary>
  10. public class MusicGenre : BaseItem, IItemByName
  11. {
  12. public override List<string> GetUserDataKeys()
  13. {
  14. var list = base.GetUserDataKeys();
  15. list.Insert(0, "MusicGenre-" + Name);
  16. return list;
  17. }
  18. [IgnoreDataMember]
  19. public override bool SupportsAddingToPlaylist
  20. {
  21. get { return true; }
  22. }
  23. /// <summary>
  24. /// Returns the folder containing the item.
  25. /// If the item is a folder, it returns the folder itself
  26. /// </summary>
  27. /// <value>The containing folder path.</value>
  28. [IgnoreDataMember]
  29. public override string ContainingFolderPath
  30. {
  31. get
  32. {
  33. return Path;
  34. }
  35. }
  36. public override bool CanDelete()
  37. {
  38. return false;
  39. }
  40. public override bool IsSaveLocalMetadataEnabled()
  41. {
  42. return true;
  43. }
  44. /// <summary>
  45. /// Gets a value indicating whether this instance is owned item.
  46. /// </summary>
  47. /// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
  48. [IgnoreDataMember]
  49. public override bool IsOwnedItem
  50. {
  51. get
  52. {
  53. return false;
  54. }
  55. }
  56. public IEnumerable<BaseItem> GetTaggedItems(IEnumerable<BaseItem> inputItems)
  57. {
  58. return inputItems.Where(GetItemFilter());
  59. }
  60. public Func<BaseItem, bool> GetItemFilter()
  61. {
  62. return i => i is IHasMusicGenres && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase);
  63. }
  64. [IgnoreDataMember]
  65. public override bool SupportsPeople
  66. {
  67. get
  68. {
  69. return false;
  70. }
  71. }
  72. }
  73. }