diff options
| author | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-07-12 23:50:50 -0400 |
|---|---|---|
| committer | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-07-12 23:50:50 -0400 |
| commit | 5f5f2838b1931a2cf426b778755a417cc662b46f (patch) | |
| tree | 007597d0ba7bc2d992f909c9876744d80cc31b42 /MediaBrowser.Api/Plugin.cs | |
| parent | 572103cdfe9fdf15ac881a104537047b3ca928ea (diff) | |
moved the http server to common, added more http handlers
Diffstat (limited to 'MediaBrowser.Api/Plugin.cs')
| -rw-r--r-- | MediaBrowser.Api/Plugin.cs | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/MediaBrowser.Api/Plugin.cs b/MediaBrowser.Api/Plugin.cs index 3137978fe..471ddbddc 100644 --- a/MediaBrowser.Api/Plugin.cs +++ b/MediaBrowser.Api/Plugin.cs @@ -1,33 +1,29 @@ using System;
using System.Collections.Generic;
using System.Reactive.Linq;
+using MediaBrowser.Api.HttpHandlers;
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))));
- }
+ var httpServer = Kernel.Instance.HttpServer;
- public override void Dispose()
- {
- base.Dispose();
+ httpServer.Where(ctx => ctx.Request.Url.LocalPath.EndsWith("/api/item", StringComparison.OrdinalIgnoreCase)).Subscribe(ctx => ctx.Respond(new ItemHandler(ctx)));
+
+ httpServer.Where(ctx => ctx.Request.Url.LocalPath.EndsWith("/api/image", StringComparison.OrdinalIgnoreCase)).Subscribe(ctx => ctx.Respond(new ImageHandler(ctx)));
+
+ httpServer.Where(ctx => ctx.Request.Url.LocalPath.EndsWith("/api/genre", StringComparison.OrdinalIgnoreCase)).Subscribe(ctx => ctx.Respond(new GenreHandler(ctx)));
+
+ httpServer.Where(ctx => ctx.Request.Url.LocalPath.EndsWith("/api/genres", StringComparison.OrdinalIgnoreCase)).Subscribe(ctx => ctx.Respond(new GenresHandler(ctx)));
- foreach (var handler in HttpHandlers)
- {
- handler.Dispose();
- }
+ httpServer.Where(ctx => ctx.Request.Url.LocalPath.EndsWith("/api/recentlyaddeditems", StringComparison.OrdinalIgnoreCase)).Subscribe(ctx => ctx.Respond(new RecentlyAddedItemsHandler(ctx)));
- HttpHandlers.Clear();
+ httpServer.Where(ctx => ctx.Request.Url.LocalPath.EndsWith("/api/inprogressitems", StringComparison.OrdinalIgnoreCase)).Subscribe(ctx => ctx.Respond(new InProgressItemsHandler(ctx)));
}
}
}
|
