removed static logger
This commit is contained in:
parent
4019b9260b
commit
ab1065a567
|
@ -6,6 +6,7 @@ using System.ComponentModel.Composition;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Common.Api.Logging
|
||||
{
|
||||
|
@ -24,6 +25,17 @@ namespace MediaBrowser.Common.Api.Logging
|
|||
get { return "LogFile"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LogFileWebSocketListener" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
[ImportingConstructor]
|
||||
public LogFileWebSocketListener([Import("logger")] ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the specified kernel.
|
||||
/// </summary>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
|
@ -22,7 +23,18 @@ namespace MediaBrowser.Common.Api.ScheduledTasks
|
|||
{
|
||||
get { return "ScheduledTasksInfo"; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ScheduledTasksWebSocketListener" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
[ImportingConstructor]
|
||||
public ScheduledTasksWebSocketListener([Import("logger")] ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the data to send.
|
||||
/// </summary>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -19,6 +20,17 @@ namespace MediaBrowser.Common.Api
|
|||
get { return "SystemInfo"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SystemInfoWebSocketListener" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
[ImportingConstructor]
|
||||
public SystemInfoWebSocketListener([Import("logger")] ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the data to send.
|
||||
/// </summary>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using MediaBrowser.Common.Logging;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -9,6 +10,11 @@ namespace MediaBrowser.Common.Events
|
|||
/// </summary>
|
||||
public static class EventHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
private static readonly ILogger Logger = LogManager.GetLogger("EventHelper");
|
||||
|
||||
/// <summary>
|
||||
/// Fires the event.
|
||||
/// </summary>
|
||||
|
@ -27,7 +33,7 @@ namespace MediaBrowser.Common.Events
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogException("Error in event handler", ex);
|
||||
Logger.ErrorException("Error in event handler", ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -52,7 +58,7 @@ namespace MediaBrowser.Common.Events
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogException("Error in event handler", ex);
|
||||
Logger.ErrorException("Error in event handler", ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -74,7 +80,7 @@ namespace MediaBrowser.Common.Events
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogException("Error in event handler", ex);
|
||||
Logger.ErrorException("Error in event handler", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +102,7 @@ namespace MediaBrowser.Common.Events
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogException("Error in event handler", ex);
|
||||
Logger.ErrorException("Error in event handler", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,8 +38,6 @@ namespace MediaBrowser.Common.IO
|
|||
{
|
||||
if (!path.EndsWith("*", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Logger.LogInfo("Handle came back invalid for {0}. This might be a network share. Since this is a directory we'll try appending " + Path.DirectorySeparatorChar + "*.", path);
|
||||
|
||||
NativeMethods.FindClose(handle);
|
||||
|
||||
handle = NativeMethods.FindFirstFileEx(Path.Combine(path, "*"), FINDEX_INFO_LEVELS.FindExInfoBasic, out data,
|
||||
|
|
|
@ -143,7 +143,7 @@ namespace MediaBrowser.Common.Kernel
|
|||
get
|
||||
{
|
||||
// Lazy load
|
||||
LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationLoaded, ref _configurationSyncLock, () => XmlSerializer.GetXmlConfiguration<TConfigurationType>(ApplicationPaths.SystemConfigurationFilePath));
|
||||
LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationLoaded, ref _configurationSyncLock, () => XmlSerializer.GetXmlConfiguration<TConfigurationType>(ApplicationPaths.SystemConfigurationFilePath, Logger));
|
||||
return _configuration;
|
||||
}
|
||||
protected set
|
||||
|
@ -441,8 +441,6 @@ namespace MediaBrowser.Common.Kernel
|
|||
|
||||
AddLogTarget(logFile, "ApplicationLogFile");
|
||||
|
||||
Logging.Logger.LoggerInstance = Logging.LogManager.GetLogger("App");
|
||||
|
||||
OnLoggerLoaded();
|
||||
}
|
||||
|
||||
|
@ -590,7 +588,7 @@ namespace MediaBrowser.Common.Kernel
|
|||
|
||||
try
|
||||
{
|
||||
plugin.Initialize(this);
|
||||
plugin.Initialize(this, Logging.LogManager.GetLogger(plugin.GetType().Name));
|
||||
|
||||
Logger.Info("{0} {1} initialized.", plugin.Name, plugin.Version);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||
using System.Net.WebSockets;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Common.Kernel
|
||||
{
|
||||
|
@ -38,6 +39,25 @@ namespace MediaBrowser.Common.Kernel
|
|||
/// <returns>Task{`1}.</returns>
|
||||
protected abstract Task<TReturnDataType> GetDataToSend(TStateType state);
|
||||
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
protected ILogger Logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BasePeriodicWebSocketListener{TStateType}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
protected BasePeriodicWebSocketListener(ILogger logger)
|
||||
{
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException("logger");
|
||||
}
|
||||
|
||||
Logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the message internal.
|
||||
/// </summary>
|
||||
|
@ -71,7 +91,7 @@ namespace MediaBrowser.Common.Kernel
|
|||
|
||||
var cancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
Logger.LogInfo("{1} Begin transmitting over websocket to {0}", message.Connection.RemoteEndPoint, GetType().Name);
|
||||
Logger.Info("{1} Begin transmitting over websocket to {0}", message.Connection.RemoteEndPoint, GetType().Name);
|
||||
|
||||
var timer = new Timer(TimerCallback, message.Connection, Timeout.Infinite, Timeout.Infinite);
|
||||
|
||||
|
@ -135,7 +155,7 @@ namespace MediaBrowser.Common.Kernel
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogException("Error sending web socket message {0}", ex, Name);
|
||||
Logger.ErrorException("Error sending web socket message {0}", ex, Name);
|
||||
DisposeConnection(tuple);
|
||||
}
|
||||
finally
|
||||
|
@ -167,7 +187,7 @@ namespace MediaBrowser.Common.Kernel
|
|||
/// <param name="connection">The connection.</param>
|
||||
private void DisposeConnection(Tuple<WebSocketConnection, CancellationTokenSource, Timer, TStateType, SemaphoreSlim> connection)
|
||||
{
|
||||
Logger.LogInfo("{1} stop transmitting over websocket to {0}", connection.Item1.RemoteEndPoint, GetType().Name);
|
||||
Logger.Info("{1} stop transmitting over websocket to {0}", connection.Item1.RemoteEndPoint, GetType().Name);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Common.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Class Logger
|
||||
/// </summary>
|
||||
public static class Logger
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the logger instance.
|
||||
/// </summary>
|
||||
/// <value>The logger instance.</value>
|
||||
internal static ILogger LoggerInstance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Logs the info.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="paramList">The param list.</param>
|
||||
public static void LogInfo(string message, params object[] paramList)
|
||||
{
|
||||
LogEntry(message, LogSeverity.Info, null, paramList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs the debug info.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="paramList">The param list.</param>
|
||||
public static void LogDebugInfo(string message, params object[] paramList)
|
||||
{
|
||||
LogEntry(message, LogSeverity.Debug, null, paramList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs the exception.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="ex">The ex.</param>
|
||||
/// <param name="paramList">The param list.</param>
|
||||
public static void LogException(string message, Exception ex, params object[] paramList)
|
||||
{
|
||||
LogEntry(message, LogSeverity.Error, ex, paramList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs the warning.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="paramList">The param list.</param>
|
||||
public static void LogWarning(string message, params object[] paramList)
|
||||
{
|
||||
LogEntry(message, LogSeverity.Warn, null, paramList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs the entry.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="level">The level.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
/// <param name="paramList">The param list.</param>
|
||||
private static void LogEntry(string message, LogSeverity level, Exception exception, params object[] paramList)
|
||||
{
|
||||
if (LoggerInstance == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (exception == null)
|
||||
{
|
||||
LoggerInstance.Log(level, message, paramList);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (level == LogSeverity.Fatal)
|
||||
{
|
||||
LoggerInstance.FatalException(message, exception, paramList);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoggerInstance.ErrorException(message, exception, paramList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -187,7 +187,6 @@
|
|||
<Compile Include="Serialization\JsonSerializer.cs" />
|
||||
<Compile Include="Kernel\BaseKernel.cs" />
|
||||
<Compile Include="Kernel\KernelContext.cs" />
|
||||
<Compile Include="Logging\Logger.cs" />
|
||||
<Compile Include="Net\Handlers\BaseHandler.cs" />
|
||||
<Compile Include="Net\Handlers\BaseSerializationHandler.cs" />
|
||||
<Compile Include="Net\HttpServer.cs" />
|
||||
|
|
|
@ -189,7 +189,7 @@ namespace MediaBrowser.Common.Plugins
|
|||
get
|
||||
{
|
||||
// Lazy load
|
||||
LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationInitialized, ref _configurationSyncLock, () => XmlSerializer.GetXmlConfiguration(ConfigurationType, ConfigurationFilePath) as TConfigurationType);
|
||||
LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationInitialized, ref _configurationSyncLock, () => XmlSerializer.GetXmlConfiguration(ConfigurationType, ConfigurationFilePath, Logger) as TConfigurationType);
|
||||
return _configuration;
|
||||
}
|
||||
protected set
|
||||
|
@ -274,15 +274,21 @@ namespace MediaBrowser.Common.Plugins
|
|||
/// Starts the plugin.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <exception cref="System.ArgumentNullException">kernel</exception>
|
||||
public void Initialize(IKernel kernel)
|
||||
public void Initialize(IKernel kernel, ILogger logger)
|
||||
{
|
||||
if (kernel == null)
|
||||
{
|
||||
throw new ArgumentNullException("kernel");
|
||||
}
|
||||
|
||||
Logger = LogManager.GetLogger(Name);
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException("logger");
|
||||
}
|
||||
|
||||
Logger = logger;
|
||||
|
||||
Kernel = kernel;
|
||||
|
||||
|
|
|
@ -107,8 +107,9 @@ namespace MediaBrowser.Common.Plugins
|
|||
/// Starts the plugin.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <exception cref="System.ArgumentNullException">kernel</exception>
|
||||
void Initialize(IKernel kernel);
|
||||
void Initialize(IKernel kernel, ILogger logger);
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the plugins. Undos all actions performed during Init.
|
||||
|
|
|
@ -3,6 +3,7 @@ using System;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Common.Serialization
|
||||
{
|
||||
|
@ -157,10 +158,11 @@ namespace MediaBrowser.Common.Serialization
|
|||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public static object GetXmlConfiguration(Type type, string path)
|
||||
public static object GetXmlConfiguration(Type type, string path, ILogger logger)
|
||||
{
|
||||
Logger.LogInfo("Loading {0} at {1}", type.Name, path);
|
||||
logger.Info("Loading {0} at {1}", type.Name, path);
|
||||
|
||||
object configuration;
|
||||
|
||||
|
@ -184,7 +186,7 @@ namespace MediaBrowser.Common.Serialization
|
|||
// If the file didn't exist before, or if something has changed, re-save
|
||||
if (buffer == null || !buffer.SequenceEqual(newBytes))
|
||||
{
|
||||
Logger.LogInfo("Saving {0} to {1}", type.Name, path);
|
||||
logger.Info("Saving {0} to {1}", type.Name, path);
|
||||
|
||||
// Save it after load in case we got new items
|
||||
File.WriteAllBytes(path, newBytes);
|
||||
|
@ -200,11 +202,12 @@ namespace MediaBrowser.Common.Serialization
|
|||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <returns>``0.</returns>
|
||||
public static T GetXmlConfiguration<T>(string path)
|
||||
public static T GetXmlConfiguration<T>(string path, ILogger logger)
|
||||
where T : class
|
||||
{
|
||||
return GetXmlConfiguration(typeof(T), path) as T;
|
||||
return GetXmlConfiguration(typeof(T), path, logger) as T;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Controller.Drawing
|
||||
{
|
||||
|
@ -36,9 +37,10 @@ namespace MediaBrowser.Controller.Drawing
|
|||
/// Gets the dimensions of an image.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the image to get the dimensions of.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <returns>The dimensions of the specified image.</returns>
|
||||
/// <exception cref="ArgumentException">The image was of an unrecognised format.</exception>
|
||||
public static Size GetDimensions(string path)
|
||||
public static Size GetDimensions(string path, ILogger logger)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -52,7 +54,7 @@ namespace MediaBrowser.Controller.Drawing
|
|||
}
|
||||
catch
|
||||
{
|
||||
Logger.LogInfo("Failed to read image header for {0}. Doing it the slow way.", path);
|
||||
logger.Info("Failed to read image header for {0}. Doing it the slow way.", path);
|
||||
|
||||
using (var fs = File.OpenRead(path))
|
||||
{
|
||||
|
|
|
@ -276,7 +276,7 @@ namespace MediaBrowser.Controller.Drawing
|
|||
// Cache file doesn't exist no biggie
|
||||
}
|
||||
|
||||
var size = ImageHeader.GetDimensions(imagePath);
|
||||
var size = ImageHeader.GetDimensions(imagePath, Logger);
|
||||
|
||||
var imageSize = new ImageSize { Width = size.Width, Height = size.Height };
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ using System.Runtime.Serialization;
|
|||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
|
@ -93,6 +94,11 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <value>The date modified.</value>
|
||||
public DateTime DateModified { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
protected static ILogger Logger = LogManager.GetLogger("BaseItem");
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="System.String" /> that represents this instance.
|
||||
/// </summary>
|
||||
|
@ -268,7 +274,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error creating resolve args for ", ex, Path);
|
||||
Logger.ErrorException("Error creating resolve args for ", ex, Path);
|
||||
|
||||
throw;
|
||||
}
|
||||
|
@ -581,7 +587,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
return new List<Video> { };
|
||||
}
|
||||
|
||||
|
@ -606,7 +612,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error loading trailers for {0}", ex, Name);
|
||||
Logger.ErrorException("Error loading trailers for {0}", ex, Name);
|
||||
return new List<Video> { };
|
||||
}
|
||||
|
||||
|
@ -975,7 +981,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
var changed = copy.DateModified != DateModified;
|
||||
if (changed)
|
||||
{
|
||||
Logger.LogDebugInfo(Name + " changed - original creation: " + DateCreated + " new creation: " + copy.DateCreated + " original modified: " + DateModified + " new modified: " + copy.DateModified);
|
||||
Logger.Debug(Name + " changed - original creation: " + DateCreated + " new creation: " + copy.DateCreated + " original modified: " + DateModified + " new modified: " + copy.DateModified);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error creating FolderIds for {0}", ex, Path);
|
||||
Logger.ErrorException("Error creating FolderIds for {0}", ex, Path);
|
||||
|
||||
folderIds = new Guid[] {};
|
||||
}
|
||||
|
|
|
@ -306,7 +306,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
// Even though this implementation means multiple iterations over the target list - it allows us to defer
|
||||
// the retrieval of the individual children for each index value until they are requested.
|
||||
using (new Profiler(indexName + " Index Build for " + Name))
|
||||
using (new Profiler(indexName + " Index Build for " + Name, Logger))
|
||||
{
|
||||
// Put this in a local variable to avoid an implicitly captured closure
|
||||
var currentIndexName = indexName;
|
||||
|
@ -325,12 +325,12 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting person {0}", ex, i);
|
||||
Logger.ErrorException("Error getting person {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
catch (AggregateException ex)
|
||||
{
|
||||
Logger.LogException("Error getting person {0}", ex, i);
|
||||
Logger.ErrorException("Error getting person {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
|
@ -351,7 +351,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
{
|
||||
// Even though this implementation means multiple iterations over the target list - it allows us to defer
|
||||
// the retrieval of the individual children for each index value until they are requested.
|
||||
using (new Profiler("Studio Index Build for " + Name))
|
||||
using (new Profiler("Studio Index Build for " + Name, Logger))
|
||||
{
|
||||
var indexName = LocalizedStrings.Instance.GetString("StudioDispPref");
|
||||
|
||||
|
@ -367,12 +367,12 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting studio {0}", ex, i);
|
||||
Logger.ErrorException("Error getting studio {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
catch (AggregateException ex)
|
||||
{
|
||||
Logger.LogException("Error getting studio {0}", ex, i);
|
||||
Logger.ErrorException("Error getting studio {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
|
@ -390,7 +390,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
{
|
||||
// Even though this implementation means multiple iterations over the target list - it allows us to defer
|
||||
// the retrieval of the individual children for each index value until they are requested.
|
||||
using (new Profiler("Genre Index Build for " + Name))
|
||||
using (new Profiler("Genre Index Build for " + Name, Logger))
|
||||
{
|
||||
var indexName = LocalizedStrings.Instance.GetString("GenreDispPref");
|
||||
|
||||
|
@ -407,12 +407,12 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting genre {0}", ex, i);
|
||||
Logger.ErrorException("Error getting genre {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
catch (AggregateException ex)
|
||||
{
|
||||
Logger.LogException("Error getting genre {0}", ex, i);
|
||||
Logger.ErrorException("Error getting genre {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
|
@ -431,7 +431,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
{
|
||||
// Even though this implementation means multiple iterations over the target list - it allows us to defer
|
||||
// the retrieval of the individual children for each index value until they are requested.
|
||||
using (new Profiler("Production Year Index Build for " + Name))
|
||||
using (new Profiler("Production Year Index Build for " + Name, Logger))
|
||||
{
|
||||
var indexName = LocalizedStrings.Instance.GetString("YearDispPref");
|
||||
|
||||
|
@ -448,12 +448,12 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting year {0}", ex, i);
|
||||
Logger.ErrorException("Error getting year {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
catch (AggregateException ex)
|
||||
{
|
||||
Logger.LogException("Error getting year {0}", ex, i);
|
||||
Logger.ErrorException("Error getting year {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
|
@ -639,7 +639,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
catch (OperationCanceledException ex)
|
||||
{
|
||||
Logger.LogInfo("ValidateChildren cancelled for " + Name);
|
||||
Logger.Info("ValidateChildren cancelled for " + Name);
|
||||
|
||||
// If the outer cancelletion token in the cause for the cancellation, throw it
|
||||
if (cancellationToken.IsCancellationRequested && ex.CancellationToken == cancellationToken)
|
||||
|
@ -734,7 +734,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
foreach (var item in changedArgs.ItemsRemoved)
|
||||
{
|
||||
Logger.LogInfo("** " + item.Name + " Removed from library.");
|
||||
Logger.Info("** " + item.Name + " Removed from library.");
|
||||
}
|
||||
|
||||
var childrenReplaced = false;
|
||||
|
@ -749,7 +749,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
foreach (var item in changedArgs.ItemsAdded)
|
||||
{
|
||||
Logger.LogInfo("** " + item.Name + " Added to library.");
|
||||
Logger.Info("** " + item.Name + " Added to library.");
|
||||
|
||||
if (!childrenReplaced)
|
||||
{
|
||||
|
@ -762,7 +762,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
await Task.WhenAll(saveTasks).ConfigureAwait(false);
|
||||
|
||||
//and save children in repo...
|
||||
Logger.LogInfo("*** Saving " + newChildren.Count + " children for " + Name);
|
||||
Logger.Info("*** Saving " + newChildren.Count + " children for " + Name);
|
||||
await Kernel.Instance.ItemRepository.SaveChildren(Id, newChildren, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
@ -860,7 +860,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
return new List<BaseItem> { };
|
||||
}
|
||||
|
||||
|
@ -1028,7 +1028,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
}
|
||||
|
||||
//this should be functionally equivilent to what was here since it is IEnum and works on a thread-safe copy
|
||||
|
@ -1040,7 +1040,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -161,7 +161,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
return new List<Video> { };
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error loading trailers for {0}", ex, Name);
|
||||
Logger.ErrorException("Error loading trailers for {0}", ex, Name);
|
||||
return new List<Video> { };
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
get
|
||||
{
|
||||
// Lazy load
|
||||
LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationInitialized, ref _configurationSyncLock, () => XmlSerializer.GetXmlConfiguration<UserConfiguration>(ConfigurationFilePath));
|
||||
LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationInitialized, ref _configurationSyncLock, () => XmlSerializer.GetXmlConfiguration<UserConfiguration>(ConfigurationFilePath, Logger));
|
||||
return _configuration;
|
||||
}
|
||||
private set
|
||||
|
@ -208,7 +208,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <returns>Task.</returns>
|
||||
public async Task ValidateMediaLibrary(IProgress<TaskProgress> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
Logger.LogInfo("Validating media library for {0}", Name);
|
||||
Logger.Info("Validating media library for {0}", Name);
|
||||
await RootFolder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
@ -224,7 +224,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <returns>Task.</returns>
|
||||
public async Task ValidateCollectionFolders(IProgress<TaskProgress> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
Logger.LogInfo("Validating collection folders for {0}", Name);
|
||||
Logger.Info("Validating collection folders for {0}", Name);
|
||||
await RootFolder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
|
|
@ -70,9 +70,14 @@ namespace MediaBrowser.Controller.IO
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DirectoryWatchers" /> class.
|
||||
/// </summary>
|
||||
public DirectoryWatchers()
|
||||
public DirectoryWatchers(ILogger logger)
|
||||
{
|
||||
Logger = LogManager.GetLogger(GetType().Name);
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException("logger");
|
||||
}
|
||||
|
||||
Logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using MediaBrowser.Common.Logging;
|
||||
using MediaBrowser.Common.Win32;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -14,6 +15,11 @@ namespace MediaBrowser.Controller.IO
|
|||
/// </summary>
|
||||
public static class FileData
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
private static readonly ILogger Logger = LogManager.GetLogger("FileData");
|
||||
|
||||
/// <summary>
|
||||
/// Gets all file system entries within a foler
|
||||
/// </summary>
|
||||
|
@ -87,7 +93,7 @@ namespace MediaBrowser.Controller.IO
|
|||
if (string.IsNullOrWhiteSpace(newPath))
|
||||
{
|
||||
//invalid shortcut - could be old or target could just be unavailable
|
||||
Logger.LogWarning("Encountered invalid shortuct: "+lpFindFileData.Path);
|
||||
Logger.Warn("Encountered invalid shortuct: "+lpFindFileData.Path);
|
||||
continue;
|
||||
}
|
||||
var data = FileSystem.GetFileData(newPath);
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace MediaBrowser.Controller.IO
|
|||
public FileSystemManager(Kernel kernel)
|
||||
: base(kernel)
|
||||
{
|
||||
DirectoryWatchers = new DirectoryWatchers();
|
||||
DirectoryWatchers = new DirectoryWatchers(Logger);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using MediaBrowser.Common.Logging;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Controller.Library
|
||||
{
|
||||
|
@ -18,14 +19,22 @@ namespace MediaBrowser.Controller.Library
|
|||
/// </summary>
|
||||
readonly Stopwatch stopwatch;
|
||||
|
||||
/// <summary>
|
||||
/// The _logger
|
||||
/// </summary>
|
||||
private ILogger _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Profiler" /> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
public Profiler(string name)
|
||||
/// <param name="logger">The logger.</param>
|
||||
public Profiler(string name, ILogger logger)
|
||||
{
|
||||
this.name = name;
|
||||
|
||||
_logger = logger;
|
||||
|
||||
stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
}
|
||||
|
@ -60,7 +69,7 @@ namespace MediaBrowser.Controller.Library
|
|||
message = string.Format("{0} took {1} seconds.",
|
||||
name, ((float)stopwatch.ElapsedMilliseconds / 1000).ToString("#0.000"));
|
||||
}
|
||||
Logger.LogInfo(message);
|
||||
_logger.Info(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using MediaBrowser.Common.Localization;
|
||||
using MediaBrowser.Common.Logging;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Globalization;
|
||||
|
@ -15,6 +16,10 @@ namespace MediaBrowser.Controller.Localization
|
|||
/// </summary>
|
||||
public class LocalizedStrings
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
private static readonly ILogger Logger = LogManager.GetLogger("LocalizedStrings");
|
||||
/// <summary>
|
||||
/// The base prefix
|
||||
/// </summary>
|
||||
|
@ -80,7 +85,7 @@ namespace MediaBrowser.Controller.Localization
|
|||
var xs = new XmlSerializer(t);
|
||||
var strings = (LocalizedStringData)Activator.CreateInstance(t);
|
||||
strings.FileName = file;
|
||||
Logger.LogInfo("Using String Data from {0}", file);
|
||||
Logger.Info("Using String Data from {0}", file);
|
||||
if (File.Exists(file))
|
||||
{
|
||||
using (var fs = new FileStream(file, FileMode.Open, FileAccess.Read))
|
||||
|
@ -121,17 +126,17 @@ namespace MediaBrowser.Controller.Localization
|
|||
}
|
||||
catch (TargetException ex)
|
||||
{
|
||||
Logger.LogException("Error getting value for field: {0}", ex, field.Name);
|
||||
Logger.ErrorException("Error getting value for field: {0}", ex, field.Name);
|
||||
continue;
|
||||
}
|
||||
catch (FieldAccessException ex)
|
||||
{
|
||||
Logger.LogException("Error getting value for field: {0}", ex, field.Name);
|
||||
Logger.ErrorException("Error getting value for field: {0}", ex, field.Name);
|
||||
continue;
|
||||
}
|
||||
catch (NotSupportedException ex)
|
||||
{
|
||||
Logger.LogException("Error getting value for field: {0}", ex, field.Name);
|
||||
Logger.ErrorException("Error getting value for field: {0}", ex, field.Name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Drawing;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -13,6 +14,10 @@ namespace MediaBrowser.Controller.Providers
|
|||
/// </summary>
|
||||
public abstract class BaseImageEnhancer : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
private static readonly ILogger Logger = LogManager.GetLogger("ImageEnhancer");
|
||||
/// <summary>
|
||||
/// Return true only if the given image for the given item will be enhanced by this enhancer.
|
||||
/// </summary>
|
||||
|
@ -96,7 +101,7 @@ namespace MediaBrowser.Controller.Providers
|
|||
|
||||
var typeName = GetType().Name;
|
||||
|
||||
Logger.LogDebugInfo("Running {0} for {1}", typeName, item.Path ?? item.Name ?? "--Unknown--");
|
||||
Logger.Debug("Running {0} for {1}", typeName, item.Path ?? item.Name ?? "--Unknown--");
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -104,7 +109,7 @@ namespace MediaBrowser.Controller.Providers
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogException("{0} failed enhancing {1}", ex, typeName, item.Name);
|
||||
Logger.ErrorException("{0} failed enhancing {1}", ex, typeName, item.Name);
|
||||
|
||||
throw;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -16,6 +17,20 @@ namespace MediaBrowser.Controller.Providers
|
|||
public class BaseItemXmlParser<T>
|
||||
where T : BaseItem, new()
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
protected ILogger Logger { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BaseItemXmlParser{T}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public BaseItemXmlParser(ILogger logger)
|
||||
{
|
||||
Logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches metadata for an item from one xml file
|
||||
/// </summary>
|
||||
|
|
|
@ -66,13 +66,13 @@ namespace MediaBrowser.Controller.Providers
|
|||
private bool Fetch(BaseItem item, CancellationToken cancellationToken)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
|
||||
var metadataFile = item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.MetaLocation, "folder.xml"));
|
||||
|
||||
if (metadataFile.HasValue)
|
||||
{
|
||||
var path = metadataFile.Value.Path;
|
||||
new BaseItemXmlParser<Folder>().Fetch((Folder)item, path, cancellationToken);
|
||||
new BaseItemXmlParser<Folder>(Logger).Fetch((Folder)item, path, cancellationToken);
|
||||
SetLastRefreshed(item, DateTime.UtcNow);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -75,11 +75,11 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||
var boxset = item as BoxSet;
|
||||
if (boxset != null)
|
||||
{
|
||||
new BaseItemXmlParser<BoxSet>().Fetch(boxset, path, cancellationToken);
|
||||
new BaseItemXmlParser<BoxSet>(Logger).Fetch(boxset, path, cancellationToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
new BaseItemXmlParser<Movie>().Fetch((Movie)item, path, cancellationToken);
|
||||
new BaseItemXmlParser<Movie>(Logger).Fetch((Movie)item, path, cancellationToken);
|
||||
}
|
||||
SetLastRefreshed(item, DateTime.UtcNow);
|
||||
return true;
|
||||
|
|
|
@ -115,7 +115,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
return false;
|
||||
}
|
||||
|
||||
new EpisodeXmlParser().Fetch(item, metadataFile, cancellationToken);
|
||||
new EpisodeXmlParser(Logger).Fetch(item, metadataFile, cancellationToken);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
|
@ -9,6 +10,15 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
/// </summary>
|
||||
public class EpisodeXmlParser : BaseItemXmlParser<Episode>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EpisodeXmlParser" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public EpisodeXmlParser(ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches the data from XML node.
|
||||
/// </summary>
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
{
|
||||
var path = metadataFile.Value.Path;
|
||||
|
||||
new SeriesXmlParser().Fetch((Series)item, path, cancellationToken);
|
||||
new SeriesXmlParser(Logger).Fetch((Series)item, path, cancellationToken);
|
||||
SetLastRefreshed(item, DateTime.UtcNow);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using MediaBrowser.Common.Logging;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Resolvers.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Xml;
|
||||
|
||||
|
@ -12,6 +12,15 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
/// </summary>
|
||||
public class SeriesXmlParser : BaseItemXmlParser<Series>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BaseItemXmlParser{T}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public SeriesXmlParser(ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches the data from XML node.
|
||||
/// </summary>
|
||||
|
@ -74,7 +83,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
}
|
||||
else
|
||||
{
|
||||
Logger.LogInfo("Unrecognized series status: " + status);
|
||||
Logger.Info("Unrecognized series status: " + status);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,18 @@ using System.Linq;
|
|||
|
||||
namespace MediaBrowser.Controller.Resolvers.TV
|
||||
{
|
||||
/// <summary>
|
||||
/// Class TVUtils
|
||||
/// </summary>
|
||||
public static class TVUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// The TVDB API key
|
||||
/// </summary>
|
||||
public static readonly string TVDBApiKey = "B89CE93890E9419B";
|
||||
/// <summary>
|
||||
/// The banner URL
|
||||
/// </summary>
|
||||
public static readonly string BannerUrl = "http://www.thetvdb.com/banners/";
|
||||
|
||||
/// <summary>
|
||||
|
@ -29,11 +38,6 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
|||
/// match movie titles like "2001 A Space..."
|
||||
/// Currently we limit the numbers here to 2 digits to try and avoid this
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The order here is important, if the order is changed some of the later
|
||||
/// ones might incorrectly match things that higher ones would have caught.
|
||||
/// The most restrictive expressions should appear first
|
||||
/// </remarks>
|
||||
private static readonly Regex[] EpisodeExpressions = new[]
|
||||
{
|
||||
new Regex(
|
||||
|
@ -78,6 +82,11 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
|||
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the season number from path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns>System.Nullable{System.Int32}.</returns>
|
||||
public static int? GetSeasonNumberFromPath(string path)
|
||||
{
|
||||
// Look for one of the season folder names
|
||||
|
@ -97,6 +106,8 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
|||
/// <summary>
|
||||
/// Extracts the season number from the second half of the Season folder name (everything after "Season", or "Staffel")
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns>System.Nullable{System.Int32}.</returns>
|
||||
private static int? GetSeasonNumberFromPathSubstring(string path)
|
||||
{
|
||||
int numericStart = -1;
|
||||
|
@ -127,11 +138,22 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
|||
return int.Parse(path.Substring(numericStart, length));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [is season folder] [the specified path].
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns><c>true</c> if [is season folder] [the specified path]; otherwise, <c>false</c>.</returns>
|
||||
public static bool IsSeasonFolder(string path)
|
||||
{
|
||||
return GetSeasonNumberFromPath(path) != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [is series folder] [the specified path].
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="fileSystemChildren">The file system children.</param>
|
||||
/// <returns><c>true</c> if [is series folder] [the specified path]; otherwise, <c>false</c>.</returns>
|
||||
public static bool IsSeriesFolder(string path, IEnumerable<WIN32_FIND_DATA> fileSystemChildren)
|
||||
{
|
||||
// A folder with more than 3 non-season folders in will not becounted as a series
|
||||
|
@ -171,6 +193,12 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
|||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Episodes the number from file.
|
||||
/// </summary>
|
||||
/// <param name="fullPath">The full path.</param>
|
||||
/// <param name="isInSeason">if set to <c>true</c> [is in season].</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string EpisodeNumberFromFile(string fullPath, bool isInSeason)
|
||||
{
|
||||
string fl = fullPath.ToLower();
|
||||
|
@ -194,6 +222,11 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Seasons the number from episode file.
|
||||
/// </summary>
|
||||
/// <param name="fullPath">The full path.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string SeasonNumberFromEpisodeFile(string fullPath)
|
||||
{
|
||||
string fl = fullPath.ToLower();
|
||||
|
@ -211,6 +244,11 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the air days.
|
||||
/// </summary>
|
||||
/// <param name="day">The day.</param>
|
||||
/// <returns>List{DayOfWeek}.</returns>
|
||||
public static List<DayOfWeek> GetAirDays(string day)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(day))
|
||||
|
@ -239,8 +277,6 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
|||
};
|
||||
}
|
||||
|
||||
Logger.LogWarning("Invalid value passed into GetAirDays: {0}", day);
|
||||
|
||||
return new List<DayOfWeek>
|
||||
{
|
||||
};
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using MediaBrowser.Common.Logging;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System.Security;
|
||||
|
||||
namespace MediaBrowser.IsoMounter
|
||||
|
@ -12,7 +11,16 @@ namespace MediaBrowser.IsoMounter
|
|||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
private static readonly ILogger Logger = LogManager.GetLogger("MyPfmFileMountUi");
|
||||
private readonly ILogger Logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MyPfmFileMountUi" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public MyPfmFileMountUi(ILogger logger)
|
||||
{
|
||||
Logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the password.
|
||||
|
|
|
@ -71,16 +71,22 @@ namespace MediaBrowser.IsoMounter
|
|||
/// </summary>
|
||||
/// <value>The logger.</value>
|
||||
private ILogger Logger { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PismoIsoManager" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public PismoIsoManager(ILogger logger)
|
||||
{
|
||||
Logger = logger;
|
||||
|
||||
_myPfmFileMountUi = new MyPfmFileMountUi(Logger);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The _my PFM file mount UI
|
||||
/// </summary>
|
||||
private readonly MyPfmFileMountUi _myPfmFileMountUi = new MyPfmFileMountUi();
|
||||
private readonly MyPfmFileMountUi _myPfmFileMountUi;
|
||||
|
||||
/// <summary>
|
||||
/// Mounts the specified iso path.
|
||||
|
@ -151,6 +157,9 @@ namespace MediaBrowser.IsoMounter
|
|||
return new PismoMount(mount, isoPath, this, Logger);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
|
@ -35,6 +36,16 @@ namespace MediaBrowser.Server.Sqlite
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SQLiteUserDataRepository" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
[ImportingConstructor]
|
||||
protected SQLiteDisplayPreferencesRepository([Import("logger")] ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the connection to the database
|
||||
/// </summary>
|
||||
|
@ -75,7 +86,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
{
|
||||
throw new ArgumentNullException("cancellationToken");
|
||||
}
|
||||
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
return Task.Run(() =>
|
||||
|
|
|
@ -2,6 +2,7 @@ using MediaBrowser.Common.Serialization;
|
|||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
|
@ -40,6 +41,16 @@ namespace MediaBrowser.Server.Sqlite
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SQLiteUserDataRepository" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
[ImportingConstructor]
|
||||
protected SQLiteItemRepository([Import("logger")] ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the connection to the database
|
||||
/// </summary>
|
||||
|
@ -106,7 +117,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
var serialized = JsonSerializer.SerializeToBytes(item);
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
|
||||
var cmd = connection.CreateCommand();
|
||||
cmd.CommandText = "replace into items (guid, obj_type, data) values (@1, @2, @3)";
|
||||
cmd.AddParam("@1", item.Id);
|
||||
|
@ -128,7 +139,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
|
||||
|
||||
return RetrieveItemInternal(id);
|
||||
}
|
||||
|
||||
|
@ -144,7 +155,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
|
||||
|
||||
var cmd = connection.CreateCommand();
|
||||
cmd.CommandText = "select obj_type,data from items where guid = @guid";
|
||||
var guidParam = cmd.Parameters.Add("@guid", DbType.Guid);
|
||||
|
@ -185,7 +196,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
|
||||
var cmd = connection.CreateCommand();
|
||||
cmd.CommandText = "select obj_type,data from items where guid in (select child from children where guid = @guid)";
|
||||
var guidParam = cmd.Parameters.Add("@guid", DbType.Guid);
|
||||
|
@ -202,7 +213,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
var itemType = _typeMapper.GetType(type);
|
||||
if (itemType == null)
|
||||
{
|
||||
Logger.Error("Cannot find type {0}. Probably belongs to plug-in that is no longer loaded.",type);
|
||||
Logger.Error("Cannot find type {0}. Probably belongs to plug-in that is no longer loaded.", type);
|
||||
continue;
|
||||
}
|
||||
var item = JsonSerializer.DeserializeFromStream(stream, itemType) as BaseItem;
|
||||
|
|
|
@ -38,14 +38,33 @@ namespace MediaBrowser.Server.Sqlite
|
|||
/// </summary>
|
||||
private Timer FlushTimer;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the logger.
|
||||
/// </summary>
|
||||
/// <value>The logger.</value>
|
||||
protected ILogger Logger { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SqliteRepository" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <exception cref="System.ArgumentNullException">logger</exception>
|
||||
protected SqliteRepository(ILogger logger)
|
||||
{
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException("logger");
|
||||
}
|
||||
|
||||
Logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Connects to DB.
|
||||
/// </summary>
|
||||
/// <param name="dbPath">The db path.</param>
|
||||
/// <returns>Task{System.Boolean}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
/// <exception cref="System.ArgumentNullException">dbPath</exception>
|
||||
protected async Task ConnectToDB(string dbPath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(dbPath))
|
||||
|
@ -53,8 +72,6 @@ namespace MediaBrowser.Server.Sqlite
|
|||
throw new ArgumentNullException("dbPath");
|
||||
}
|
||||
|
||||
Logger = LogManager.GetLogger(GetType().Name);
|
||||
|
||||
dbFileName = dbPath;
|
||||
var connectionstr = new SQLiteConnectionStringBuilder
|
||||
{
|
||||
|
@ -78,7 +95,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
/// </summary>
|
||||
/// <param name="queries">The queries.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
/// <exception cref="System.ArgumentNullException">queries</exception>
|
||||
protected void RunQueries(string[] queries)
|
||||
{
|
||||
if (queries == null)
|
||||
|
@ -167,7 +184,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
/// Queues the command.
|
||||
/// </summary>
|
||||
/// <param name="cmd">The CMD.</param>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
/// <exception cref="System.ArgumentNullException">cmd</exception>
|
||||
protected void QueueCommand(SQLiteCommand cmd)
|
||||
{
|
||||
if (cmd == null)
|
||||
|
@ -242,7 +259,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
/// </summary>
|
||||
/// <param name="cmd">The CMD.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
/// <exception cref="System.ArgumentNullException">cmd</exception>
|
||||
public async Task ExecuteCommand(DbCommand cmd)
|
||||
{
|
||||
if (cmd == null)
|
||||
|
@ -275,7 +292,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
/// <param name="reader">The reader.</param>
|
||||
/// <param name="ordinal">The ordinal.</param>
|
||||
/// <returns>Stream.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
/// <exception cref="System.ArgumentNullException">reader</exception>
|
||||
protected static Stream GetStream(IDataReader reader, int ordinal)
|
||||
{
|
||||
if (reader == null)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
|
@ -34,6 +35,16 @@ namespace MediaBrowser.Server.Sqlite
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SQLiteUserDataRepository" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
[ImportingConstructor]
|
||||
protected SQLiteUserDataRepository([Import("logger")] ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the connection to the database
|
||||
/// </summary>
|
||||
|
@ -108,7 +119,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>IEnumerable{UserItemData}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
public IEnumerable<UserItemData> RetrieveUserData(BaseItem item)
|
||||
{
|
||||
if (item == null)
|
||||
|
|
|
@ -9,6 +9,7 @@ using System.Data;
|
|||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Server.Sqlite
|
||||
{
|
||||
|
@ -35,6 +36,16 @@ namespace MediaBrowser.Server.Sqlite
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SQLiteUserDataRepository" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
[ImportingConstructor]
|
||||
protected SQLiteUserRepository([Import("logger")] ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the connection to the database
|
||||
/// </summary>
|
||||
|
|
|
@ -179,7 +179,7 @@ namespace MediaBrowser.ServerApplication
|
|||
/// <returns>Window.</returns>
|
||||
protected override Window InstantiateMainWindow()
|
||||
{
|
||||
return new MainWindow();
|
||||
return new MainWindow(LogManager.GetLogger("MainWindow"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace MediaBrowser.ServerApplication.Controls
|
|||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
private static readonly ILogger Logger = LogManager.GetLogger("MultiItemUpdateNotification");
|
||||
private readonly ILogger Logger;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the children changed event args.
|
||||
|
@ -34,8 +34,15 @@ namespace MediaBrowser.ServerApplication.Controls
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ItemUpdateNotification" /> class.
|
||||
/// </summary>
|
||||
public ItemUpdateNotification()
|
||||
public ItemUpdateNotification(ILogger logger)
|
||||
{
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException("logger");
|
||||
}
|
||||
|
||||
Logger = logger;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
Loaded += ItemUpdateNotification_Loaded;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -19,7 +20,7 @@ namespace MediaBrowser.ServerApplication.Controls
|
|||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
private static readonly ILogger Logger = LogManager.GetLogger("MultiItemUpdateNotification");
|
||||
private readonly ILogger Logger;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the children changed event args.
|
||||
|
@ -33,8 +34,15 @@ namespace MediaBrowser.ServerApplication.Controls
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MultiItemUpdateNotification" /> class.
|
||||
/// </summary>
|
||||
public MultiItemUpdateNotification()
|
||||
public MultiItemUpdateNotification(ILogger logger)
|
||||
{
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException("logger");
|
||||
}
|
||||
|
||||
Logger = logger;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
Loaded += MultiItemUpdateNotification_Loaded;
|
||||
|
|
|
@ -18,6 +18,7 @@ using System.Windows.Controls;
|
|||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Imaging;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.ServerApplication
|
||||
{
|
||||
|
@ -26,6 +27,8 @@ namespace MediaBrowser.ServerApplication
|
|||
/// </summary>
|
||||
public partial class LibraryExplorer : Window
|
||||
{
|
||||
private ILogger _logger;
|
||||
|
||||
/// <summary>
|
||||
/// The current user
|
||||
/// </summary>
|
||||
|
@ -33,8 +36,10 @@ namespace MediaBrowser.ServerApplication
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LibraryExplorer" /> class.
|
||||
/// </summary>
|
||||
public LibraryExplorer()
|
||||
public LibraryExplorer(ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
|
||||
InitializeComponent();
|
||||
lblVersion.Content = "Version: " + Kernel.Instance.DisplayVersion;
|
||||
foreach (var user in Kernel.Instance.Users)
|
||||
|
@ -311,7 +316,7 @@ namespace MediaBrowser.ServerApplication
|
|||
{
|
||||
using (
|
||||
new Profiler("Explorer full index expansion for " +
|
||||
folder.Name))
|
||||
folder.Name, _logger))
|
||||
{
|
||||
//re-build the current item's children as an index
|
||||
prefs.IndexBy = ddlIndexBy.SelectedItem as string;
|
||||
|
@ -352,7 +357,7 @@ namespace MediaBrowser.ServerApplication
|
|||
{
|
||||
using (
|
||||
new Profiler("Explorer sorting by " + ddlSortBy.SelectedItem + " for " +
|
||||
folder.Name))
|
||||
folder.Name, _logger))
|
||||
{
|
||||
//re-sort
|
||||
prefs.SortBy = ddlSortBy.SelectedItem as string;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.ServerApplication.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -37,11 +38,25 @@ namespace MediaBrowser.ServerApplication
|
|||
/// <value>The new item timer.</value>
|
||||
private Timer NewItemTimer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The _logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MainWindow" /> class.
|
||||
/// </summary>
|
||||
public MainWindow()
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <exception cref="System.ArgumentNullException">logger</exception>
|
||||
public MainWindow(ILogger logger)
|
||||
{
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException("logger");
|
||||
}
|
||||
|
||||
_logger = logger;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
Loaded += MainWindowLoaded;
|
||||
|
@ -145,11 +160,19 @@ namespace MediaBrowser.ServerApplication
|
|||
// Show the notification
|
||||
if (newItems.Count == 1)
|
||||
{
|
||||
Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new ItemUpdateNotification { DataContext = newItems[0] }, PopupAnimation.Slide, 6000));
|
||||
Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new ItemUpdateNotification(LogManager.GetLogger("ItemUpdateNotification"))
|
||||
{
|
||||
DataContext = newItems[0]
|
||||
|
||||
}, PopupAnimation.Slide, 6000));
|
||||
}
|
||||
else if (newItems.Count > 1)
|
||||
{
|
||||
Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new MultiItemUpdateNotification { DataContext = newItems }, PopupAnimation.Slide, 6000));
|
||||
Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new MultiItemUpdateNotification(LogManager.GetLogger("ItemUpdateNotification"))
|
||||
{
|
||||
DataContext = newItems
|
||||
|
||||
}, PopupAnimation.Slide, 6000));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,7 +269,7 @@ namespace MediaBrowser.ServerApplication
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogException("Error in event handler", ex);
|
||||
_logger.ErrorException("Error in event handler", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +282,7 @@ namespace MediaBrowser.ServerApplication
|
|||
/// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
|
||||
private void cmOpenExplorer_click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
(new LibraryExplorer()).Show();
|
||||
(new LibraryExplorer(_logger)).Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -325,11 +348,5 @@ namespace MediaBrowser.ServerApplication
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void cmdApiDocs_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -20,6 +21,17 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
get { return "DashboardInfo"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DashboardInfoWebSocketListener" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
[ImportingConstructor]
|
||||
public DashboardInfoWebSocketListener([Import("logger")] ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the data to send.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue
Block a user