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

38 lines
1.1 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Common.Net.Handlers;
using MediaBrowser.Controller;
using MediaBrowser.Model.DTO;
namespace MediaBrowser.Api.HttpHandlers
{
/// <summary>
/// Provides information about installed plugins
/// </summary>
2012-09-02 05:30:25 +00:00
public class PluginsHandler : BaseSerializationHandler<IEnumerable<PluginInfo>>
{
protected override Task<IEnumerable<PluginInfo>> GetObjectToSerialize()
{
2012-08-22 02:50:59 +00:00
var plugins = Kernel.Instance.Plugins.Select(p =>
{
2012-08-22 02:50:59 +00:00
return new PluginInfo()
{
2012-08-22 02:50:59 +00:00
Path = p.Path,
Name = p.Name,
Enabled = p.Enabled,
DownloadToUI = p.DownloadToUI,
Version = p.Version
};
});
2012-08-22 02:50:59 +00:00
if (QueryString["uionly"] == "1")
{
plugins = plugins.Where(p => p.DownloadToUI);
}
2012-08-22 02:50:59 +00:00
return Task.FromResult<IEnumerable<PluginInfo>>(plugins);
}
}
}