mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-30 19:32:57 +01:00
Initial check-in
This commit is contained in:
33
MediaBrowser.Api/Plugin.cs
Normal file
33
MediaBrowser.Api/Plugin.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reactive.Linq;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Api.HttpHandlers;
|
||||
|
||||
namespace MediaBrowser.Api
|
||||
{
|
||||
public class Plugin : BasePlugin<BasePluginConfiguration>
|
||||
{
|
||||
List<IDisposable> HttpHandlers = new List<IDisposable>();
|
||||
|
||||
protected override void InitInternal()
|
||||
{
|
||||
HttpHandlers.Add(Kernel.Instance.HttpServer.Where(ctx => ctx.Request.Url.LocalPath.EndsWith("mediabrowser/api/item")).Subscribe(ctx => ctx.Respond(new ItemHandler(ctx))));
|
||||
HttpHandlers.Add(Kernel.Instance.HttpServer.Where(ctx => ctx.Request.Url.LocalPath.EndsWith("mediabrowser/api/image")).Subscribe(ctx => ctx.Respond(new ItemHandler(ctx))));
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
|
||||
foreach (var handler in HttpHandlers)
|
||||
{
|
||||
handler.Dispose();
|
||||
}
|
||||
|
||||
HttpHandlers.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user