2020-08-15 12:56:47 -07:00
|
|
|
|
using Jellyfin.Data.Events;
|
2020-08-17 18:47:49 -07:00
|
|
|
|
using Jellyfin.Data.Events.System;
|
2020-08-15 12:56:47 -07:00
|
|
|
|
using Jellyfin.Data.Events.Users;
|
|
|
|
|
using Jellyfin.Server.Implementations.Events.Consumers.Library;
|
|
|
|
|
using Jellyfin.Server.Implementations.Events.Consumers.Security;
|
|
|
|
|
using Jellyfin.Server.Implementations.Events.Consumers.Session;
|
2020-08-15 15:16:20 -07:00
|
|
|
|
using Jellyfin.Server.Implementations.Events.Consumers.System;
|
2020-08-15 12:56:47 -07:00
|
|
|
|
using Jellyfin.Server.Implementations.Events.Consumers.Updates;
|
|
|
|
|
using Jellyfin.Server.Implementations.Events.Consumers.Users;
|
|
|
|
|
using MediaBrowser.Common.Updates;
|
|
|
|
|
using MediaBrowser.Controller.Authentication;
|
|
|
|
|
using MediaBrowser.Controller.Events;
|
|
|
|
|
using MediaBrowser.Controller.Events.Session;
|
|
|
|
|
using MediaBrowser.Controller.Events.Updates;
|
|
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
|
using MediaBrowser.Controller.Session;
|
|
|
|
|
using MediaBrowser.Controller.Subtitles;
|
|
|
|
|
using MediaBrowser.Model.Tasks;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace Jellyfin.Server.Implementations.Events
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A class containing extensions to <see cref="IServiceCollection"/> for eventing.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class EventingServiceCollectionExtensions
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Adds the event services to the service collection.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="collection">The service collection.</param>
|
|
|
|
|
public static void AddEventServices(this IServiceCollection collection)
|
|
|
|
|
{
|
2020-08-17 18:47:49 -07:00
|
|
|
|
// Library consumers
|
2020-08-15 12:56:47 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<SubtitleDownloadFailureEventArgs>, SubtitleDownloadFailureLogger>();
|
|
|
|
|
|
2020-08-17 18:47:49 -07:00
|
|
|
|
// Security consumers
|
2020-08-15 12:56:47 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<GenericEventArgs<AuthenticationRequest>>, AuthenticationFailedLogger>();
|
2020-08-17 18:47:49 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<GenericEventArgs<AuthenticationResult>>, AuthenticationSucceededLogger>();
|
2020-08-15 12:56:47 -07:00
|
|
|
|
|
2020-08-17 18:47:49 -07:00
|
|
|
|
// Session consumers
|
2020-08-15 12:56:47 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<PlaybackStartEventArgs>, PlaybackStartLogger>();
|
|
|
|
|
collection.AddScoped<IEventConsumer<PlaybackStopEventArgs>, PlaybackStopLogger>();
|
|
|
|
|
collection.AddScoped<IEventConsumer<SessionEndedEventArgs>, SessionEndedLogger>();
|
2020-08-17 18:47:49 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<SessionStartedEventArgs>, SessionStartedLogger>();
|
2020-08-15 12:56:47 -07:00
|
|
|
|
|
2020-08-17 18:47:49 -07:00
|
|
|
|
// System consumers
|
|
|
|
|
collection.AddScoped<IEventConsumer<PendingRestartEventArgs>, PendingRestartNotifier>();
|
|
|
|
|
collection.AddScoped<IEventConsumer<TaskCompletionEventArgs>, TaskCompletedLogger>();
|
|
|
|
|
collection.AddScoped<IEventConsumer<TaskCompletionEventArgs>, TaskCompletedNotifier>();
|
|
|
|
|
|
|
|
|
|
// Update consumers
|
|
|
|
|
collection.AddScoped<IEventConsumer<PluginInstallationCancelledEventArgs>, PluginInstallationCancelledNotifier>();
|
|
|
|
|
collection.AddScoped<IEventConsumer<InstallationFailedEventArgs>, PluginInstallationFailedLogger>();
|
|
|
|
|
collection.AddScoped<IEventConsumer<InstallationFailedEventArgs>, PluginInstallationFailedNotifier>();
|
2020-08-15 12:56:47 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<PluginInstalledEventArgs>, PluginInstalledLogger>();
|
2020-08-15 20:27:51 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<PluginInstalledEventArgs>, PluginInstalledNotifier>();
|
2020-08-17 18:47:49 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<PluginInstallingEventArgs>, PluginInstallingNotifier>();
|
2020-08-15 12:56:47 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<PluginUninstalledEventArgs>, PluginUninstalledLogger>();
|
2020-08-15 20:27:51 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<PluginUninstalledEventArgs>, PluginUninstalledNotifier>();
|
2020-08-15 12:56:47 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<PluginUpdatedEventArgs>, PluginUpdatedLogger>();
|
|
|
|
|
|
2020-08-17 18:47:49 -07:00
|
|
|
|
// User consumers
|
2020-08-15 12:56:47 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<UserCreatedEventArgs>, UserCreatedLogger>();
|
|
|
|
|
collection.AddScoped<IEventConsumer<UserDeletedEventArgs>, UserDeletedLogger>();
|
2020-08-15 15:16:20 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<UserDeletedEventArgs>, UserDeletedNotifier>();
|
2020-08-15 12:56:47 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<UserLockedOutEventArgs>, UserLockedOutLogger>();
|
|
|
|
|
collection.AddScoped<IEventConsumer<UserPasswordChangedEventArgs>, UserPasswordChangedLogger>();
|
2020-08-17 18:47:49 -07:00
|
|
|
|
collection.AddScoped<IEventConsumer<UserUpdatedEventArgs>, UserUpdatedNotifier>();
|
2020-08-15 12:56:47 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|