Remove support for injecting ILogger directly
This commit is contained in:
parent
32c1182226
commit
62420a6eb1
|
@ -546,13 +546,6 @@ namespace Emby.Server.Implementations
|
||||||
|
|
||||||
serviceCollection.AddSingleton<IJsonSerializer, JsonSerializer>();
|
serviceCollection.AddSingleton<IJsonSerializer, JsonSerializer>();
|
||||||
|
|
||||||
// TODO: Remove support for injecting ILogger completely
|
|
||||||
serviceCollection.AddSingleton((provider) =>
|
|
||||||
{
|
|
||||||
Logger.LogWarning("Injecting ILogger directly is deprecated and should be replaced with ILogger<T>");
|
|
||||||
return Logger;
|
|
||||||
});
|
|
||||||
|
|
||||||
serviceCollection.AddSingleton(_fileSystemManager);
|
serviceCollection.AddSingleton(_fileSystemManager);
|
||||||
serviceCollection.AddSingleton<TvdbClientManager>();
|
serviceCollection.AddSingleton<TvdbClientManager>();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MusicAlbumResolver : ItemResolver<MusicAlbum>
|
public class MusicAlbumResolver : ItemResolver<MusicAlbum>
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger<MusicAlbumResolver> _logger;
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
/// <param name="fileSystem">The file system.</param>
|
/// <param name="fileSystem">The file system.</param>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
/// <param name="libraryManager">The library manager.</param>
|
||||||
public MusicAlbumResolver(ILogger logger, IFileSystem fileSystem, ILibraryManager libraryManager)
|
public MusicAlbumResolver(ILogger<MusicAlbumResolver> logger, IFileSystem fileSystem, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MusicArtistResolver : ItemResolver<MusicArtist>
|
public class MusicArtistResolver : ItemResolver<MusicArtist>
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger<MusicAlbumResolver> _logger;
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
@ -23,12 +23,12 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="MusicArtistResolver"/> class.
|
/// Initializes a new instance of the <see cref="MusicArtistResolver"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger for the created <see cref="MusicAlbumResolver"/> instances.</param>
|
||||||
/// <param name="fileSystem">The file system.</param>
|
/// <param name="fileSystem">The file system.</param>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
/// <param name="libraryManager">The library manager.</param>
|
||||||
/// <param name="config">The configuration manager.</param>
|
/// <param name="config">The configuration manager.</param>
|
||||||
public MusicArtistResolver(
|
public MusicArtistResolver(
|
||||||
ILogger<MusicArtistResolver> logger,
|
ILogger<MusicAlbumResolver> logger,
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem,
|
||||||
ILibraryManager libraryManager,
|
ILibraryManager libraryManager,
|
||||||
IServerConfigurationManager config)
|
IServerConfigurationManager config)
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
public M3UTunerHost(
|
public M3UTunerHost(
|
||||||
IServerConfigurationManager config,
|
IServerConfigurationManager config,
|
||||||
IMediaSourceManager mediaSourceManager,
|
IMediaSourceManager mediaSourceManager,
|
||||||
ILogger logger,
|
ILogger<M3UTunerHost> logger,
|
||||||
IJsonSerializer jsonSerializer,
|
IJsonSerializer jsonSerializer,
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem,
|
||||||
IHttpClient httpClient,
|
IHttpClient httpClient,
|
||||||
|
@ -83,7 +83,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
return Task.FromResult(list);
|
return Task.FromResult(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly string[] _disallowedSharedStreamExtensions = new string[]
|
private static readonly string[] _disallowedSharedStreamExtensions =
|
||||||
{
|
{
|
||||||
".mkv",
|
".mkv",
|
||||||
".mp4",
|
".mp4",
|
||||||
|
|
|
@ -33,13 +33,18 @@ namespace MediaBrowser.Api.Movies
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The logger for the created <see cref="ItemsService"/> instances.
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger<ItemsService> _logger;
|
||||||
|
|
||||||
private readonly IDtoService _dtoService;
|
private readonly IDtoService _dtoService;
|
||||||
private readonly ILocalizationManager _localizationManager;
|
private readonly ILocalizationManager _localizationManager;
|
||||||
private readonly IJsonSerializer _json;
|
private readonly IJsonSerializer _json;
|
||||||
private readonly IAuthorizationContext _authContext;
|
private readonly IAuthorizationContext _authContext;
|
||||||
|
|
||||||
public TrailersService(
|
public TrailersService(
|
||||||
ILogger<TrailersService> logger,
|
ILoggerFactory loggerFactory,
|
||||||
IServerConfigurationManager serverConfigurationManager,
|
IServerConfigurationManager serverConfigurationManager,
|
||||||
IHttpResultFactory httpResultFactory,
|
IHttpResultFactory httpResultFactory,
|
||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
|
@ -48,7 +53,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
ILocalizationManager localizationManager,
|
ILocalizationManager localizationManager,
|
||||||
IJsonSerializer json,
|
IJsonSerializer json,
|
||||||
IAuthorizationContext authContext)
|
IAuthorizationContext authContext)
|
||||||
: base(logger, serverConfigurationManager, httpResultFactory)
|
: base(loggerFactory.CreateLogger<TrailersService>(), serverConfigurationManager, httpResultFactory)
|
||||||
{
|
{
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
|
@ -56,6 +61,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
_localizationManager = localizationManager;
|
_localizationManager = localizationManager;
|
||||||
_json = json;
|
_json = json;
|
||||||
_authContext = authContext;
|
_authContext = authContext;
|
||||||
|
_logger = loggerFactory.CreateLogger<ItemsService>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Get(Getrailers request)
|
public object Get(Getrailers request)
|
||||||
|
@ -66,7 +72,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
getItems.IncludeItemTypes = "Trailer";
|
getItems.IncludeItemTypes = "Trailer";
|
||||||
|
|
||||||
return new ItemsService(
|
return new ItemsService(
|
||||||
Logger,
|
_logger,
|
||||||
ServerConfigurationManager,
|
ServerConfigurationManager,
|
||||||
ResultFactory,
|
ResultFactory,
|
||||||
_userManager,
|
_userManager,
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <param name="localization">The localization.</param>
|
/// <param name="localization">The localization.</param>
|
||||||
/// <param name="dtoService">The dto service.</param>
|
/// <param name="dtoService">The dto service.</param>
|
||||||
public ItemsService(
|
public ItemsService(
|
||||||
ILogger logger,
|
ILogger<ItemsService> logger,
|
||||||
IServerConfigurationManager serverConfigurationManager,
|
IServerConfigurationManager serverConfigurationManager,
|
||||||
IHttpResultFactory httpResultFactory,
|
IHttpResultFactory httpResultFactory,
|
||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
|
|
|
@ -11,13 +11,10 @@ using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Providers;
|
using MediaBrowser.Model.Providers;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Plugins.Omdb
|
namespace MediaBrowser.Providers.Plugins.Omdb
|
||||||
{
|
{
|
||||||
public class OmdbEpisodeProvider :
|
public class OmdbEpisodeProvider : IRemoteMetadataProvider<Episode, EpisodeInfo>, IHasOrder
|
||||||
IRemoteMetadataProvider<Episode, EpisodeInfo>,
|
|
||||||
IHasOrder
|
|
||||||
{
|
{
|
||||||
private readonly IJsonSerializer _jsonSerializer;
|
private readonly IJsonSerializer _jsonSerializer;
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
|
@ -26,16 +23,27 @@ namespace MediaBrowser.Providers.Plugins.Omdb
|
||||||
private readonly IServerConfigurationManager _configurationManager;
|
private readonly IServerConfigurationManager _configurationManager;
|
||||||
private readonly IApplicationHost _appHost;
|
private readonly IApplicationHost _appHost;
|
||||||
|
|
||||||
public OmdbEpisodeProvider(IJsonSerializer jsonSerializer, IApplicationHost appHost, IHttpClient httpClient, ILogger logger, ILibraryManager libraryManager, IFileSystem fileSystem, IServerConfigurationManager configurationManager)
|
public OmdbEpisodeProvider(
|
||||||
|
IJsonSerializer jsonSerializer,
|
||||||
|
IApplicationHost appHost,
|
||||||
|
IHttpClient httpClient,
|
||||||
|
ILibraryManager libraryManager,
|
||||||
|
IFileSystem fileSystem,
|
||||||
|
IServerConfigurationManager configurationManager)
|
||||||
{
|
{
|
||||||
_jsonSerializer = jsonSerializer;
|
_jsonSerializer = jsonSerializer;
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_configurationManager = configurationManager;
|
_configurationManager = configurationManager;
|
||||||
_appHost = appHost;
|
_appHost = appHost;
|
||||||
_itemProvider = new OmdbItemProvider(jsonSerializer, _appHost, httpClient, logger, libraryManager, fileSystem, configurationManager);
|
_itemProvider = new OmdbItemProvider(jsonSerializer, _appHost, httpClient, libraryManager, fileSystem, configurationManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// After TheTvDb
|
||||||
|
public int Order => 1;
|
||||||
|
|
||||||
|
public string Name => "The Open Movie Database";
|
||||||
|
|
||||||
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(EpisodeInfo searchInfo, CancellationToken cancellationToken)
|
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(EpisodeInfo searchInfo, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _itemProvider.GetSearchResults(searchInfo, "episode", cancellationToken);
|
return _itemProvider.GetSearchResults(searchInfo, "episode", cancellationToken);
|
||||||
|
@ -66,10 +74,6 @@ namespace MediaBrowser.Providers.Plugins.Omdb
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
// After TheTvDb
|
|
||||||
public int Order => 1;
|
|
||||||
|
|
||||||
public string Name => "The Open Movie Database";
|
|
||||||
|
|
||||||
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
|
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,6 @@ using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Providers;
|
using MediaBrowser.Model.Providers;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Plugins.Omdb
|
namespace MediaBrowser.Providers.Plugins.Omdb
|
||||||
{
|
{
|
||||||
|
@ -26,22 +25,27 @@ namespace MediaBrowser.Providers.Plugins.Omdb
|
||||||
{
|
{
|
||||||
private readonly IJsonSerializer _jsonSerializer;
|
private readonly IJsonSerializer _jsonSerializer;
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private readonly IServerConfigurationManager _configurationManager;
|
private readonly IServerConfigurationManager _configurationManager;
|
||||||
private readonly IApplicationHost _appHost;
|
private readonly IApplicationHost _appHost;
|
||||||
|
|
||||||
public OmdbItemProvider(IJsonSerializer jsonSerializer, IApplicationHost appHost, IHttpClient httpClient, ILogger logger, ILibraryManager libraryManager, IFileSystem fileSystem, IServerConfigurationManager configurationManager)
|
public OmdbItemProvider(
|
||||||
|
IJsonSerializer jsonSerializer,
|
||||||
|
IApplicationHost appHost,
|
||||||
|
IHttpClient httpClient,
|
||||||
|
ILibraryManager libraryManager,
|
||||||
|
IFileSystem fileSystem,
|
||||||
|
IServerConfigurationManager configurationManager)
|
||||||
{
|
{
|
||||||
_jsonSerializer = jsonSerializer;
|
_jsonSerializer = jsonSerializer;
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
_logger = logger;
|
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_configurationManager = configurationManager;
|
_configurationManager = configurationManager;
|
||||||
_appHost = appHost;
|
_appHost = appHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
// After primary option
|
// After primary option
|
||||||
public int Order => 2;
|
public int Order => 2;
|
||||||
|
|
||||||
|
@ -80,7 +84,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb
|
||||||
var parsedName = _libraryManager.ParseName(name);
|
var parsedName = _libraryManager.ParseName(name);
|
||||||
var yearInName = parsedName.Year;
|
var yearInName = parsedName.Year;
|
||||||
name = parsedName.Name;
|
name = parsedName.Name;
|
||||||
year = year ?? yearInName;
|
year ??= yearInName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(imdbId))
|
if (string.IsNullOrWhiteSpace(imdbId))
|
||||||
|
@ -312,6 +316,5 @@ namespace MediaBrowser.Providers.Plugins.Omdb
|
||||||
/// <value>The results.</value>
|
/// <value>The results.</value>
|
||||||
public List<SearchResult> Search { get; set; }
|
public List<SearchResult> Search { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user