Studio.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. public override bool IsSaveLocalMetadataEnabled()
  43. {
  44. return true;
  45. }
  46. /// <summary>
  47. /// Gets a value indicating whether this instance is owned item.
  48. /// </summary>
  49. /// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
  50. [IgnoreDataMember]
  51. public override bool IsOwnedItem
  52. {
  53. get
  54. {
  55. return false;
  56. }
  57. }
  58. public IEnumerable<BaseItem> GetTaggedItems(IEnumerable<BaseItem> inputItems)
  59. {
  60. return inputItems.Where(GetItemFilter());
  61. }
  62. public Func<BaseItem, bool> GetItemFilter()
  63. {
  64. return i => i.Studios.Contains(Name, StringComparer.OrdinalIgnoreCase);
  65. }
  66. [IgnoreDataMember]
  67. public override bool SupportsPeople
  68. {
  69. get
  70. {
  71. return false;
  72. }
  73. }
  74. }
  75. }