From c9345179db5ff8e3f681666ce063bb7a028fff84 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 4 Oct 2013 15:48:31 -0400 Subject: [PATCH] fix ambiguous method call --- MediaBrowser.Controller/Entities/Folder.cs | 13 ++++--------- .../EntryPoints/LibraryChangedNotifier.cs | 6 ++++-- .../Session/SessionWebSocketListener.cs | 18 ++++++++++++------ 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index bcf62115ce..fa72b5abac 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1032,7 +1032,7 @@ namespace MediaBrowser.Controller.Entities /// public IEnumerable GetRecursiveChildren(User user, bool includeLinkedChildren = true) { - return GetRecursiveChildren(user, null, true); + return GetRecursiveChildren(user, null, includeLinkedChildren); } /// @@ -1047,7 +1047,7 @@ namespace MediaBrowser.Controller.Entities { if (user == null) { - throw new ArgumentNullException(); + throw new ArgumentNullException("user"); } var initialCount = _lastRecursiveCount == 0 ? _children.Count : _lastRecursiveCount; @@ -1057,12 +1057,7 @@ namespace MediaBrowser.Controller.Entities _lastRecursiveCount = list.Count; - if (includeLinkedChildren && hasLinkedChildren) - { - list = list.DistinctBy(i => i.Id).ToList(); - } - - return list; + return hasLinkedChildren ? list.DistinctBy(i => i.Id).ToList() : list; } /// @@ -1071,7 +1066,7 @@ namespace MediaBrowser.Controller.Entities /// IList{BaseItem}. public IList GetRecursiveChildren() { - return GetRecursiveChildren(null); + return GetRecursiveChildren(null, null, true); } /// diff --git a/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs index 7a3081ab5d..8b778f26c3 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs @@ -230,7 +230,9 @@ namespace MediaBrowser.Server.Implementations.EntryPoints var collections = user.RootFolder.GetChildren(user, true).ToList(); - var allRecursiveChildren = user.RootFolder.GetRecursiveChildren(user).ToDictionary(i => i.Id); + var allRecursiveChildren = user.RootFolder.GetRecursiveChildren(user) + .Select(i => i.Id) + .ToDictionary(i => i); return new LibraryUpdateInfo { @@ -256,7 +258,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints /// All recursive children. /// if set to true [include if not found]. /// IEnumerable{``0}. - private IEnumerable TranslatePhysicalItemToUserLibrary(T item, User user, IEnumerable collections, Dictionary allRecursiveChildren, bool includeIfNotFound = false) + private IEnumerable TranslatePhysicalItemToUserLibrary(T item, User user, IEnumerable collections, Dictionary allRecursiveChildren, bool includeIfNotFound = false) where T : BaseItem { // If the physical root changed, return the user root diff --git a/MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs b/MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs index 399cce945f..41cb7eb6bb 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs @@ -95,17 +95,23 @@ namespace MediaBrowser.Server.Implementations.Session var version = vals[2]; var deviceName = vals.Length > 3 ? vals[3] : string.Empty; - if (!string.IsNullOrEmpty(deviceName)) - { - _logger.Debug("Logging session activity"); - await _sessionManager.LogSessionActivity(client, version, deviceId, deviceName, null).ConfigureAwait(false); - } - var session = _sessionManager.Sessions .FirstOrDefault(i => string.Equals(i.DeviceId, deviceId) && string.Equals(i.Client, client) && string.Equals(i.ApplicationVersion, version)); + if (session == null && !string.IsNullOrEmpty(deviceName)) + { + _logger.Debug("Logging session activity"); + + await _sessionManager.LogSessionActivity(client, version, deviceId, deviceName, null).ConfigureAwait(false); + + session = _sessionManager.Sessions + .FirstOrDefault(i => string.Equals(i.DeviceId, deviceId) && + string.Equals(i.Client, client) && + string.Equals(i.ApplicationVersion, version)); + } + if (session != null) { var controller = new WebSocketController(session, _appHost);