2012-07-12 08:55:27 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Reactive.Linq;
|
2012-07-13 05:50:50 +02:00
|
|
|
|
using MediaBrowser.Api.HttpHandlers;
|
2012-07-12 08:55:27 +02:00
|
|
|
|
using MediaBrowser.Common.Plugins;
|
|
|
|
|
using MediaBrowser.Controller;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Api
|
|
|
|
|
{
|
|
|
|
|
public class Plugin : BasePlugin<BasePluginConfiguration>
|
|
|
|
|
{
|
|
|
|
|
protected override void InitInternal()
|
|
|
|
|
{
|
2012-07-13 05:50:50 +02:00
|
|
|
|
var httpServer = Kernel.Instance.HttpServer;
|
2012-07-12 08:55:27 +02:00
|
|
|
|
|
2012-07-13 05:50:50 +02:00
|
|
|
|
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)));
|
2012-07-12 08:55:27 +02:00
|
|
|
|
|
2012-07-13 05:50:50 +02:00
|
|
|
|
httpServer.Where(ctx => ctx.Request.Url.LocalPath.EndsWith("/api/recentlyaddeditems", StringComparison.OrdinalIgnoreCase)).Subscribe(ctx => ctx.Respond(new RecentlyAddedItemsHandler(ctx)));
|
2012-07-12 08:55:27 +02:00
|
|
|
|
|
2012-07-13 05:50:50 +02:00
|
|
|
|
httpServer.Where(ctx => ctx.Request.Url.LocalPath.EndsWith("/api/inprogressitems", StringComparison.OrdinalIgnoreCase)).Subscribe(ctx => ctx.Respond(new InProgressItemsHandler(ctx)));
|
2012-07-12 08:55:27 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|