From 5fb369f3e6ba1989cc365058f098d77ddf1ab20d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 3 Apr 2013 14:43:49 -0400 Subject: [PATCH] add optional package filter and remove IUIPlugin interface --- MediaBrowser.Api/PackageService.cs | 18 ++++++++++++++---- MediaBrowser.Common/MediaBrowser.Common.csproj | 1 - MediaBrowser.Common/Plugins/BasePlugin.cs | 8 -------- MediaBrowser.Common/Plugins/IUIPlugin.cs | 16 ---------------- MediaBrowser.Model/Plugins/PluginInfo.cs | 7 ------- 5 files changed, 14 insertions(+), 36 deletions(-) delete mode 100644 MediaBrowser.Common/Plugins/IUIPlugin.cs diff --git a/MediaBrowser.Api/PackageService.cs b/MediaBrowser.Api/PackageService.cs index 742e26bc06..c80841a9ab 100644 --- a/MediaBrowser.Api/PackageService.cs +++ b/MediaBrowser.Api/PackageService.cs @@ -30,7 +30,7 @@ namespace MediaBrowser.Api /// Class GetPackages /// [Route("/Packages", "GET")] - [ServiceStack.ServiceHost.Api(("Gets available packages"))] + [Api(("Gets available packages"))] public class GetPackages : IReturn> { /// @@ -39,13 +39,16 @@ namespace MediaBrowser.Api /// The name. [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; } } /// /// Class GetPackageVersionUpdates /// [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> { /// @@ -60,7 +63,7 @@ namespace MediaBrowser.Api /// Class InstallPackage /// [Route("/Packages/Installed/{Name}", "POST")] - [ServiceStack.ServiceHost.Api(("Installs a package"))] + [Api(("Installs a package"))] public class InstallPackage : IReturnVoid { /// @@ -89,7 +92,7 @@ namespace MediaBrowser.Api /// Class CancelPackageInstallation /// [Route("/Packages/Installing/{Id}", "DELETE")] - [ServiceStack.ServiceHost.Api(("Cancels a package installation"))] + [Api(("Cancels a package installation"))] public class CancelPackageInstallation : IReturnVoid { /// @@ -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()); } diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index e9dda6bb77..b2553ce225 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -85,7 +85,6 @@ - True diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs index 9c4a8e8ffd..ebf1497f48 100644 --- a/MediaBrowser.Common/Plugins/BasePlugin.cs +++ b/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; } diff --git a/MediaBrowser.Common/Plugins/IUIPlugin.cs b/MediaBrowser.Common/Plugins/IUIPlugin.cs deleted file mode 100644 index c454b4da79..0000000000 --- a/MediaBrowser.Common/Plugins/IUIPlugin.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -namespace MediaBrowser.Common.Plugins -{ - /// - /// Interface IUIPlugin - /// - public interface IUIPlugin : IPlugin - { - /// - /// Gets the minimum required UI version. - /// - /// The minimum required UI version. - Version MinimumRequiredUIVersion { get; } - } -} diff --git a/MediaBrowser.Model/Plugins/PluginInfo.cs b/MediaBrowser.Model/Plugins/PluginInfo.cs index 4aa5f5a5c3..2df635db02 100644 --- a/MediaBrowser.Model/Plugins/PluginInfo.cs +++ b/MediaBrowser.Model/Plugins/PluginInfo.cs @@ -17,13 +17,6 @@ namespace MediaBrowser.Model.Plugins [ProtoMember(1)] public string Name { get; set; } - /// - /// Gets or sets a value indicating whether [download to UI]. - /// - /// true if [download to UI]; otherwise, false. - [ProtoMember(2)] - public bool DownloadToUI { get; set; } - /// /// Gets or sets the configuration date last modified. ///