restored people editing

This commit is contained in:
Luke Pulverenti 2014-06-04 12:15:44 -04:00
parent 3640f62086
commit 0d72696bf4
5 changed files with 24 additions and 8 deletions

View File

@ -10,6 +10,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MoreLinq;
namespace MediaBrowser.Server.Implementations.Collections namespace MediaBrowser.Server.Implementations.Collections
{ {
@ -255,7 +256,10 @@ namespace MediaBrowser.Server.Implementations.Collections
} }
} }
return list.Except(itemsToCollapse.Cast<BaseItem>()).Concat(boxsets).Distinct(); return list
.Except(itemsToCollapse.Cast<BaseItem>())
.Concat(boxsets)
.DistinctBy(i => i.Id);
} }
} }
} }

View File

@ -42,6 +42,14 @@ namespace MediaBrowser.Server.Implementations.Session
ResetPingTimer(); ResetPingTimer();
} }
private string PostUrl
{
get
{
return string.Format("http://{0}{1}", Session.RemoteEndPoint, _postUrl);
}
}
public bool IsSessionActive public bool IsSessionActive
{ {
get get
@ -97,7 +105,7 @@ namespace MediaBrowser.Server.Implementations.Session
Dictionary<string, string> args, Dictionary<string, string> args,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var url = _postUrl + "/" + name + ToQueryString(args); var url = PostUrl + "/" + name + ToQueryString(args);
await _httpClient.Post(new HttpRequestOptions await _httpClient.Post(new HttpRequestOptions
{ {

View File

@ -1,5 +1,4 @@
using System.IO; using MediaBrowser.Common.Events;
using MediaBrowser.Common.Events;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
using MediaBrowser.Controller; using MediaBrowser.Controller;
@ -22,6 +21,7 @@ using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -983,6 +983,8 @@ namespace MediaBrowser.Server.Implementations.Session
/// <returns>Task.</returns> /// <returns>Task.</returns>
public Task SendServerRestartNotification(CancellationToken cancellationToken) public Task SendServerRestartNotification(CancellationToken cancellationToken)
{ {
_logger.Debug("Beginning SendServerRestartNotification");
var sessions = Sessions.Where(i => i.IsActive && i.SessionController != null).ToList(); var sessions = Sessions.Where(i => i.IsActive && i.SessionController != null).ToList();
var tasks = sessions.Select(session => Task.Run(async () => var tasks = sessions.Select(session => Task.Run(async () =>
@ -1171,13 +1173,11 @@ namespace MediaBrowser.Server.Implementations.Session
if (!string.IsNullOrWhiteSpace(capabilities.MessageCallbackUrl)) if (!string.IsNullOrWhiteSpace(capabilities.MessageCallbackUrl))
{ {
var postUrl = string.Format("http://{0}{1}", session.RemoteEndPoint, capabilities.MessageCallbackUrl);
var controller = session.SessionController as HttpSessionController; var controller = session.SessionController as HttpSessionController;
if (controller == null) if (controller == null)
{ {
session.SessionController = new HttpSessionController(_httpClient, _jsonSerializer, session, postUrl, this); session.SessionController = new HttpSessionController(_httpClient, _jsonSerializer, session, capabilities.MessageCallbackUrl, this);
} }
} }

View File

@ -798,6 +798,8 @@ namespace MediaBrowser.ServerApplication
Logger.ErrorException("Error sending server restart notification", ex); Logger.ErrorException("Error sending server restart notification", ex);
} }
Logger.Debug("Calling NativeApp.Restart");
NativeApp.Restart(); NativeApp.Restart();
} }

View File

@ -116,11 +116,13 @@ namespace MediaBrowser.ServerApplication
/// <returns><c>true</c> if [is already running] [the specified current process]; otherwise, <c>false</c>.</returns> /// <returns><c>true</c> if [is already running] [the specified current process]; otherwise, <c>false</c>.</returns>
private static bool IsAlreadyRunning(string applicationPath, Process currentProcess) private static bool IsAlreadyRunning(string applicationPath, Process currentProcess)
{ {
var filename = Path.GetFileName(applicationPath);
var duplicate = Process.GetProcesses().FirstOrDefault(i => var duplicate = Process.GetProcesses().FirstOrDefault(i =>
{ {
try try
{ {
return string.Equals(applicationPath, i.MainModule.FileName) && currentProcess.Id != i.Id; return string.Equals(filename, Path.GetFileName(i.MainModule.FileName)) && currentProcess.Id != i.Id;
} }
catch (Exception) catch (Exception)
{ {