瀏覽代碼

Update to use SupportsMediaControl

Luke Pulverenti 10 年之前
父節點
當前提交
8610a9b7ef

+ 29 - 11
MediaBrowser.Controller/Session/SessionInfo.cs

@@ -14,17 +14,8 @@ namespace MediaBrowser.Controller.Session
         public SessionInfo()
         {
             QueueableMediaTypes = new List<string>();
-            PlayableMediaTypes = new List<string>
-            {
-                MediaType.Audio,
-                MediaType.Book,
-                MediaType.Game,
-                MediaType.Photo,
-                MediaType.Video
-            };
 
             AdditionalUsers = new List<SessionUserInfo>();
-            SupportedCommands = new List<string>();
             PlayState = new PlayerStateInfo();
         }
 
@@ -32,6 +23,8 @@ namespace MediaBrowser.Controller.Session
         
         public List<SessionUserInfo> AdditionalUsers { get; set; }
 
+        public ClientCapabilities Capabilities { get; set; }
+
         /// <summary>
         /// Gets or sets the remote end point.
         /// </summary>
@@ -48,7 +41,17 @@ namespace MediaBrowser.Controller.Session
         /// Gets or sets the playable media types.
         /// </summary>
         /// <value>The playable media types.</value>
-        public List<string> PlayableMediaTypes { get; set; }
+        public List<string> PlayableMediaTypes
+        {
+            get
+            {
+                if (Capabilities == null)
+                {
+                    return new List<string>();
+                }
+                return Capabilities.PlayableMediaTypes;
+            }
+        }
 
         /// <summary>
         /// Gets or sets the id.
@@ -126,7 +129,17 @@ namespace MediaBrowser.Controller.Session
         /// Gets or sets the supported commands.
         /// </summary>
         /// <value>The supported commands.</value>
-        public List<string> SupportedCommands { get; set; }
+        public List<string> SupportedCommands
+        {
+            get
+            {
+                if (Capabilities == null)
+                {
+                    return new List<string>();
+                }
+                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;

+ 0 - 5
MediaBrowser.Model/Session/ClientCapabilities.cs

@@ -20,11 +20,6 @@ namespace MediaBrowser.Model.Session
 
         public DeviceProfile DeviceProfile { get; set; }
 
-        /// <summary>
-        /// Usage should be migrated to SupportsPersistentIdentifier. Keeping this to preserve data.
-        /// </summary>
-        public bool? SupportsUniqueIdentifier { get; set; }
-        
         public ClientCapabilities()
         {
             PlayableMediaTypes = new List<string>();

+ 0 - 8
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)
             {

+ 1 - 1
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;
                 });
             }

+ 1 - 2
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))
             {