34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using Jellyfin.Plugin.Jellypod.Channels;
|
|
using Jellyfin.Plugin.Jellypod.Services;
|
|
using MediaBrowser.Controller;
|
|
using MediaBrowser.Controller.Channels;
|
|
using MediaBrowser.Controller.Plugins;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Jellyfin.Plugin.Jellypod;
|
|
|
|
/// <summary>
|
|
/// Registers plugin services with the dependency injection container.
|
|
/// </summary>
|
|
public class PluginServiceRegistrator : IPluginServiceRegistrator
|
|
{
|
|
/// <inheritdoc />
|
|
public void RegisterServices(IServiceCollection serviceCollection, IServerApplicationHost applicationHost)
|
|
{
|
|
// Register HTTP client
|
|
serviceCollection.AddHttpClient("Jellypod", client =>
|
|
{
|
|
client.DefaultRequestHeaders.Add("User-Agent", "Jellypod/1.0 (Jellyfin Podcast Plugin)");
|
|
client.Timeout = System.TimeSpan.FromMinutes(10);
|
|
});
|
|
|
|
// Register services
|
|
serviceCollection.AddSingleton<IRssFeedService, RssFeedService>();
|
|
serviceCollection.AddSingleton<IPodcastStorageService, PodcastStorageService>();
|
|
serviceCollection.AddSingleton<IPodcastDownloadService, PodcastDownloadService>();
|
|
|
|
// Register channel
|
|
serviceCollection.AddSingleton<IChannel, JellypodChannel>();
|
|
}
|
|
}
|