2
0
Эх сурвалжийг харах

add optional package filter and remove IUIPlugin interface

Luke Pulverenti 12 жил өмнө
parent
commit
5fb369f3e6

+ 14 - 4
MediaBrowser.Api/PackageService.cs

@@ -30,7 +30,7 @@ namespace MediaBrowser.Api
     /// Class GetPackages
     /// </summary>
     [Route("/Packages", "GET")]
-    [ServiceStack.ServiceHost.Api(("Gets available packages"))]
+    [Api(("Gets available packages"))]
     public class GetPackages : IReturn<List<PackageInfo>>
     {
         /// <summary>
@@ -39,13 +39,16 @@ namespace MediaBrowser.Api
         /// <value>The name.</value>
         [ApiMember(Name = "PackageType", Description = "Optional package type filter (System/UserInstalled)", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
         public PackageType? PackageType { get; set; }
+
+        [ApiMember(Name = "Applications", Description = "Optional. Filter by target system type. Allows multiple, comma delimited.", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET", AllowMultiple = true)]
+        public string Applications { get; set; }
     }
 
     /// <summary>
     /// Class GetPackageVersionUpdates
     /// </summary>
     [Route("/Packages/Updates", "GET")]
-    [ServiceStack.ServiceHost.Api(("Gets available package updates for currently installed packages"))]
+    [Api(("Gets available package updates for currently installed packages"))]
     public class GetPackageVersionUpdates : IReturn<List<PackageVersionInfo>>
     {
         /// <summary>
@@ -60,7 +63,7 @@ namespace MediaBrowser.Api
     /// Class InstallPackage
     /// </summary>
     [Route("/Packages/Installed/{Name}", "POST")]
-    [ServiceStack.ServiceHost.Api(("Installs a package"))]
+    [Api(("Installs a package"))]
     public class InstallPackage : IReturnVoid
     {
         /// <summary>
@@ -89,7 +92,7 @@ namespace MediaBrowser.Api
     /// Class CancelPackageInstallation
     /// </summary>
     [Route("/Packages/Installing/{Id}", "DELETE")]
-    [ServiceStack.ServiceHost.Api(("Cancels a package installation"))]
+    [Api(("Cancels a package installation"))]
     public class CancelPackageInstallation : IReturnVoid
     {
         /// <summary>
@@ -165,6 +168,13 @@ namespace MediaBrowser.Api
         {
             var packages = _installationManager.GetAvailablePackages(CancellationToken.None, request.PackageType, _appHost.ApplicationVersion).Result;
 
+            if (!string.IsNullOrEmpty(request.Applications))
+            {
+                var apps = request.Applications.Split(',').Select(i => (PackageTargetSystem)Enum.Parse(typeof(PackageTargetSystem), i, true));
+
+                packages = packages.Where(p => apps.Contains(p.targetSystem));
+            }
+
             return ToOptimizedResult(packages.ToList());
         }
 

+ 0 - 1
MediaBrowser.Common/MediaBrowser.Common.csproj

@@ -85,7 +85,6 @@
     <Compile Include="Net\MimeTypes.cs" />
     <Compile Include="Net\WebSocketConnectEventArgs.cs" />
     <Compile Include="Plugins\IPlugin.cs" />
-    <Compile Include="Plugins\IUIPlugin.cs" />
     <Compile Include="Progress\ActionableProgress.cs" />
     <Compile Include="Properties\Resources.Designer.cs">
       <AutoGen>True</AutoGen>

+ 0 - 8
MediaBrowser.Common/Plugins/BasePlugin.cs

@@ -299,7 +299,6 @@ namespace MediaBrowser.Common.Plugins
             var info = new PluginInfo
             {
                 Name = Name,
-                DownloadToUI = this is IUIPlugin,
                 Version = Version.ToString(),
                 AssemblyFileName = AssemblyFileName,
                 ConfigurationDateLastModified = ConfigurationDateLastModified,
@@ -310,13 +309,6 @@ namespace MediaBrowser.Common.Plugins
                 ConfigurationFileName = ConfigurationFileName
             };
 
-            var uiPlugin = this as IUIPlugin;
-
-            if (uiPlugin != null)
-            {
-                info.MinimumRequiredUIVersion = uiPlugin.MinimumRequiredUIVersion.ToString();
-            }
-
             return info;
         }
 

+ 0 - 16
MediaBrowser.Common/Plugins/IUIPlugin.cs

@@ -1,16 +0,0 @@
-using System;
-
-namespace MediaBrowser.Common.Plugins
-{
-    /// <summary>
-    /// Interface IUIPlugin
-    /// </summary>
-    public interface IUIPlugin : IPlugin
-    {
-        /// <summary>
-        /// Gets the minimum required UI version.
-        /// </summary>
-        /// <value>The minimum required UI version.</value>
-        Version MinimumRequiredUIVersion { get; }
-    }
-}

+ 0 - 7
MediaBrowser.Model/Plugins/PluginInfo.cs

@@ -17,13 +17,6 @@ namespace MediaBrowser.Model.Plugins
         [ProtoMember(1)]
         public string Name { get; set; }
 
-        /// <summary>
-        /// Gets or sets a value indicating whether [download to UI].
-        /// </summary>
-        /// <value><c>true</c> if [download to UI]; otherwise, <c>false</c>.</value>
-        [ProtoMember(2)]
-        public bool DownloadToUI { get; set; }
-
         /// <summary>
         /// Gets or sets the configuration date last modified.
         /// </summary>