mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-05 21:37:10 -04:00
more dependancy injection
This commit is contained in:
parent
8f41685a96
commit
931c0ea455
@ -412,18 +412,18 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
Logger.Info("Version {0} initializing", ApplicationVersion);
|
Logger.Info("Version {0} initializing", ApplicationVersion);
|
||||||
|
|
||||||
DisposeHttpManager();
|
DisposeHttpManager();
|
||||||
HttpManager = new HttpManager(this);
|
HttpManager = new HttpManager(this, Logger);
|
||||||
|
|
||||||
await OnConfigurationLoaded().ConfigureAwait(false);
|
await OnConfigurationLoaded().ConfigureAwait(false);
|
||||||
|
|
||||||
DisposeTaskManager();
|
DisposeTaskManager();
|
||||||
TaskManager = new TaskManager(this);
|
TaskManager = new TaskManager(this, Logger);
|
||||||
|
|
||||||
Logger.Info("Loading Plugins");
|
Logger.Info("Loading Plugins");
|
||||||
await ReloadComposableParts().ConfigureAwait(false);
|
await ReloadComposableParts().ConfigureAwait(false);
|
||||||
|
|
||||||
DisposeTcpManager();
|
DisposeTcpManager();
|
||||||
TcpManager = new TcpManager(this);
|
TcpManager = new TcpManager(this, Logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
using MediaBrowser.Common.Logging;
|
using System;
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Kernel
|
namespace MediaBrowser.Common.Kernel
|
||||||
{
|
{
|
||||||
@ -9,14 +7,8 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TKernelType">The type of the T kernel type.</typeparam>
|
/// <typeparam name="TKernelType">The type of the T kernel type.</typeparam>
|
||||||
public abstract class BaseManager<TKernelType> : IDisposable
|
public abstract class BaseManager<TKernelType> : IDisposable
|
||||||
where TKernelType : IKernel
|
where TKernelType : class, IKernel
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Gets the logger.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The logger.</value>
|
|
||||||
protected ILogger Logger { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _kernel
|
/// The _kernel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -35,10 +27,6 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
}
|
}
|
||||||
|
|
||||||
Kernel = kernel;
|
Kernel = kernel;
|
||||||
|
|
||||||
Logger = LogManager.GetLogger(GetType().Name);
|
|
||||||
|
|
||||||
Logger.Info("Initializing");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -46,8 +34,6 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Logger.Info("Disposing");
|
|
||||||
|
|
||||||
Dispose(true);
|
Dispose(true);
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using Alchemy.Classes;
|
|||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Common.Serialization;
|
using MediaBrowser.Common.Serialization;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@ -59,6 +60,11 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
/// <value>The external web socket server.</value>
|
/// <value>The external web socket server.</value>
|
||||||
private WebSocketServer ExternalWebSocketServer { get; set; }
|
private WebSocketServer ExternalWebSocketServer { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The _logger
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _supports native web socket
|
/// The _supports native web socket
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -103,9 +109,12 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
/// Initializes a new instance of the <see cref="TcpManager" /> class.
|
/// Initializes a new instance of the <see cref="TcpManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
public TcpManager(IKernel kernel)
|
/// <param name="logger">The logger.</param>
|
||||||
|
public TcpManager(IKernel kernel, ILogger logger)
|
||||||
: base(kernel)
|
: base(kernel)
|
||||||
{
|
{
|
||||||
|
_logger = logger;
|
||||||
|
|
||||||
if (kernel.IsFirstRun)
|
if (kernel.IsFirstRun)
|
||||||
{
|
{
|
||||||
RegisterServerWithAdministratorAccess();
|
RegisterServerWithAdministratorAccess();
|
||||||
@ -141,7 +150,7 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
|
|
||||||
ExternalWebSocketServer.Start();
|
ExternalWebSocketServer.Start();
|
||||||
|
|
||||||
Logger.Info("Alchemy Web Socket Server started");
|
_logger.Info("Alchemy Web Socket Server started");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -150,7 +159,7 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
/// <param name="context">The context.</param>
|
/// <param name="context">The context.</param>
|
||||||
private void OnAlchemyWebSocketClientConnected(UserContext context)
|
private void OnAlchemyWebSocketClientConnected(UserContext context)
|
||||||
{
|
{
|
||||||
var connection = new WebSocketConnection(new AlchemyWebSocket(context, Logger), context.ClientAddress, ProcessWebSocketMessageReceived, Logger);
|
var connection = new WebSocketConnection(new AlchemyWebSocket(context, _logger), context.ClientAddress, ProcessWebSocketMessageReceived, _logger);
|
||||||
|
|
||||||
_webSocketConnections.Add(connection);
|
_webSocketConnections.Add(connection);
|
||||||
}
|
}
|
||||||
@ -169,15 +178,15 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
|
|
||||||
DisposeHttpServer();
|
DisposeHttpServer();
|
||||||
|
|
||||||
Logger.Info("Loading Http Server");
|
_logger.Info("Loading Http Server");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HttpServer = new HttpServer(Kernel.HttpServerUrlPrefix, "Media Browser", Kernel, Logger);
|
HttpServer = new HttpServer(Kernel.HttpServerUrlPrefix, "Media Browser", Kernel, _logger);
|
||||||
}
|
}
|
||||||
catch (HttpListenerException ex)
|
catch (HttpListenerException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error starting Http Server", ex);
|
_logger.ErrorException("Error starting Http Server", ex);
|
||||||
|
|
||||||
if (registerServerOnFailure)
|
if (registerServerOnFailure)
|
||||||
{
|
{
|
||||||
@ -202,7 +211,7 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
/// <param name="e">The <see cref="WebSocketConnectEventArgs" /> instance containing the event data.</param>
|
/// <param name="e">The <see cref="WebSocketConnectEventArgs" /> instance containing the event data.</param>
|
||||||
void HttpServer_WebSocketConnected(object sender, WebSocketConnectEventArgs e)
|
void HttpServer_WebSocketConnected(object sender, WebSocketConnectEventArgs e)
|
||||||
{
|
{
|
||||||
var connection = new WebSocketConnection(e.WebSocket, e.Endpoint, ProcessWebSocketMessageReceived, Logger);
|
var connection = new WebSocketConnection(e.WebSocket, e.Endpoint, ProcessWebSocketMessageReceived, _logger);
|
||||||
|
|
||||||
_webSocketConnections.Add(connection);
|
_webSocketConnections.Add(connection);
|
||||||
}
|
}
|
||||||
@ -221,7 +230,7 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("{0} failed processing WebSocket message {1}", ex, i.GetType().Name, result.MessageType);
|
_logger.ErrorException("{0} failed processing WebSocket message {1}", ex, i.GetType().Name, result.MessageType);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -254,7 +263,7 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
}
|
}
|
||||||
catch (SocketException ex)
|
catch (SocketException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Failed to start UDP Server", ex);
|
_logger.ErrorException("Failed to start UDP Server", ex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +274,7 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
|
|
||||||
if (expectedMessageBytes.SequenceEqual(res.Buffer))
|
if (expectedMessageBytes.SequenceEqual(res.Buffer))
|
||||||
{
|
{
|
||||||
Logger.Info("Received UDP server request from " + res.RemoteEndPoint.ToString());
|
_logger.Info("Received UDP server request from " + res.RemoteEndPoint.ToString());
|
||||||
|
|
||||||
// Send a response back with our ip address and port
|
// Send a response back with our ip address and port
|
||||||
var response = String.Format("MediaBrowser{0}|{1}:{2}", Kernel.KernelContext, NetUtils.GetLocalIpAddress(), Kernel.UdpServerPortNumber);
|
var response = String.Format("MediaBrowser{0}|{1}:{2}", Kernel.KernelContext, NetUtils.GetLocalIpAddress(), Kernel.UdpServerPortNumber);
|
||||||
@ -330,7 +339,7 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
|
|
||||||
if (connections.Count > 0)
|
if (connections.Count > 0)
|
||||||
{
|
{
|
||||||
Logger.Info("Sending web socket message {0}", messageType);
|
_logger.Info("Sending web socket message {0}", messageType);
|
||||||
|
|
||||||
var message = new WebSocketMessage<T> { MessageType = messageType, Data = dataFunction() };
|
var message = new WebSocketMessage<T> { MessageType = messageType, Data = dataFunction() };
|
||||||
var bytes = JsonSerializer.SerializeToBytes(message);
|
var bytes = JsonSerializer.SerializeToBytes(message);
|
||||||
@ -347,7 +356,7 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error sending web socket message {0} to {1}", ex, messageType, s.RemoteEndPoint);
|
_logger.ErrorException("Error sending web socket message {0} to {1}", ex, messageType, s.RemoteEndPoint);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -386,7 +395,7 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
|
|
||||||
if (HttpServer != null)
|
if (HttpServer != null)
|
||||||
{
|
{
|
||||||
Logger.Info("Disposing Http Server");
|
_logger.Info("Disposing Http Server");
|
||||||
|
|
||||||
HttpServer.WebSocketConnected -= HttpServer_WebSocketConnected;
|
HttpServer.WebSocketConnected -= HttpServer_WebSocketConnected;
|
||||||
HttpServer.Dispose();
|
HttpServer.Dispose();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
@ -20,13 +21,20 @@ namespace MediaBrowser.Common.Net
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class HttpManager : BaseManager<IKernel>
|
public class HttpManager : BaseManager<IKernel>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The _logger
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="HttpManager" /> class.
|
/// Initializes a new instance of the <see cref="HttpManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
public HttpManager(IKernel kernel)
|
/// <param name="logger">The logger.</param>
|
||||||
|
public HttpManager(IKernel kernel, ILogger logger)
|
||||||
: base(kernel)
|
: base(kernel)
|
||||||
{
|
{
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -83,7 +91,7 @@ namespace MediaBrowser.Common.Net
|
|||||||
|
|
||||||
await resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
Logger.Info("HttpManager.Get url: {0}", url);
|
_logger.Info("HttpManager.Get url: {0}", url);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -101,7 +109,7 @@ namespace MediaBrowser.Common.Net
|
|||||||
}
|
}
|
||||||
catch (HttpRequestException ex)
|
catch (HttpRequestException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error getting response from " + url, ex);
|
_logger.ErrorException("Error getting response from " + url, ex);
|
||||||
|
|
||||||
throw new HttpException(ex.Message, ex);
|
throw new HttpException(ex.Message, ex);
|
||||||
}
|
}
|
||||||
@ -138,7 +146,7 @@ namespace MediaBrowser.Common.Net
|
|||||||
|
|
||||||
await resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
Logger.Info("HttpManager.Post url: {0}", url);
|
_logger.Info("HttpManager.Post url: {0}", url);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -156,7 +164,7 @@ namespace MediaBrowser.Common.Net
|
|||||||
}
|
}
|
||||||
catch (HttpRequestException ex)
|
catch (HttpRequestException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error getting response from " + url, ex);
|
_logger.ErrorException("Error getting response from " + url, ex);
|
||||||
|
|
||||||
throw new HttpException(ex.Message, ex);
|
throw new HttpException(ex.Message, ex);
|
||||||
}
|
}
|
||||||
@ -199,7 +207,7 @@ namespace MediaBrowser.Common.Net
|
|||||||
|
|
||||||
await resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
Logger.Info("HttpManager.FetchToTempFile url: {0}, temp file: {1}", url, tempFile);
|
_logger.Info("HttpManager.FetchToTempFile url: {0}, temp file: {1}", url, tempFile);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -257,7 +265,7 @@ namespace MediaBrowser.Common.Net
|
|||||||
}
|
}
|
||||||
catch (HttpRequestException ex)
|
catch (HttpRequestException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error getting response from " + url, ex);
|
_logger.ErrorException("Error getting response from " + url, ex);
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
if (File.Exists(tempFile))
|
if (File.Exists(tempFile))
|
||||||
@ -269,7 +277,7 @@ namespace MediaBrowser.Common.Net
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error getting response from " + url, ex);
|
_logger.ErrorException("Error getting response from " + url, ex);
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
if (File.Exists(tempFile))
|
if (File.Exists(tempFile))
|
||||||
@ -305,7 +313,7 @@ namespace MediaBrowser.Common.Net
|
|||||||
|
|
||||||
var ms = new MemoryStream();
|
var ms = new MemoryStream();
|
||||||
|
|
||||||
Logger.Info("HttpManager.FetchToMemoryStream url: {0}", url);
|
_logger.Info("HttpManager.FetchToMemoryStream url: {0}", url);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -337,7 +345,7 @@ namespace MediaBrowser.Common.Net
|
|||||||
}
|
}
|
||||||
catch (HttpRequestException ex)
|
catch (HttpRequestException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error getting response from " + url, ex);
|
_logger.ErrorException("Error getting response from " + url, ex);
|
||||||
|
|
||||||
ms.Dispose();
|
ms.Dispose();
|
||||||
|
|
||||||
@ -345,7 +353,7 @@ namespace MediaBrowser.Common.Net
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error getting response from " + url, ex);
|
_logger.ErrorException("Error getting response from " + url, ex);
|
||||||
|
|
||||||
ms.Dispose();
|
ms.Dispose();
|
||||||
|
|
||||||
@ -427,7 +435,7 @@ namespace MediaBrowser.Common.Net
|
|||||||
{
|
{
|
||||||
var msg = string.Format("Connection to {0} timed out", url);
|
var msg = string.Format("Connection to {0} timed out", url);
|
||||||
|
|
||||||
Logger.Error(msg);
|
_logger.Error(msg);
|
||||||
|
|
||||||
// Throw an HttpException so that the caller doesn't think it was cancelled by user code
|
// Throw an HttpException so that the caller doesn't think it was cancelled by user code
|
||||||
return new HttpException(msg, exception) { IsTimedOut = true };
|
return new HttpException(msg, exception) { IsTimedOut = true };
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -16,14 +17,20 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly List<Type> _taskQueue = new List<Type>();
|
private readonly List<Type> _taskQueue = new List<Type>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The _logger
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="TaskManager" /> class.
|
/// Initializes a new instance of the <see cref="TaskManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
public TaskManager(IKernel kernel)
|
/// <param name="logger">The logger.</param>
|
||||||
|
public TaskManager(IKernel kernel, ILogger logger)
|
||||||
: base(kernel)
|
: base(kernel)
|
||||||
{
|
{
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -70,12 +77,12 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||||||
|
|
||||||
if (!_taskQueue.Contains(type))
|
if (!_taskQueue.Contains(type))
|
||||||
{
|
{
|
||||||
Logger.Info("Queueing task {0}", type.Name);
|
_logger.Info("Queueing task {0}", type.Name);
|
||||||
_taskQueue.Add(type);
|
_taskQueue.Add(type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.Info("Task already queued: {0}", type.Name);
|
_logger.Info("Task already queued: {0}", type.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ using System.Drawing.Imaging;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Drawing
|
namespace MediaBrowser.Controller.Drawing
|
||||||
{
|
{
|
||||||
@ -51,13 +52,21 @@ namespace MediaBrowser.Controller.Drawing
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly ConcurrentDictionary<string, Task<ImageSize>> _cachedImagedSizes = new ConcurrentDictionary<string, Task<ImageSize>>();
|
private readonly ConcurrentDictionary<string, Task<ImageSize>> _cachedImagedSizes = new ConcurrentDictionary<string, Task<ImageSize>>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The _logger
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ImageManager" /> class.
|
/// Initializes a new instance of the <see cref="ImageManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
public ImageManager(Kernel kernel)
|
/// <param name="logger">The logger.</param>
|
||||||
|
public ImageManager(Kernel kernel, ILogger logger)
|
||||||
: base(kernel)
|
: base(kernel)
|
||||||
{
|
{
|
||||||
|
_logger = logger;
|
||||||
|
|
||||||
ImageSizeCache = new FileSystemRepository(Path.Combine(Kernel.ApplicationPaths.ImageCachePath, "image-sizes"));
|
ImageSizeCache = new FileSystemRepository(Path.Combine(Kernel.ApplicationPaths.ImageCachePath, "image-sizes"));
|
||||||
ResizedImageCache = new FileSystemRepository(Path.Combine(Kernel.ApplicationPaths.ImageCachePath, "resized-images"));
|
ResizedImageCache = new FileSystemRepository(Path.Combine(Kernel.ApplicationPaths.ImageCachePath, "resized-images"));
|
||||||
CroppedImageCache = new FileSystemRepository(Path.Combine(Kernel.ApplicationPaths.ImageCachePath, "cropped-images"));
|
CroppedImageCache = new FileSystemRepository(Path.Combine(Kernel.ApplicationPaths.ImageCachePath, "cropped-images"));
|
||||||
@ -103,7 +112,7 @@ namespace MediaBrowser.Controller.Drawing
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// We have to have a catch-all here because some of the .net image methods throw a plain old Exception
|
// We have to have a catch-all here because some of the .net image methods throw a plain old Exception
|
||||||
Logger.ErrorException("Error cropping image", ex);
|
_logger.ErrorException("Error cropping image", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +130,7 @@ namespace MediaBrowser.Controller.Drawing
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
Logger.Error("Error enhancing image");
|
_logger.Error("Error enhancing image");
|
||||||
}
|
}
|
||||||
|
|
||||||
var originalImageSize = await GetImageSize(originalImagePath, dateModified).ConfigureAwait(false);
|
var originalImageSize = await GetImageSize(originalImagePath, dateModified).ConfigureAwait(false);
|
||||||
@ -276,7 +285,7 @@ namespace MediaBrowser.Controller.Drawing
|
|||||||
// Cache file doesn't exist no biggie
|
// Cache file doesn't exist no biggie
|
||||||
}
|
}
|
||||||
|
|
||||||
var size = ImageHeader.GetDimensions(imagePath, Logger);
|
var size = ImageHeader.GetDimensions(imagePath, _logger);
|
||||||
|
|
||||||
var imageSize = new ImageSize { Width = size.Width, Height = size.Height };
|
var imageSize = new ImageSize { Width = size.Width, Height = size.Height };
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -21,14 +22,21 @@ namespace MediaBrowser.Controller.IO
|
|||||||
/// <value>The directory watchers.</value>
|
/// <value>The directory watchers.</value>
|
||||||
private DirectoryWatchers DirectoryWatchers { get; set; }
|
private DirectoryWatchers DirectoryWatchers { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The _logger
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="FileSystemManager" /> class.
|
/// Initializes a new instance of the <see cref="FileSystemManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
public FileSystemManager(Kernel kernel)
|
/// <param name="logger">The logger.</param>
|
||||||
|
public FileSystemManager(Kernel kernel, ILogger logger)
|
||||||
: base(kernel)
|
: base(kernel)
|
||||||
{
|
{
|
||||||
DirectoryWatchers = new DirectoryWatchers(Logger);
|
_logger = logger;
|
||||||
|
DirectoryWatchers = new DirectoryWatchers(logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -364,13 +364,13 @@ namespace MediaBrowser.Controller
|
|||||||
RootFolder = null;
|
RootFolder = null;
|
||||||
|
|
||||||
ReloadResourcePools();
|
ReloadResourcePools();
|
||||||
InstallationManager = new InstallationManager(this, ZipClient);
|
InstallationManager = new InstallationManager(this, ZipClient, Logger);
|
||||||
LibraryManager = new LibraryManager(this);
|
LibraryManager = new LibraryManager(this, Logger);
|
||||||
UserManager = new UserManager(this);
|
UserManager = new UserManager(this, Logger);
|
||||||
FFMpegManager = new FFMpegManager(this, ZipClient);
|
FFMpegManager = new FFMpegManager(this, ZipClient, Logger);
|
||||||
ImageManager = new ImageManager(this);
|
ImageManager = new ImageManager(this, Logger);
|
||||||
ProviderManager = new ProviderManager(this);
|
ProviderManager = new ProviderManager(this, Logger);
|
||||||
UserDataManager = new UserDataManager(this);
|
UserDataManager = new UserDataManager(this, Logger);
|
||||||
PluginSecurityManager = new PluginSecurityManager(this);
|
PluginSecurityManager = new PluginSecurityManager(this);
|
||||||
|
|
||||||
await base.ReloadInternal().ConfigureAwait(false);
|
await base.ReloadInternal().ConfigureAwait(false);
|
||||||
@ -489,7 +489,7 @@ namespace MediaBrowser.Controller
|
|||||||
{
|
{
|
||||||
DisposeFileSystemManager();
|
DisposeFileSystemManager();
|
||||||
|
|
||||||
FileSystemManager = new FileSystemManager(this);
|
FileSystemManager = new FileSystemManager(this, Logger);
|
||||||
FileSystemManager.StartWatchers();
|
FileSystemManager.StartWatchers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ using MediaBrowser.Controller.Entities;
|
|||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Controller.Resolvers;
|
using MediaBrowser.Controller.Resolvers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using MoreLinq;
|
using MoreLinq;
|
||||||
using System;
|
using System;
|
||||||
@ -38,7 +39,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// <param name="args">The <see cref="ChildrenChangedEventArgs" /> instance containing the event data.</param>
|
/// <param name="args">The <see cref="ChildrenChangedEventArgs" /> instance containing the event data.</param>
|
||||||
internal void OnLibraryChanged(ChildrenChangedEventArgs args)
|
internal void OnLibraryChanged(ChildrenChangedEventArgs args)
|
||||||
{
|
{
|
||||||
EventHelper.QueueEventIfNotNull(LibraryChanged, this, args, Logger);
|
EventHelper.QueueEventIfNotNull(LibraryChanged, this, args, _logger);
|
||||||
|
|
||||||
// Had to put this in a separate method to avoid an implicitly captured closure
|
// Had to put this in a separate method to avoid an implicitly captured closure
|
||||||
SendLibraryChangedWebSocketMessage(args);
|
SendLibraryChangedWebSocketMessage(args);
|
||||||
@ -55,13 +56,20 @@ namespace MediaBrowser.Controller.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The _logger
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="LibraryManager" /> class.
|
/// Initializes a new instance of the <see cref="LibraryManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
public LibraryManager(Kernel kernel)
|
/// <param name="logger">The logger.</param>
|
||||||
|
public LibraryManager(Kernel kernel, ILogger logger)
|
||||||
: base(kernel)
|
: base(kernel)
|
||||||
{
|
{
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -115,7 +123,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
// When resolving the root, we need it's grandchildren (children of user views)
|
// When resolving the root, we need it's grandchildren (children of user views)
|
||||||
var flattenFolderDepth = args.IsPhysicalRoot ? 2 : 0;
|
var flattenFolderDepth = args.IsPhysicalRoot ? 2 : 0;
|
||||||
|
|
||||||
args.FileSystemDictionary = FileData.GetFilteredFileSystemEntries(args.Path, Logger, flattenFolderDepth: flattenFolderDepth, args: args);
|
args.FileSystemDictionary = FileData.GetFilteredFileSystemEntries(args.Path, _logger, flattenFolderDepth: flattenFolderDepth, args: args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if we should resolve based on our contents
|
// Check to see if we should resolve based on our contents
|
||||||
@ -155,7 +163,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error resolving path {0}", ex, f.Path);
|
_logger.ErrorException("Error resolving path {0}", ex, f.Path);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -303,7 +311,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
Logger.Debug("Creating {0}: {1}", typeof(T).Name, name);
|
_logger.Debug("Creating {0}: {1}", typeof(T).Name, name);
|
||||||
|
|
||||||
path = Path.Combine(path, FileSystem.GetValidFilename(name));
|
path = Path.Combine(path, FileSystem.GetValidFilename(name));
|
||||||
|
|
||||||
@ -404,7 +412,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error validating IBN entry {0}", ex, currentPerson.Name);
|
_logger.ErrorException("Error validating IBN entry {0}", ex, currentPerson.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update progress
|
// Update progress
|
||||||
@ -423,7 +431,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
|
|
||||||
progress.Report(new TaskProgress { PercentComplete = 100 });
|
progress.Report(new TaskProgress { PercentComplete = 100 });
|
||||||
|
|
||||||
Logger.Info("People validation complete");
|
_logger.Info("People validation complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -434,7 +442,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
internal async Task ValidateMediaLibrary(IProgress<TaskProgress> progress, CancellationToken cancellationToken)
|
internal async Task ValidateMediaLibrary(IProgress<TaskProgress> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Logger.Info("Validating media library");
|
_logger.Info("Validating media library");
|
||||||
|
|
||||||
await Kernel.RootFolder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
await Kernel.RootFolder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.Connectivity;
|
using MediaBrowser.Model.Connectivity;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -28,14 +29,20 @@ namespace MediaBrowser.Controller.Library
|
|||||||
public event EventHandler<PlaybackProgressEventArgs> PlaybackStopped;
|
public event EventHandler<PlaybackProgressEventArgs> PlaybackStopped;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The _logger
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="UserDataManager" /> class.
|
/// Initializes a new instance of the <see cref="UserDataManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
public UserDataManager(Kernel kernel)
|
/// <param name="logger">The logger.</param>
|
||||||
|
public UserDataManager(Kernel kernel, ILogger logger)
|
||||||
: base(kernel)
|
: base(kernel)
|
||||||
{
|
{
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -65,7 +72,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
{
|
{
|
||||||
Argument = item,
|
Argument = item,
|
||||||
User = user
|
User = user
|
||||||
}, Logger);
|
}, _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -104,7 +111,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
Argument = item,
|
Argument = item,
|
||||||
User = user,
|
User = user,
|
||||||
PlaybackPositionTicks = positionTicks
|
PlaybackPositionTicks = positionTicks
|
||||||
}, Logger);
|
}, _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -150,7 +157,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
Argument = item,
|
Argument = item,
|
||||||
User = user,
|
User = user,
|
||||||
PlaybackPositionTicks = positionTicks
|
PlaybackPositionTicks = positionTicks
|
||||||
}, Logger);
|
}, _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -9,6 +9,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Library
|
namespace MediaBrowser.Controller.Library
|
||||||
{
|
{
|
||||||
@ -41,13 +42,20 @@ namespace MediaBrowser.Controller.Library
|
|||||||
get { return AllConnections.Where(c => (DateTime.UtcNow - c.LastActivityDate).TotalMinutes <= 10); }
|
get { return AllConnections.Where(c => (DateTime.UtcNow - c.LastActivityDate).TotalMinutes <= 10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The _logger
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="UserManager" /> class.
|
/// Initializes a new instance of the <see cref="UserManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
public UserManager(Kernel kernel)
|
/// <param name="logger">The logger.</param>
|
||||||
|
public UserManager(Kernel kernel, ILogger logger)
|
||||||
: base(kernel)
|
: base(kernel)
|
||||||
{
|
{
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region UserUpdated Event
|
#region UserUpdated Event
|
||||||
@ -62,7 +70,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
internal void OnUserUpdated(User user)
|
internal void OnUserUpdated(User user)
|
||||||
{
|
{
|
||||||
EventHelper.QueueEventIfNotNull(UserUpdated, this, new GenericEventArgs<User> { Argument = user }, Logger);
|
EventHelper.QueueEventIfNotNull(UserUpdated, this, new GenericEventArgs<User> { Argument = user }, _logger);
|
||||||
|
|
||||||
// Notify connected ui's
|
// Notify connected ui's
|
||||||
Kernel.TcpManager.SendWebSocketMessage("UserUpdated", DtoBuilder.GetDtoUser(user));
|
Kernel.TcpManager.SendWebSocketMessage("UserUpdated", DtoBuilder.GetDtoUser(user));
|
||||||
@ -80,7 +88,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
internal void OnUserDeleted(User user)
|
internal void OnUserDeleted(User user)
|
||||||
{
|
{
|
||||||
EventHelper.QueueEventIfNotNull(UserDeleted, this, new GenericEventArgs<User> { Argument = user }, Logger);
|
EventHelper.QueueEventIfNotNull(UserDeleted, this, new GenericEventArgs<User> { Argument = user }, _logger);
|
||||||
|
|
||||||
// Notify connected ui's
|
// Notify connected ui's
|
||||||
Kernel.TcpManager.SendWebSocketMessage("UserDeleted", user.Id.ToString());
|
Kernel.TcpManager.SendWebSocketMessage("UserDeleted", user.Id.ToString());
|
||||||
@ -113,7 +121,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
await UpdateUser(user).ConfigureAwait(false);
|
await UpdateUser(user).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info("Authentication request for {0} {1}.", user.Name, (success ? "has succeeded" : "has been denied"));
|
_logger.Info("Authentication request for {0} {1}.", user.Name, (success ? "has succeeded" : "has been denied"));
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ using System.Reflection;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.MediaInfo
|
namespace MediaBrowser.Controller.MediaInfo
|
||||||
{
|
{
|
||||||
@ -65,13 +66,19 @@ namespace MediaBrowser.Controller.MediaInfo
|
|||||||
/// <value>The zip client.</value>
|
/// <value>The zip client.</value>
|
||||||
private IZipClient ZipClient { get; set; }
|
private IZipClient ZipClient { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The _logger
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="FFMpegManager" /> class.
|
/// Initializes a new instance of the <see cref="FFMpegManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
/// <param name="zipClient">The zip client.</param>
|
/// <param name="zipClient">The zip client.</param>
|
||||||
|
/// <param name="logger">The logger.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">zipClient</exception>
|
/// <exception cref="System.ArgumentNullException">zipClient</exception>
|
||||||
public FFMpegManager(Kernel kernel, IZipClient zipClient)
|
public FFMpegManager(Kernel kernel, IZipClient zipClient, ILogger logger)
|
||||||
: base(kernel)
|
: base(kernel)
|
||||||
{
|
{
|
||||||
if (zipClient == null)
|
if (zipClient == null)
|
||||||
@ -79,6 +86,7 @@ namespace MediaBrowser.Controller.MediaInfo
|
|||||||
throw new ArgumentNullException("zipClient");
|
throw new ArgumentNullException("zipClient");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_logger = logger;
|
||||||
ZipClient = zipClient;
|
ZipClient = zipClient;
|
||||||
|
|
||||||
// Not crazy about this but it's the only way to suppress ffmpeg crash dialog boxes
|
// Not crazy about this but it's the only way to suppress ffmpeg crash dialog boxes
|
||||||
@ -150,7 +158,7 @@ namespace MediaBrowser.Controller.MediaInfo
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error creating chapter images for {0}", ex, video.Name);
|
_logger.ErrorException("Error creating chapter images for {0}", ex, video.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -483,7 +491,7 @@ namespace MediaBrowser.Controller.MediaInfo
|
|||||||
EnableRaisingEvents = true
|
EnableRaisingEvents = true
|
||||||
};
|
};
|
||||||
|
|
||||||
Logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
_logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||||
|
|
||||||
process.Exited += ProcessExited;
|
process.Exited += ProcessExited;
|
||||||
|
|
||||||
@ -524,11 +532,11 @@ namespace MediaBrowser.Controller.MediaInfo
|
|||||||
}
|
}
|
||||||
catch (InvalidOperationException ex1)
|
catch (InvalidOperationException ex1)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error killing ffprobe", ex1);
|
_logger.ErrorException("Error killing ffprobe", ex1);
|
||||||
}
|
}
|
||||||
catch (Win32Exception ex1)
|
catch (Win32Exception ex1)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error killing ffprobe", ex1);
|
_logger.ErrorException("Error killing ffprobe", ex1);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
@ -727,7 +735,7 @@ namespace MediaBrowser.Controller.MediaInfo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Error("ffmpeg audio image extraction failed for {0}", input.Path);
|
_logger.Error("ffmpeg audio image extraction failed for {0}", input.Path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -789,7 +797,7 @@ namespace MediaBrowser.Controller.MediaInfo
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
_logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||||
|
|
||||||
await AudioImageResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await AudioImageResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
@ -806,7 +814,7 @@ namespace MediaBrowser.Controller.MediaInfo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Error("ffmpeg subtitle extraction failed for {0}", input.Path);
|
_logger.Error("ffmpeg subtitle extraction failed for {0}", input.Path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,7 +852,7 @@ namespace MediaBrowser.Controller.MediaInfo
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
_logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||||
|
|
||||||
await AudioImageResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await AudioImageResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
@ -861,7 +869,7 @@ namespace MediaBrowser.Controller.MediaInfo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Error("ffmpeg subtitle conversion failed for {0}", mediaStream.Path);
|
_logger.Error("ffmpeg subtitle conversion failed for {0}", mediaStream.Path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -909,22 +917,22 @@ namespace MediaBrowser.Controller.MediaInfo
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Logger.Info("Killing ffmpeg process");
|
_logger.Info("Killing ffmpeg process");
|
||||||
|
|
||||||
process.Kill();
|
process.Kill();
|
||||||
process.WaitForExit(1000);
|
process.WaitForExit(1000);
|
||||||
}
|
}
|
||||||
catch (Win32Exception ex)
|
catch (Win32Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error killing process", ex);
|
_logger.ErrorException("Error killing process", ex);
|
||||||
}
|
}
|
||||||
catch (InvalidOperationException ex)
|
catch (InvalidOperationException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error killing process", ex);
|
_logger.ErrorException("Error killing process", ex);
|
||||||
}
|
}
|
||||||
catch (NotSupportedException ex)
|
catch (NotSupportedException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error killing process", ex);
|
_logger.ErrorException("Error killing process", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -940,12 +948,12 @@ namespace MediaBrowser.Controller.MediaInfo
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Logger.Info("Deleting extracted image due to failure: ", outputPath);
|
_logger.Info("Deleting extracted image due to failure: ", outputPath);
|
||||||
File.Delete(outputPath);
|
File.Delete(outputPath);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error deleting extracted image {0}", ex, outputPath);
|
_logger.ErrorException("Error deleting extracted image {0}", ex, outputPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -957,7 +965,7 @@ namespace MediaBrowser.Controller.MediaInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Error("ffmpeg video image extraction failed for {0}", inputPath);
|
_logger.Error("ffmpeg video image extraction failed for {0}", inputPath);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -29,13 +29,20 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
private readonly ConcurrentDictionary<string, Tuple<BaseMetadataProvider, BaseItem, CancellationTokenSource>> _currentlyRunningProviders =
|
private readonly ConcurrentDictionary<string, Tuple<BaseMetadataProvider, BaseItem, CancellationTokenSource>> _currentlyRunningProviders =
|
||||||
new ConcurrentDictionary<string, Tuple<BaseMetadataProvider, BaseItem, CancellationTokenSource>>();
|
new ConcurrentDictionary<string, Tuple<BaseMetadataProvider, BaseItem, CancellationTokenSource>>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The _logger
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ProviderManager" /> class.
|
/// Initializes a new instance of the <see cref="ProviderManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
public ProviderManager(Kernel kernel)
|
/// <param name="logger">The logger.</param>
|
||||||
|
public ProviderManager(Kernel kernel, ILogger logger)
|
||||||
: base(kernel)
|
: base(kernel)
|
||||||
{
|
{
|
||||||
|
_logger = logger;
|
||||||
_remoteImageCache = new FileSystemRepository(ImagesDataPath);
|
_remoteImageCache = new FileSystemRepository(ImagesDataPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +125,7 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
// If providers have changed, clear provider info and update the supported providers hash
|
// If providers have changed, clear provider info and update the supported providers hash
|
||||||
if (providersChanged)
|
if (providersChanged)
|
||||||
{
|
{
|
||||||
Logger.Debug("Providers changed for {0}. Clearing and forcing refresh.", item.Name);
|
_logger.Debug("Providers changed for {0}. Clearing and forcing refresh.", item.Name);
|
||||||
item.ProviderData.Clear();
|
item.ProviderData.Clear();
|
||||||
supportedProvidersInfo.FileSystemStamp = supportedProvidersHash;
|
supportedProvidersInfo.FileSystemStamp = supportedProvidersHash;
|
||||||
}
|
}
|
||||||
@ -233,7 +240,7 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal void ValidateCurrentlyRunningProviders()
|
internal void ValidateCurrentlyRunningProviders()
|
||||||
{
|
{
|
||||||
Logger.Info("Validing currently running providers");
|
_logger.Info("Validing currently running providers");
|
||||||
|
|
||||||
var enableInternetProviders = Kernel.Configuration.EnableInternetProviders;
|
var enableInternetProviders = Kernel.Configuration.EnableInternetProviders;
|
||||||
var internetProviderExcludeTypes = Kernel.Configuration.InternetProviderExcludeTypes;
|
var internetProviderExcludeTypes = Kernel.Configuration.InternetProviderExcludeTypes;
|
||||||
@ -303,7 +310,7 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error downloading and saving image " + localPath, e);
|
_logger.ErrorException("Error downloading and saving image " + localPath, e);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -6,6 +6,7 @@ using MediaBrowser.Common.Plugins;
|
|||||||
using MediaBrowser.Common.Progress;
|
using MediaBrowser.Common.Progress;
|
||||||
using MediaBrowser.Common.Serialization;
|
using MediaBrowser.Common.Serialization;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Updates;
|
using MediaBrowser.Model.Updates;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
@ -45,7 +46,7 @@ namespace MediaBrowser.Controller.Updates
|
|||||||
/// <param name="plugin">The plugin.</param>
|
/// <param name="plugin">The plugin.</param>
|
||||||
private void OnPluginUninstalled(IPlugin plugin)
|
private void OnPluginUninstalled(IPlugin plugin)
|
||||||
{
|
{
|
||||||
EventHelper.QueueEventIfNotNull(PluginUninstalled, this, new GenericEventArgs<IPlugin> { Argument = plugin }, Logger);
|
EventHelper.QueueEventIfNotNull(PluginUninstalled, this, new GenericEventArgs<IPlugin> { Argument = plugin }, _logger);
|
||||||
|
|
||||||
// Notify connected ui's
|
// Notify connected ui's
|
||||||
Kernel.TcpManager.SendWebSocketMessage("PluginUninstalled", plugin.GetPluginInfo());
|
Kernel.TcpManager.SendWebSocketMessage("PluginUninstalled", plugin.GetPluginInfo());
|
||||||
@ -64,9 +65,9 @@ namespace MediaBrowser.Controller.Updates
|
|||||||
/// <param name="newVersion">The new version.</param>
|
/// <param name="newVersion">The new version.</param>
|
||||||
public void OnPluginUpdated(IPlugin plugin, PackageVersionInfo newVersion)
|
public void OnPluginUpdated(IPlugin plugin, PackageVersionInfo newVersion)
|
||||||
{
|
{
|
||||||
Logger.Info("Plugin updated: {0} {1} {2}", newVersion.name, newVersion.version, newVersion.classification);
|
_logger.Info("Plugin updated: {0} {1} {2}", newVersion.name, newVersion.version, newVersion.classification);
|
||||||
|
|
||||||
EventHelper.QueueEventIfNotNull(PluginUpdated, this, new GenericEventArgs<Tuple<IPlugin, PackageVersionInfo>> { Argument = new Tuple<IPlugin, PackageVersionInfo>(plugin, newVersion) }, Logger);
|
EventHelper.QueueEventIfNotNull(PluginUpdated, this, new GenericEventArgs<Tuple<IPlugin, PackageVersionInfo>> { Argument = new Tuple<IPlugin, PackageVersionInfo>(plugin, newVersion) }, _logger);
|
||||||
|
|
||||||
Kernel.NotifyPendingRestart();
|
Kernel.NotifyPendingRestart();
|
||||||
}
|
}
|
||||||
@ -83,9 +84,9 @@ namespace MediaBrowser.Controller.Updates
|
|||||||
/// <param name="package">The package.</param>
|
/// <param name="package">The package.</param>
|
||||||
public void OnPluginInstalled(PackageVersionInfo package)
|
public void OnPluginInstalled(PackageVersionInfo package)
|
||||||
{
|
{
|
||||||
Logger.Info("New plugin installed: {0} {1} {2}", package.name, package.version, package.classification);
|
_logger.Info("New plugin installed: {0} {1} {2}", package.name, package.version, package.classification);
|
||||||
|
|
||||||
EventHelper.QueueEventIfNotNull(PluginInstalled, this, new GenericEventArgs<PackageVersionInfo> { Argument = package }, Logger);
|
EventHelper.QueueEventIfNotNull(PluginInstalled, this, new GenericEventArgs<PackageVersionInfo> { Argument = package }, _logger);
|
||||||
|
|
||||||
Kernel.NotifyPendingRestart();
|
Kernel.NotifyPendingRestart();
|
||||||
}
|
}
|
||||||
@ -97,13 +98,19 @@ namespace MediaBrowser.Controller.Updates
|
|||||||
/// <value>The zip client.</value>
|
/// <value>The zip client.</value>
|
||||||
private IZipClient ZipClient { get; set; }
|
private IZipClient ZipClient { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The _logger
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="InstallationManager" /> class.
|
/// Initializes a new instance of the <see cref="InstallationManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
/// <param name="zipClient">The zip client.</param>
|
/// <param name="zipClient">The zip client.</param>
|
||||||
|
/// <param name="logger">The logger.</param>
|
||||||
/// <exception cref="System.ArgumentNullException">zipClient</exception>
|
/// <exception cref="System.ArgumentNullException">zipClient</exception>
|
||||||
public InstallationManager(Kernel kernel, IZipClient zipClient)
|
public InstallationManager(Kernel kernel, IZipClient zipClient, ILogger logger)
|
||||||
: base(kernel)
|
: base(kernel)
|
||||||
{
|
{
|
||||||
if (zipClient == null)
|
if (zipClient == null)
|
||||||
@ -111,6 +118,7 @@ namespace MediaBrowser.Controller.Updates
|
|||||||
throw new ArgumentNullException("zipClient");
|
throw new ArgumentNullException("zipClient");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_logger = logger;
|
||||||
ZipClient = zipClient;
|
ZipClient = zipClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +346,7 @@ namespace MediaBrowser.Controller.Updates
|
|||||||
CurrentInstallations.Remove(tuple);
|
CurrentInstallations.Remove(tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info("Package installation cancelled: {0} {1}", package.name, package.versionStr);
|
_logger.Info("Package installation cancelled: {0} {1}", package.name, package.versionStr);
|
||||||
|
|
||||||
Kernel.TcpManager.SendWebSocketMessage("PackageInstallationCancelled", installationInfo);
|
Kernel.TcpManager.SendWebSocketMessage("PackageInstallationCancelled", installationInfo);
|
||||||
|
|
||||||
@ -408,7 +416,7 @@ namespace MediaBrowser.Controller.Updates
|
|||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error attempting to extract archive from {0} to {1}", e, tempFile, target);
|
_logger.ErrorException("Error attempting to extract archive from {0} to {1}", e, tempFile, target);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +430,7 @@ namespace MediaBrowser.Controller.Updates
|
|||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error attempting to move file from {0} to {1}", e, tempFile, target);
|
_logger.ErrorException("Error attempting to move file from {0} to {1}", e, tempFile, target);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ namespace MediaBrowser.UI.Controller
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
protected override Task ReloadInternal()
|
protected override Task ReloadInternal()
|
||||||
{
|
{
|
||||||
PlaybackManager = new PlaybackManager(this);
|
PlaybackManager = new PlaybackManager(this, Logger);
|
||||||
|
|
||||||
return base.ReloadInternal();
|
return base.ReloadInternal();
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using MediaBrowser.Common.Extensions;
|
|||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using MediaBrowser.UI.Configuration;
|
using MediaBrowser.UI.Configuration;
|
||||||
using MediaBrowser.UI.Controller;
|
using MediaBrowser.UI.Controller;
|
||||||
@ -20,14 +21,16 @@ namespace MediaBrowser.UI.Playback
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PlaybackManager : BaseManager<UIKernel>
|
public class PlaybackManager : BaseManager<UIKernel>
|
||||||
{
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="PlaybackManager" /> class.
|
/// Initializes a new instance of the <see cref="PlaybackManager" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kernel">The kernel.</param>
|
/// <param name="kernel">The kernel.</param>
|
||||||
public PlaybackManager(UIKernel kernel)
|
public PlaybackManager(UIKernel kernel, ILogger logger)
|
||||||
: base(kernel)
|
: base(kernel)
|
||||||
{
|
{
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region PlaybackStarted Event
|
#region PlaybackStarted Event
|
||||||
@ -49,7 +52,7 @@ namespace MediaBrowser.UI.Playback
|
|||||||
Options = options,
|
Options = options,
|
||||||
Player = player,
|
Player = player,
|
||||||
PlayerConfiguration = playerConfiguration
|
PlayerConfiguration = playerConfiguration
|
||||||
}, Logger);
|
}, _logger);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -70,7 +73,7 @@ namespace MediaBrowser.UI.Playback
|
|||||||
{
|
{
|
||||||
Items = items,
|
Items = items,
|
||||||
Player = player
|
Player = player
|
||||||
}, Logger);
|
}, _logger);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -154,7 +157,7 @@ namespace MediaBrowser.UI.Playback
|
|||||||
}
|
}
|
||||||
catch (HttpException ex)
|
catch (HttpException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error retrieving intros", ex);
|
_logger.ErrorException("Error retrieving intros", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user