MusicGenre.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace MediaBrowser.Controller.Entities.Audio
  5. {
  6. /// <summary>
  7. /// Class MusicGenre
  8. /// </summary>
  9. public class MusicGenre : BaseItem, IItemByName
  10. {
  11. /// <summary>
  12. /// Gets the user data key.
  13. /// </summary>
  14. /// <returns>System.String.</returns>
  15. public override string GetUserDataKey()
  16. {
  17. return "MusicGenre-" + Name;
  18. }
  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. public override string ContainingFolderPath
  29. {
  30. get
  31. {
  32. return Path;
  33. }
  34. }
  35. /// <summary>
  36. /// Gets a value indicating whether this instance is owned item.
  37. /// </summary>
  38. /// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
  39. public override bool IsOwnedItem
  40. {
  41. get
  42. {
  43. return false;
  44. }
  45. }
  46. public IEnumerable<BaseItem> GetTaggedItems(IEnumerable<BaseItem> inputItems)
  47. {
  48. return inputItems.Where(i => (i is IHasMusicGenres) && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase));
  49. }
  50. }
  51. }