Studio.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.Serialization;
  5. namespace MediaBrowser.Controller.Entities
  6. {
  7. /// <summary>
  8. /// Class Studio
  9. /// </summary>
  10. public class Studio : BaseItem, IItemByName, IHasTags
  11. {
  12. public List<string> Tags { get; set; }
  13. public Studio()
  14. {
  15. Tags = new List<string>();
  16. }
  17. /// <summary>
  18. /// Gets the user data key.
  19. /// </summary>
  20. /// <returns>System.String.</returns>
  21. protected override string CreateUserDataKey()
  22. {
  23. return "Studio-" + Name;
  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. [IgnoreDataMember]
  31. public override string ContainingFolderPath
  32. {
  33. get
  34. {
  35. return Path;
  36. }
  37. }
  38. public override bool CanDelete()
  39. {
  40. return false;
  41. }
  42. /// <summary>
  43. /// Gets a value indicating whether this instance is owned item.
  44. /// </summary>
  45. /// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
  46. [IgnoreDataMember]
  47. public override bool IsOwnedItem
  48. {
  49. get
  50. {
  51. return false;
  52. }
  53. }
  54. public IEnumerable<BaseItem> GetTaggedItems(IEnumerable<BaseItem> inputItems)
  55. {
  56. return inputItems.Where(GetItemFilter());
  57. }
  58. public Func<BaseItem, bool> GetItemFilter()
  59. {
  60. return i => i.Studios.Contains(Name, StringComparer.OrdinalIgnoreCase);
  61. }
  62. }
  63. }