From 8610a9b7ef9a976dfdcc68f5171b0c366dc518b9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 19 Feb 2015 14:21:03 -0500 Subject: [PATCH] Update to use SupportsMediaControl --- .../Session/SessionInfo.cs | 40 ++++++++++++++----- .../Session/ClientCapabilities.cs | 5 --- MediaBrowser.Providers/Manager/ImageSaver.cs | 8 ---- .../Devices/DeviceManager.cs | 2 +- .../Session/SessionManager.cs | 3 +- 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index 078d4d70ff..64b20c13ef 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -14,17 +14,8 @@ namespace MediaBrowser.Controller.Session public SessionInfo() { QueueableMediaTypes = new List(); - PlayableMediaTypes = new List - { - MediaType.Audio, - MediaType.Book, - MediaType.Game, - MediaType.Photo, - MediaType.Video - }; AdditionalUsers = new List(); - SupportedCommands = new List(); PlayState = new PlayerStateInfo(); } @@ -32,6 +23,8 @@ namespace MediaBrowser.Controller.Session public List AdditionalUsers { get; set; } + public ClientCapabilities Capabilities { get; set; } + /// /// Gets or sets the remote end point. /// @@ -48,7 +41,17 @@ namespace MediaBrowser.Controller.Session /// Gets or sets the playable media types. /// /// The playable media types. - public List PlayableMediaTypes { get; set; } + public List PlayableMediaTypes + { + get + { + if (Capabilities == null) + { + return new List(); + } + return Capabilities.PlayableMediaTypes; + } + } /// /// Gets or sets the id. @@ -126,7 +129,17 @@ namespace MediaBrowser.Controller.Session /// Gets or sets the supported commands. /// /// The supported commands. - public List SupportedCommands { get; set; } + public List SupportedCommands + { + get + { + if (Capabilities == null) + { + return new List(); + } + return Capabilities.SupportedCommands; + } + } public TranscodingInfo TranscodingInfo { get; set; } @@ -151,6 +164,11 @@ namespace MediaBrowser.Controller.Session { get { + if (Capabilities == null || !Capabilities.SupportsMediaControl) + { + return false; + } + if (SessionController != null) { return SessionController.SupportsMediaControl; diff --git a/MediaBrowser.Model/Session/ClientCapabilities.cs b/MediaBrowser.Model/Session/ClientCapabilities.cs index 6ca4507c02..9361a60ea4 100644 --- a/MediaBrowser.Model/Session/ClientCapabilities.cs +++ b/MediaBrowser.Model/Session/ClientCapabilities.cs @@ -20,11 +20,6 @@ namespace MediaBrowser.Model.Session public DeviceProfile DeviceProfile { get; set; } - /// - /// Usage should be migrated to SupportsPersistentIdentifier. Keeping this to preserve data. - /// - public bool? SupportsUniqueIdentifier { get; set; } - public ClientCapabilities() { PlayableMediaTypes = new List(); diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs index a8e16e4ae5..22178434fb 100644 --- a/MediaBrowser.Providers/Manager/ImageSaver.cs +++ b/MediaBrowser.Providers/Manager/ImageSaver.cs @@ -82,14 +82,6 @@ namespace MediaBrowser.Providers.Manager { saveLocally = true; } - if (item is IItemByName) - { - var hasDualAccess = item as IHasDualAccess; - if (hasDualAccess == null || hasDualAccess.IsAccessedByName) - { - saveLocally = true; - } - } if (type != ImageType.Primary && item is Episode) { diff --git a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs b/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs index 3211f88d5f..84dd8a97c0 100644 --- a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs +++ b/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs @@ -109,7 +109,7 @@ namespace MediaBrowser.Server.Implementations.Devices devices = devices.Where(i => { var caps = GetCapabilities(i.Id); - var deviceVal = caps.SupportsUniqueIdentifier ?? caps.SupportsPersistentIdentifier; + var deviceVal = caps.SupportsPersistentIdentifier; return deviceVal == val; }); } diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index a9488190c4..d02ef9d270 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -1327,8 +1327,7 @@ namespace MediaBrowser.Server.Implementations.Session ClientCapabilities capabilities, bool saveCapabilities) { - session.PlayableMediaTypes = capabilities.PlayableMediaTypes; - session.SupportedCommands = capabilities.SupportedCommands; + session.Capabilities = capabilities; if (!string.IsNullOrWhiteSpace(capabilities.MessageCallbackUrl)) {