2012-09-08 14:52:13 +00:00
|
|
|
|
using MediaBrowser.Common.Net.Handlers;
|
2012-07-24 14:54:34 +00:00
|
|
|
|
using MediaBrowser.Controller;
|
2012-08-17 13:16:50 +00:00
|
|
|
|
using MediaBrowser.Model.DTO;
|
2012-09-08 14:52:13 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel.Composition;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Threading.Tasks;
|
2012-07-24 14:54:34 +00:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Api.HttpHandlers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provides information about installed plugins
|
|
|
|
|
/// </summary>
|
2012-09-08 14:52:13 +00:00
|
|
|
|
[Export(typeof(BaseHandler))]
|
2012-09-02 05:30:25 +00:00
|
|
|
|
public class PluginsHandler : BaseSerializationHandler<IEnumerable<PluginInfo>>
|
2012-07-24 14:54:34 +00:00
|
|
|
|
{
|
2012-09-08 14:52:13 +00:00
|
|
|
|
public override bool HandlesRequest(HttpListenerRequest request)
|
|
|
|
|
{
|
|
|
|
|
return ApiService.IsApiUrlMatch("plugins", request);
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-19 20:38:31 +00:00
|
|
|
|
protected override Task<IEnumerable<PluginInfo>> GetObjectToSerialize()
|
2012-07-24 14:54:34 +00:00
|
|
|
|
{
|
2012-08-22 02:50:59 +00:00
|
|
|
|
var plugins = Kernel.Instance.Plugins.Select(p =>
|
2012-07-24 14:54:34 +00:00
|
|
|
|
{
|
2012-08-22 02:50:59 +00:00
|
|
|
|
return new PluginInfo()
|
2012-07-24 14:54:34 +00:00
|
|
|
|
{
|
2012-08-22 02:50:59 +00:00
|
|
|
|
Name = p.Name,
|
|
|
|
|
Enabled = p.Enabled,
|
|
|
|
|
DownloadToUI = p.DownloadToUI,
|
2012-09-03 19:12:02 +00:00
|
|
|
|
Version = p.Version.ToString(),
|
2012-09-03 21:56:30 +00:00
|
|
|
|
AssemblyFileName = p.AssemblyFileName,
|
|
|
|
|
ConfigurationDateLastModified = p.ConfigurationDateLastModified
|
2012-08-22 02:50:59 +00:00
|
|
|
|
};
|
|
|
|
|
});
|
2012-07-24 14:54:34 +00:00
|
|
|
|
|
2012-08-22 02:50:59 +00:00
|
|
|
|
return Task.FromResult<IEnumerable<PluginInfo>>(plugins);
|
2012-07-24 14:54:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|