aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/LibraryManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index ed5dde4c5..c5171e323 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -32,6 +32,7 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using MoreLinq;
using SortOrder = MediaBrowser.Model.Entities.SortOrder;
namespace MediaBrowser.Server.Implementations.Library
@@ -2055,5 +2056,31 @@ namespace MediaBrowser.Server.Implementations.Library
item.ExtraType = ExtraType.Clip;
}
}
+
+
+ public List<PersonInfo> GetPeople(BaseItem item)
+ {
+ return item.People ?? ItemRepository.GetPeople(item.Id);
+ }
+
+ public List<PersonInfo> GetAllPeople()
+ {
+ return RootFolder.GetRecursiveChildren()
+ .SelectMany(GetPeople)
+ .Where(i => !string.IsNullOrWhiteSpace(i.Name))
+ .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
+ .ToList();
+ }
+
+ public async Task UpdatePeople(BaseItem item, List<PersonInfo> people)
+ {
+ await ItemRepository.UpdatePeople(item.Id, people).ConfigureAwait(false);
+
+ if (item.People != null)
+ {
+ item.People = null;
+ await item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
+ }
+ }
}
}