3.0.5464.40000

This commit is contained in:
Luke Pulverenti 2014-12-17 17:39:17 -05:00
parent 3763f7d912
commit e3484bdcc2
10 changed files with 92 additions and 31 deletions

View File

@ -294,19 +294,20 @@ namespace MediaBrowser.Common.Implementations
public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths, bool isStartup)
{
if (isStartup)
{
logger.Info("Media Browser Server started");
}
logger.LogMultiline("Media Browser", LogSeverity.Info, GetBaseExceptionMessage(appPaths));
}
logger.Info("Command line: {0}", string.Join(" ", Environment.GetCommandLineArgs()));
protected static StringBuilder GetBaseExceptionMessage(IApplicationPaths appPaths)
{
var builder = new StringBuilder();
logger.Info("Server: {0}", Environment.MachineName);
logger.Info("Operating system: {0}", Environment.OSVersion.ToString());
logger.Info("Processor count: {0}", Environment.ProcessorCount);
logger.Info("64-Bit OS: {0}", Environment.Is64BitOperatingSystem);
logger.Info("64-Bit Process: {0}", Environment.Is64BitProcess);
logger.Info("Program data path: {0}", appPaths.ProgramDataPath);
builder.AppendLine(string.Format("Command line: {0}", string.Join(" ", Environment.GetCommandLineArgs())));
builder.AppendLine(string.Format("Operating system: {0}", Environment.OSVersion));
builder.AppendLine(string.Format("Processor count: {0}", Environment.ProcessorCount));
builder.AppendLine(string.Format("64-Bit OS: {0}", Environment.Is64BitOperatingSystem));
builder.AppendLine(string.Format("64-Bit Process: {0}", Environment.Is64BitProcess));
builder.AppendLine(string.Format("Program data path: {0}", appPaths.ProgramDataPath));
Type type = Type.GetType("Mono.Runtime");
if (type != null)
@ -314,13 +315,13 @@ namespace MediaBrowser.Common.Implementations
MethodInfo displayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
if (displayName != null)
{
logger.Info("Mono: " + displayName.Invoke(null, null));
builder.AppendLine("Mono: " + displayName.Invoke(null, null));
}
}
logger.Info("Application Path: {0}", appPaths.ApplicationPath);
}
logger.Info("*** When reporting issues please include the entire log file. ***".ToUpper());
builder.AppendLine(string.Format("Application Path: {0}", appPaths.ApplicationPath));
return builder;
}
protected virtual IJsonSerializer CreateJsonSerializer()

View File

@ -14,6 +14,8 @@ namespace MediaBrowser.Common.Implementations.Logging
/// </summary>
private readonly NLog.Logger _logger;
private readonly ILogManager _logManager;
/// <summary>
/// The _lock object
/// </summary>
@ -23,8 +25,10 @@ namespace MediaBrowser.Common.Implementations.Logging
/// Initializes a new instance of the <see cref="NLogger" /> class.
/// </summary>
/// <param name="name">The name.</param>
public NLogger(string name)
/// <param name="logManager">The log manager.</param>
public NLogger(string name, ILogManager logManager)
{
_logManager = logManager;
lock (LockObject)
{
_logger = NLog.LogManager.GetLogger(name);
@ -96,6 +100,13 @@ namespace MediaBrowser.Common.Implementations.Logging
var messageText = LogHelper.GetLogMessage(exception);
var prefix = _logManager.ExceptionMessagePrefix;
if (!string.IsNullOrWhiteSpace(prefix))
{
messageText.Insert(0, prefix);
}
LogMultiline(message, level, messageText);
}

View File

@ -34,6 +34,12 @@ namespace MediaBrowser.Common.Implementations.Logging
/// <value>The log file path.</value>
public string LogFilePath { get; private set; }
/// <summary>
/// Gets or sets the exception message prefix.
/// </summary>
/// <value>The exception message prefix.</value>
public string ExceptionMessagePrefix { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="NlogManager" /> class.
/// </summary>
@ -159,7 +165,7 @@ namespace MediaBrowser.Common.Implementations.Logging
/// <returns>ILogger.</returns>
public ILogger GetLogger(string name)
{
return new NLogger(name);
return new NLogger(name, this);
}
/// <summary>

View File

@ -13,6 +13,12 @@ namespace MediaBrowser.Model.Logging
/// <value>The log level.</value>
LogSeverity LogSeverity { get; set; }
/// <summary>
/// Gets or sets the exception message prefix.
/// </summary>
/// <value>The exception message prefix.</value>
string ExceptionMessagePrefix { get; set; }
/// <summary>
/// Gets the logger.
/// </summary>

View File

@ -48,7 +48,7 @@ namespace MediaBrowser.Server.Implementations.Sync
throw new InvalidOperationException("Cannot proceed with sync because user no longer exists.");
}
var items = GetItemsForSync(job.RequestedItemIds, user)
var items = GetItemsForSync(job.RequestedItemIds, user, job.UnwatchedOnly)
.ToList();
var jobItems = _syncRepo.GetJobItems(new SyncJobItemQuery
@ -171,12 +171,31 @@ namespace MediaBrowser.Server.Implementations.Sync
return _syncRepo.Update(job);
}
public IEnumerable<BaseItem> GetItemsForSync(IEnumerable<string> itemIds, User user)
public IEnumerable<BaseItem> GetItemsForSync(IEnumerable<string> itemIds, User user, bool unwatchedOnly)
{
return itemIds
var items = itemIds
.SelectMany(i => GetItemsForSync(i, user))
.Where(_syncManager.SupportsSync)
.DistinctBy(i => i.Id);
.Where(_syncManager.SupportsSync);
if (unwatchedOnly)
{
// Avoid implicitly captured closure
var currentUser = user;
items = items.Where(i =>
{
var video = i as Video;
if (video != null)
{
return !video.IsPlayed(currentUser);
}
return true;
});
}
return items.DistinctBy(i => i.Id);
}
private IEnumerable<BaseItem> GetItemsForSync(string id, User user)
@ -200,8 +219,8 @@ namespace MediaBrowser.Server.Implementations.Sync
.GetRecursiveChildren(user);
return itemByName.GetTaggedItems(items);
}
}
if (item.IsFolder)
{
var folder = (Folder)item;

View File

@ -49,7 +49,7 @@ namespace MediaBrowser.Server.Implementations.Sync
var user = _userManager.GetUserById(request.UserId);
var items = processor
.GetItemsForSync(request.ItemIds, user)
.GetItemsForSync(request.ItemIds, user, request.UnwatchedOnly)
.ToList();
if (items.Any(i => !SupportsSync(i)))

View File

@ -61,7 +61,7 @@ namespace MediaBrowser.Server.Implementations.Sync
public bool IsHidden
{
get { return false; }
get { return true; }
}
public bool IsEnabled

View File

@ -251,6 +251,8 @@ namespace MediaBrowser.Server.Startup.Common
_remotePackageName = remotePackageName;
_supportsNativeWebSocket = supportsNativeWebSocket;
NativeApp = nativeApp;
SetBaseExceptionMessage();
}
private Version _version;
@ -307,6 +309,23 @@ namespace MediaBrowser.Server.Startup.Common
get { return NativeApp.SupportsAutoRunAtStartup; }
}
private void SetBaseExceptionMessage()
{
var builder = GetBaseExceptionMessage(ApplicationPaths);
// Skip if plugins haven't been loaded yet
//if (Plugins != null)
//{
// var pluginString = string.Join("|", Plugins.Select(i => i.Name + "-" + i.Version.ToString()).ToArray());
// builder.Insert(0, string.Format("Plugins: {0}{1}", pluginString, Environment.NewLine));
//}
builder.Insert(0, string.Format("Version: {0}{1}", ApplicationVersion, Environment.NewLine));
builder.Insert(0, "*** Error Report ***" + Environment.NewLine);
LogManager.ExceptionMessagePrefix = builder.ToString();
}
/// <summary>
/// Runs the startup tasks.
/// </summary>

View File

@ -1,5 +1,4 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Implementations.Logging;
using MediaBrowser.Common.Implementations.Logging;
using MediaBrowser.Model.Logging;
using MediaBrowser.Server.Implementations;
using MediaBrowser.Server.Startup.Common;

View File

@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyVersion("3.0.*")]
//[assembly: AssemblyVersion("3.0.5463.3000")]
//[assembly: AssemblyVersion("3.0.*")]
[assembly: AssemblyVersion("3.0.5464.40000")]