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.cs61
1 files changed, 48 insertions, 13 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index c5171e323..bdc94b88b 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -345,7 +345,7 @@ namespace MediaBrowser.Server.Implementations.Library
try
{
- await UpdateItem(season, ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
+ await UpdateItem(season, ItemUpdateType.MetadataDownload, cancellationToken).ConfigureAwait(false);
}
catch (Exception ex)
{
@@ -1108,6 +1108,8 @@ namespace MediaBrowser.Server.Implementations.Library
progress.Report(innerPercent);
});
+ _logger.Debug("Running post-scan task {0}", task.GetType().Name);
+
try
{
await task.Run(innerProgress, cancellationToken).ConfigureAwait(false);
@@ -1223,6 +1225,11 @@ namespace MediaBrowser.Server.Implementations.Library
};
}
+ public List<Guid> GetItemIds(InternalItemsQuery query)
+ {
+ return ItemRepository.GetItemIdsList(query);
+ }
+
/// <summary>
/// Gets the intros.
/// </summary>
@@ -2057,30 +2064,58 @@ namespace MediaBrowser.Server.Implementations.Library
}
}
+ public List<PersonInfo> GetPeople(InternalPeopleQuery query)
+ {
+ return ItemRepository.GetPeople(query);
+ }
public List<PersonInfo> GetPeople(BaseItem item)
{
- return item.People ?? ItemRepository.GetPeople(item.Id);
+ var people = GetPeople(new InternalPeopleQuery
+ {
+ ItemId = item.Id
+ });
+
+ if (people.Count > 0)
+ {
+ return people;
+ }
+
+ return item.People ?? new List<PersonInfo>();
+ }
+
+ public List<Person> GetPeopleItems(InternalPeopleQuery query)
+ {
+ return ItemRepository.GetPeopleNames(query).Select(i =>
+ {
+ try
+ {
+ return GetPerson(i);
+ }
+ catch (Exception ex)
+ {
+ _logger.ErrorException("Error getting person", ex);
+ return null;
+ }
+
+ }).Where(i => i != null).ToList();
+ }
+
+ public List<string> GetPeopleNames(InternalPeopleQuery query)
+ {
+ return ItemRepository.GetPeopleNames(query);
}
public List<PersonInfo> GetAllPeople()
{
- return RootFolder.GetRecursiveChildren()
- .SelectMany(GetPeople)
- .Where(i => !string.IsNullOrWhiteSpace(i.Name))
+ return GetPeople(new InternalPeopleQuery())
.DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
.ToList();
}
- public async Task UpdatePeople(BaseItem item, List<PersonInfo> people)
+ public 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);
- }
+ return ItemRepository.UpdatePeople(item.Id, people);
}
}
}