diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs index a8e8f815a0..aef72c6972 100644 --- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs +++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Threading.Tasks; using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Plugins; using MediaBrowser.Common.Updates; @@ -92,18 +93,18 @@ namespace Emby.Server.Implementations.Activity _appHost.ApplicationUpdated += _appHost_ApplicationUpdated; } - void _deviceManager_CameraImageUploaded(object sender, GenericEventArgs e) + async void _deviceManager_CameraImageUploaded(object sender, GenericEventArgs e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("CameraImageUploadedFrom"), e.Argument.Device.Name), Type = NotificationType.CameraImageUploaded.ToString() }); } - void _userManager_UserLockedOut(object sender, GenericEventArgs e) + async void _userManager_UserLockedOut(object sender, GenericEventArgs e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("UserLockedOutWithName"), e.Argument.Name), Type = NotificationType.UserLockedOut.ToString(), @@ -111,9 +112,9 @@ namespace Emby.Server.Implementations.Activity }); } - void _subManager_SubtitleDownloadFailure(object sender, SubtitleDownloadFailureEventArgs e) + async void _subManager_SubtitleDownloadFailure(object sender, SubtitleDownloadFailureEventArgs e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("SubtitleDownloadFailureFromForItem"), e.Provider, Notifications.Notifications.GetItemName(e.Item)), Type = "SubtitleDownloadFailure", @@ -122,7 +123,7 @@ namespace Emby.Server.Implementations.Activity }); } - void _sessionManager_PlaybackStopped(object sender, PlaybackStopEventArgs e) + async void _sessionManager_PlaybackStopped(object sender, PlaybackStopEventArgs e) { var item = e.MediaInfo; @@ -145,7 +146,7 @@ namespace Emby.Server.Implementations.Activity var user = e.Users.First(); - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("UserStoppedPlayingItemWithValues"), user.Name, GetItemName(item), e.DeviceName), Type = GetPlaybackStoppedNotificationType(item.MediaType), @@ -153,7 +154,7 @@ namespace Emby.Server.Implementations.Activity }); } - void _sessionManager_PlaybackStart(object sender, PlaybackProgressEventArgs e) + async void _sessionManager_PlaybackStart(object sender, PlaybackProgressEventArgs e) { var item = e.MediaInfo; @@ -176,7 +177,7 @@ namespace Emby.Server.Implementations.Activity var user = e.Users.First(); - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("UserStartedPlayingItemWithValues"), user.Name, GetItemName(item), e.DeviceName), Type = GetPlaybackNotificationType(item.MediaType), @@ -237,7 +238,7 @@ namespace Emby.Server.Implementations.Activity return null; } - void _sessionManager_SessionEnded(object sender, SessionEventArgs e) + async void _sessionManager_SessionEnded(object sender, SessionEventArgs e) { string name; var session = e.SessionInfo; @@ -254,7 +255,7 @@ namespace Emby.Server.Implementations.Activity name = string.Format(_localization.GetLocalizedString("UserOfflineFromDevice"), session.UserName, session.DeviceName); } - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = name, Type = "SessionEnded", @@ -263,11 +264,11 @@ namespace Emby.Server.Implementations.Activity }); } - void _sessionManager_AuthenticationSucceeded(object sender, GenericEventArgs e) + async void _sessionManager_AuthenticationSucceeded(object sender, GenericEventArgs e) { var user = e.Argument.User; - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("AuthenticationSucceededWithUserName"), user.Name), Type = "AuthenticationSucceeded", @@ -276,9 +277,9 @@ namespace Emby.Server.Implementations.Activity }); } - void _sessionManager_AuthenticationFailed(object sender, GenericEventArgs e) + async void _sessionManager_AuthenticationFailed(object sender, GenericEventArgs e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("FailedLoginAttemptWithUserName"), e.Argument.Username), Type = "AuthenticationFailed", @@ -287,9 +288,9 @@ namespace Emby.Server.Implementations.Activity }); } - void _appHost_ApplicationUpdated(object sender, GenericEventArgs e) + async void _appHost_ApplicationUpdated(object sender, GenericEventArgs e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("MessageApplicationUpdatedTo"), e.Argument.versionStr), Type = NotificationType.ApplicationUpdateInstalled.ToString(), @@ -297,27 +298,27 @@ namespace Emby.Server.Implementations.Activity }); } - void _config_NamedConfigurationUpdated(object sender, ConfigurationUpdateEventArgs e) + async void _config_NamedConfigurationUpdated(object sender, ConfigurationUpdateEventArgs e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("MessageNamedServerConfigurationUpdatedWithValue"), e.Key), Type = "NamedConfigurationUpdated" }); } - void _config_ConfigurationUpdated(object sender, EventArgs e) + async void _config_ConfigurationUpdated(object sender, EventArgs e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = _localization.GetLocalizedString("MessageServerConfigurationUpdated"), Type = "ServerConfigurationUpdated" }); } - void _userManager_UserPolicyUpdated(object sender, GenericEventArgs e) + async void _userManager_UserPolicyUpdated(object sender, GenericEventArgs e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("UserPolicyUpdatedWithName"), e.Argument.Name), Type = "UserPolicyUpdated", @@ -325,18 +326,18 @@ namespace Emby.Server.Implementations.Activity }); } - void _userManager_UserDeleted(object sender, GenericEventArgs e) + async void _userManager_UserDeleted(object sender, GenericEventArgs e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("UserDeletedWithName"), e.Argument.Name), Type = "UserDeleted" }); } - void _userManager_UserPasswordChanged(object sender, GenericEventArgs e) + async void _userManager_UserPasswordChanged(object sender, GenericEventArgs e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("UserPasswordChangedWithName"), e.Argument.Name), Type = "UserPasswordChanged", @@ -344,9 +345,9 @@ namespace Emby.Server.Implementations.Activity }); } - void _userManager_UserCreated(object sender, GenericEventArgs e) + async void _userManager_UserCreated(object sender, GenericEventArgs e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("UserCreatedWithName"), e.Argument.Name), Type = "UserCreated", @@ -354,9 +355,9 @@ namespace Emby.Server.Implementations.Activity }); } - void _subManager_SubtitlesDownloaded(object sender, SubtitleDownloadEventArgs e) + async void _subManager_SubtitlesDownloaded(object sender, SubtitleDownloadEventArgs e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("SubtitlesDownloadedForItem"), Notifications.Notifications.GetItemName(e.Item)), Type = "SubtitlesDownloaded", @@ -365,7 +366,7 @@ namespace Emby.Server.Implementations.Activity }); } - void _sessionManager_SessionStarted(object sender, SessionEventArgs e) + async void _sessionManager_SessionStarted(object sender, SessionEventArgs e) { string name; var session = e.SessionInfo; @@ -382,7 +383,7 @@ namespace Emby.Server.Implementations.Activity name = string.Format(_localization.GetLocalizedString("UserOnlineFromDevice"), session.UserName, session.DeviceName); } - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = name, Type = "SessionStarted", @@ -391,9 +392,9 @@ namespace Emby.Server.Implementations.Activity }); } - void _installationManager_PluginUpdated(object sender, GenericEventArgs> e) + async void _installationManager_PluginUpdated(object sender, GenericEventArgs> e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("PluginUpdatedWithName"), e.Argument.Item1.Name), Type = NotificationType.PluginUpdateInstalled.ToString(), @@ -402,18 +403,18 @@ namespace Emby.Server.Implementations.Activity }); } - void _installationManager_PluginUninstalled(object sender, GenericEventArgs e) + async void _installationManager_PluginUninstalled(object sender, GenericEventArgs e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("PluginUninstalledWithName"), e.Argument.Name), Type = NotificationType.PluginUninstalled.ToString() }); } - void _installationManager_PluginInstalled(object sender, GenericEventArgs e) + async void _installationManager_PluginInstalled(object sender, GenericEventArgs e) { - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("PluginInstalledWithName"), e.Argument.name), Type = NotificationType.PluginInstalled.ToString(), @@ -421,11 +422,11 @@ namespace Emby.Server.Implementations.Activity }); } - void _installationManager_PackageInstallationFailed(object sender, InstallationFailedEventArgs e) + async void _installationManager_PackageInstallationFailed(object sender, InstallationFailedEventArgs e) { var installationInfo = e.InstallationInfo; - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("NameInstallFailed"), installationInfo.Name), Type = NotificationType.InstallationFailed.ToString(), @@ -434,7 +435,7 @@ namespace Emby.Server.Implementations.Activity }); } - void _taskManager_TaskCompleted(object sender, TaskCompletionEventArgs e) + async void _taskManager_TaskCompleted(object sender, TaskCompletionEventArgs e) { var result = e.Result; var task = e.Task; @@ -461,7 +462,7 @@ namespace Emby.Server.Implementations.Activity vals.Add(e.Result.LongErrorMessage); } - CreateLogEntry(new ActivityLogEntry + await CreateLogEntry(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("ScheduledTaskFailedWithName"), task.Name), Type = NotificationType.TaskFailed.ToString(), @@ -472,11 +473,11 @@ namespace Emby.Server.Implementations.Activity } } - private void CreateLogEntry(ActivityLogEntry entry) + private async Task CreateLogEntry(ActivityLogEntry entry) { try { - _activityManager.Create(entry); + await _activityManager.CreateAsync(entry); } catch { diff --git a/Emby.Server.Implementations/Activity/ActivityManager.cs b/Emby.Server.Implementations/Activity/ActivityManager.cs index e504bc4d73..8fcacb0024 100644 --- a/Emby.Server.Implementations/Activity/ActivityManager.cs +++ b/Emby.Server.Implementations/Activity/ActivityManager.cs @@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Activity _userManager = userManager; } - public async Task Create(ActivityLogEntry entry) + public async Task CreateAsync(ActivityLogEntry entry) { entry.Date = DateTime.UtcNow; diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 3562074fef..f5a4f15817 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -709,7 +709,7 @@ namespace Emby.Server.Implementations } } - public async Task Init() + public async Task InitAsync() { HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber; HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber; @@ -739,7 +739,7 @@ namespace Emby.Server.Implementations SetHttpLimit(); - await RegisterResources(); + await RegisterResourcesAsync(); FindParts(); } @@ -754,7 +754,7 @@ namespace Emby.Server.Implementations /// /// Registers resources that classes will depend on /// - protected async Task RegisterResources() + protected async Task RegisterResourcesAsync() { RegisterSingleInstance(ConfigurationManager); RegisterSingleInstance(this); @@ -931,7 +931,7 @@ namespace Emby.Server.Implementations EncodingManager = new MediaEncoder.EncodingManager(FileSystemManager, LoggerFactory, MediaEncoder, ChapterManager, LibraryManager); RegisterSingleInstance(EncodingManager); - var activityLogRepo = await GetActivityLogRepository(); + var activityLogRepo = await GetActivityLogRepositoryAsync(); RegisterSingleInstance(activityLogRepo); RegisterSingleInstance(new ActivityManager(LoggerFactory, activityLogRepo, UserManager)); @@ -1146,7 +1146,7 @@ namespace Emby.Server.Implementations return repo; } - private async Task GetActivityLogRepository() + private async Task GetActivityLogRepositoryAsync() { var repo = new ActivityRepository(ServerConfigurationManager.ApplicationPaths.DataPath); diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index bdf8c4e94a..2f14d1c52d 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -99,7 +99,7 @@ namespace Jellyfin.Server new SystemEvents(), new NetworkManager(_loggerFactory, environmentInfo))) { - await appHost.Init(); + await appHost.InitAsync(); appHost.ImageProcessor.ImageEncoder = GetImageEncoder(fileSystem, appPaths, appHost.LocalizationManager); diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index 12d807a7e2..d3009295f4 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -839,7 +839,7 @@ namespace MediaBrowser.Api.Library { try { - _activityManager.Create(new ActivityLogEntry + _activityManager.CreateAsync(new ActivityLogEntry { Name = string.Format(_localization.GetLocalizedString("UserDownloadingItemWithValues"), user.Name, item.Name), Type = "UserDownloadingContent", diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs index f32eec6ceb..9dc625e357 100644 --- a/MediaBrowser.Common/IApplicationHost.cs +++ b/MediaBrowser.Common/IApplicationHost.cs @@ -131,7 +131,7 @@ namespace MediaBrowser.Common /// /// Inits this instance. /// - Task Init(); + Task InitAsync(); /// /// Creates the instance. diff --git a/MediaBrowser.Model/Activity/IActivityManager.cs b/MediaBrowser.Model/Activity/IActivityManager.cs index 3cfd94695d..bbd7b6f2d6 100644 --- a/MediaBrowser.Model/Activity/IActivityManager.cs +++ b/MediaBrowser.Model/Activity/IActivityManager.cs @@ -9,7 +9,7 @@ namespace MediaBrowser.Model.Activity { event EventHandler> EntryCreated; - Task Create(ActivityLogEntry entry); + Task CreateAsync(ActivityLogEntry entry); IEnumerable GetActivityLogEntries(DateTime? minDate, bool? hasUserId, int? x, int? y); }