From 0ec38a9d40a015af87b19cf345e0dfb1e433b45d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 12 Mar 2015 21:55:22 -0400 Subject: adjust audio direct play checks --- .../Session/SessionManager.cs | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Session/SessionManager.cs') diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 2e28862e9..7c6ab2af6 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -1639,7 +1639,7 @@ namespace MediaBrowser.Server.Implementations.Session string.Equals(i.Client, client)); } - public Task GetSessionByAuthenticationToken(AuthenticationInfo info, string remoteEndpoint, string appVersion) + public Task GetSessionByAuthenticationToken(AuthenticationInfo info, string deviceId, string remoteEndpoint, string appVersion) { if (info == null) { @@ -1654,10 +1654,26 @@ namespace MediaBrowser.Server.Implementations.Session ? "1" : appVersion; - return GetSessionInfo(info.AppName, appVersion, info.DeviceId, info.DeviceName, remoteEndpoint, user); + var deviceName = info.DeviceName; + + if (!string.IsNullOrWhiteSpace(deviceId)) + { + // Replace the info from the token with more recent info + var device = _deviceManager.GetDevice(deviceId); + if (device != null) + { + deviceName = device.Name; + } + } + else + { + deviceId = info.DeviceId; + } + + return GetSessionInfo(info.AppName, appVersion, deviceId, deviceName, remoteEndpoint, user); } - public Task GetSessionByAuthenticationToken(string token, string remoteEndpoint) + public Task GetSessionByAuthenticationToken(string token, string deviceId, string remoteEndpoint) { var result = _authRepo.Get(new AuthenticationInfoQuery { @@ -1676,7 +1692,7 @@ namespace MediaBrowser.Server.Implementations.Session return null; } - return GetSessionByAuthenticationToken(info, remoteEndpoint, null); + return GetSessionByAuthenticationToken(info, deviceId, remoteEndpoint, null); } public Task SendMessageToUserSessions(string userId, string name, T data, -- cgit v1.2.3