aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Collections
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/Collections')
-rw-r--r--Emby.Server.Implementations/Collections/CollectionManager.cs31
1 files changed, 14 insertions, 17 deletions
diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.cs
index bcfc58ca1..d1d793136 100644
--- a/Emby.Server.Implementations/Collections/CollectionManager.cs
+++ b/Emby.Server.Implementations/Collections/CollectionManager.cs
@@ -4,7 +4,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
@@ -143,7 +143,7 @@ namespace Emby.Server.Implementations.Collections
if (options.ItemIdList.Length > 0)
{
- AddToCollection(collection.Id, options.ItemIdList, false, new MetadataRefreshOptions(_fileSystem)
+ AddToCollection(collection.Id, options.ItemIdList, false, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
{
// The initial adding of items is going to create a local metadata file
// This will cause internet metadata to be skipped as a result
@@ -152,15 +152,14 @@ namespace Emby.Server.Implementations.Collections
}
else
{
- _providerManager.QueueRefresh(collection.Id, new MetadataRefreshOptions(_fileSystem), RefreshPriority.High);
+ _providerManager.QueueRefresh(collection.Id, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem)), RefreshPriority.High);
}
- EventHelper.FireEventIfNotNull(CollectionCreated, this, new CollectionCreatedEventArgs
+ CollectionCreated?.Invoke(this, new CollectionCreatedEventArgs
{
Collection = collection,
Options = options
-
- }, _logger);
+ });
return collection;
}
@@ -173,12 +172,12 @@ namespace Emby.Server.Implementations.Collections
public void AddToCollection(Guid collectionId, IEnumerable<string> ids)
{
- AddToCollection(collectionId, ids, true, new MetadataRefreshOptions(_fileSystem));
+ AddToCollection(collectionId, ids, true, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem)));
}
public void AddToCollection(Guid collectionId, IEnumerable<Guid> ids)
{
- AddToCollection(collectionId, ids.Select(i => i.ToString("N")), true, new MetadataRefreshOptions(_fileSystem));
+ AddToCollection(collectionId, ids.Select(i => i.ToString("N")), true, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem)));
}
private void AddToCollection(Guid collectionId, IEnumerable<string> ids, bool fireEvent, MetadataRefreshOptions refreshOptions)
@@ -230,12 +229,11 @@ namespace Emby.Server.Implementations.Collections
if (fireEvent)
{
- EventHelper.FireEventIfNotNull(ItemsAddedToCollection, this, new CollectionModifiedEventArgs
+ ItemsAddedToCollection?.Invoke(this, new CollectionModifiedEventArgs
{
Collection = collection,
ItemsChanged = itemList
-
- }, _logger);
+ });
}
}
}
@@ -265,7 +263,7 @@ namespace Emby.Server.Implementations.Collections
if (child == null)
{
- _logger.Warn("No collection title exists with the supplied Id");
+ _logger.LogWarning("No collection title exists with the supplied Id");
continue;
}
@@ -283,17 +281,16 @@ namespace Emby.Server.Implementations.Collections
}
collection.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
- _providerManager.QueueRefresh(collection.Id, new MetadataRefreshOptions(_fileSystem)
+ _providerManager.QueueRefresh(collection.Id, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
{
ForceSave = true
}, RefreshPriority.High);
- EventHelper.FireEventIfNotNull(ItemsRemovedFromCollection, this, new CollectionModifiedEventArgs
+ ItemsRemovedFromCollection?.Invoke(this, new CollectionModifiedEventArgs
{
Collection = collection,
ItemsChanged = itemList
-
- }, _logger);
+ });
}
public IEnumerable<BaseItem> CollapseItemsWithinBoxSets(IEnumerable<BaseItem> items, User user)
@@ -365,7 +362,7 @@ namespace Emby.Server.Implementations.Collections
}
catch (Exception ex)
{
- _logger.ErrorException("Error creating camera uploads library", ex);
+ _logger.LogError(ex, "Error creating camera uploads library");
}
_config.Configuration.CollectionsUpgraded = true;