diff options
| author | BaronGreenback <jimcartlidge@yahoo.co.uk> | 2020-09-05 20:49:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-05 20:49:04 +0100 |
| commit | 8439860b2aa38f4f0e8fa243f8efaa9b5a0d0c0b (patch) | |
| tree | 577b5eb958178ccc71e74083cf9871c889ce09fe /Jellyfin.Server.Implementations/Events/EventingServiceCollectionExtensions.cs | |
| parent | e33824d28667df0344420d42032fbb01e9f8f659 (diff) | |
| parent | 9cffa66a015c5200e461f396cd408949591d9552 (diff) | |
Merge branch 'master' into Plugins
Diffstat (limited to 'Jellyfin.Server.Implementations/Events/EventingServiceCollectionExtensions.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/Events/EventingServiceCollectionExtensions.cs | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/Jellyfin.Server.Implementations/Events/EventingServiceCollectionExtensions.cs b/Jellyfin.Server.Implementations/Events/EventingServiceCollectionExtensions.cs new file mode 100644 index 000000000..5d558189b --- /dev/null +++ b/Jellyfin.Server.Implementations/Events/EventingServiceCollectionExtensions.cs @@ -0,0 +1,72 @@ +using Jellyfin.Data.Events; +using Jellyfin.Data.Events.System; +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; +using Jellyfin.Server.Implementations.Events.Consumers.System; +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) + { + // Library consumers + collection.AddScoped<IEventConsumer<SubtitleDownloadFailureEventArgs>, SubtitleDownloadFailureLogger>(); + + // Security consumers + collection.AddScoped<IEventConsumer<GenericEventArgs<AuthenticationRequest>>, AuthenticationFailedLogger>(); + collection.AddScoped<IEventConsumer<GenericEventArgs<AuthenticationResult>>, AuthenticationSucceededLogger>(); + + // Session consumers + collection.AddScoped<IEventConsumer<PlaybackStartEventArgs>, PlaybackStartLogger>(); + collection.AddScoped<IEventConsumer<PlaybackStopEventArgs>, PlaybackStopLogger>(); + collection.AddScoped<IEventConsumer<SessionEndedEventArgs>, SessionEndedLogger>(); + collection.AddScoped<IEventConsumer<SessionStartedEventArgs>, SessionStartedLogger>(); + + // 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>(); + collection.AddScoped<IEventConsumer<PluginInstalledEventArgs>, PluginInstalledLogger>(); + collection.AddScoped<IEventConsumer<PluginInstalledEventArgs>, PluginInstalledNotifier>(); + collection.AddScoped<IEventConsumer<PluginInstallingEventArgs>, PluginInstallingNotifier>(); + collection.AddScoped<IEventConsumer<PluginUninstalledEventArgs>, PluginUninstalledLogger>(); + collection.AddScoped<IEventConsumer<PluginUninstalledEventArgs>, PluginUninstalledNotifier>(); + collection.AddScoped<IEventConsumer<PluginUpdatedEventArgs>, PluginUpdatedLogger>(); + + // User consumers + collection.AddScoped<IEventConsumer<UserCreatedEventArgs>, UserCreatedLogger>(); + collection.AddScoped<IEventConsumer<UserDeletedEventArgs>, UserDeletedLogger>(); + collection.AddScoped<IEventConsumer<UserDeletedEventArgs>, UserDeletedNotifier>(); + collection.AddScoped<IEventConsumer<UserLockedOutEventArgs>, UserLockedOutLogger>(); + collection.AddScoped<IEventConsumer<UserPasswordChangedEventArgs>, UserPasswordChangedLogger>(); + collection.AddScoped<IEventConsumer<UserUpdatedEventArgs>, UserUpdatedNotifier>(); + } + } +} |
