MusicGenre.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. /// <summary>
  13. /// Gets the user data key.
  14. /// </summary>
  15. /// <returns>System.String.</returns>
  16. public override string GetUserDataKey()
  17. {
  18. return "MusicGenre-" + Name;
  19. }
  20. [IgnoreDataMember]
  21. public override bool SupportsAddingToPlaylist
  22. {
  23. get { return true; }
  24. }
  25. /// <summary>
  26. /// Returns the folder containing the item.
  27. /// If the item is a folder, it returns the folder itself
  28. /// </summary>
  29. /// <value>The containing folder path.</value>
  30. public override string ContainingFolderPath
  31. {
  32. get
  33. {
  34. return Path;
  35. }
  36. }
  37. /// <summary>
  38. /// Gets a value indicating whether this instance is owned item.
  39. /// </summary>
  40. /// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
  41. public override bool IsOwnedItem
  42. {
  43. get
  44. {
  45. return false;
  46. }
  47. }
  48. public IEnumerable<BaseItem> GetTaggedItems(IEnumerable<BaseItem> inputItems)
  49. {
  50. return inputItems.Where(i => (i is IHasMusicGenres) && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase));
  51. }
  52. }
  53. }