mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-23 01:05:19 +03:00
updated nuget
This commit is contained in:
@@ -92,13 +92,27 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <exception cref="System.InvalidOperationException">Unable to add + item.Name</exception>
|
||||
public async Task AddChild(BaseItem item, CancellationToken cancellationToken)
|
||||
{
|
||||
item.Parent = this;
|
||||
|
||||
if (item.Id == Guid.Empty)
|
||||
{
|
||||
item.Id = item.Path.GetMBId(item.GetType());
|
||||
}
|
||||
|
||||
if (item.DateCreated == DateTime.MinValue)
|
||||
{
|
||||
item.DateCreated = DateTime.Now;
|
||||
}
|
||||
if (item.DateModified == DateTime.MinValue)
|
||||
{
|
||||
item.DateModified = DateTime.Now;
|
||||
}
|
||||
|
||||
if (!_children.TryAdd(item.Id, item))
|
||||
{
|
||||
throw new InvalidOperationException("Unable to add " + item.Name);
|
||||
}
|
||||
|
||||
item.Parent = this;
|
||||
|
||||
var newChildren = Children.ToList();
|
||||
|
||||
await LibraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
Reference in New Issue
Block a user