소스 검색

Added an api method to download the list of installed plugins from the server

LukePulverenti Luke Pulverenti luke pulverenti 13 년 전
부모
커밋
4500f1d11b
3개의 변경된 파일15개의 추가작업 그리고 7개의 파일을 삭제
  1. 1 6
      MediaBrowser.Api/HttpHandlers/PluginsHandler.cs
  2. 13 0
      MediaBrowser.ApiInteraction/ApiClient.cs
  3. 1 1
      MediaBrowser.Model/DTO/PluginInfo.cs

+ 1 - 6
MediaBrowser.Api/HttpHandlers/PluginsHandler.cs

@@ -21,15 +21,10 @@ namespace MediaBrowser.Api.HttpHandlers
                     Name = p.Name,
                     Enabled = p.Enabled,
                     DownloadToUI = p.DownloadToUI,
-                    Version = p.Version
+                    Version = p.Version.ToString()
                 };
             });
 
-            if (QueryString["uionly"] == "1")
-            {
-                plugins = plugins.Where(p => p.DownloadToUI);
-            }
-
             return Task.FromResult<IEnumerable<PluginInfo>>(plugins);
         }
     }

+ 13 - 0
MediaBrowser.ApiInteraction/ApiClient.cs

@@ -566,6 +566,19 @@ namespace MediaBrowser.ApiInteraction
             }
         }
 
+        /// <summary>
+        /// Gets a list of plugins installed on the server
+        /// </summary>
+        public async Task<PluginInfo[]> GetInstalledPlugins()
+        {
+            string url = ApiUrl + "/plugins";
+
+            using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
+            {
+                return DeserializeFromStream<PluginInfo[]>(stream);
+            }
+        }
+        
         /// <summary>
         /// Gets weather information for the default location as set in configuration
         /// </summary>

+ 1 - 1
MediaBrowser.Model/DTO/PluginInfo.cs

@@ -22,6 +22,6 @@ namespace MediaBrowser.Model.DTO
         public DateTime ConfigurationDateLastModified { get; set; }
 
         [ProtoMember(5)]
-        public Version Version { get; set; }
+        public string Version { get; set; }
     }
 }