EventingServiceCollectionExtensions.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using Jellyfin.Data.Events;
  2. using Jellyfin.Data.Events.Users;
  3. using Jellyfin.Server.Implementations.Events.Consumers;
  4. using Jellyfin.Server.Implementations.Events.Consumers.Library;
  5. using Jellyfin.Server.Implementations.Events.Consumers.Security;
  6. using Jellyfin.Server.Implementations.Events.Consumers.Session;
  7. using Jellyfin.Server.Implementations.Events.Consumers.Updates;
  8. using Jellyfin.Server.Implementations.Events.Consumers.Users;
  9. using MediaBrowser.Common.Updates;
  10. using MediaBrowser.Controller.Authentication;
  11. using MediaBrowser.Controller.Events;
  12. using MediaBrowser.Controller.Events.Session;
  13. using MediaBrowser.Controller.Events.Updates;
  14. using MediaBrowser.Controller.Library;
  15. using MediaBrowser.Controller.Session;
  16. using MediaBrowser.Controller.Subtitles;
  17. using MediaBrowser.Model.Tasks;
  18. using Microsoft.Extensions.DependencyInjection;
  19. namespace Jellyfin.Server.Implementations.Events
  20. {
  21. /// <summary>
  22. /// A class containing extensions to <see cref="IServiceCollection"/> for eventing.
  23. /// </summary>
  24. public static class EventingServiceCollectionExtensions
  25. {
  26. /// <summary>
  27. /// Adds the event services to the service collection.
  28. /// </summary>
  29. /// <param name="collection">The service collection.</param>
  30. public static void AddEventServices(this IServiceCollection collection)
  31. {
  32. collection.AddScoped<IEventConsumer<SubtitleDownloadFailureEventArgs>, SubtitleDownloadFailureLogger>();
  33. collection.AddScoped<IEventConsumer<GenericEventArgs<AuthenticationResult>>, AuthenticationSucceededLogger>();
  34. collection.AddScoped<IEventConsumer<GenericEventArgs<AuthenticationRequest>>, AuthenticationFailedLogger>();
  35. collection.AddScoped<IEventConsumer<PlaybackStartEventArgs>, PlaybackStartLogger>();
  36. collection.AddScoped<IEventConsumer<PlaybackStopEventArgs>, PlaybackStopLogger>();
  37. collection.AddScoped<IEventConsumer<SessionStartedEventArgs>, SessionStartedLogger>();
  38. collection.AddScoped<IEventConsumer<SessionEndedEventArgs>, SessionEndedLogger>();
  39. collection.AddScoped<IEventConsumer<PluginInstalledEventArgs>, PluginInstalledLogger>();
  40. collection.AddScoped<IEventConsumer<PluginUninstalledEventArgs>, PluginUninstalledLogger>();
  41. collection.AddScoped<IEventConsumer<PluginUpdatedEventArgs>, PluginUpdatedLogger>();
  42. collection.AddScoped<IEventConsumer<InstallationFailedEventArgs>, PackageInstallationFailedLogger>();
  43. collection.AddScoped<IEventConsumer<UserCreatedEventArgs>, UserCreatedLogger>();
  44. collection.AddScoped<IEventConsumer<UserDeletedEventArgs>, UserDeletedLogger>();
  45. collection.AddScoped<IEventConsumer<UserLockedOutEventArgs>, UserLockedOutLogger>();
  46. collection.AddScoped<IEventConsumer<UserPasswordChangedEventArgs>, UserPasswordChangedLogger>();
  47. collection.AddScoped<IEventConsumer<TaskCompletionEventArgs>, TaskCompletedLogger>();
  48. }
  49. }
  50. }