jellyfin-server/MediaBrowser.Api/HttpHandlers/PluginsHandler.cs

39 lines
1.2 KiB
C#
Raw Normal View History

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