From 77a5617774eaf20314a40620fcb0b63d4cb17963 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Wed, 6 Feb 2019 20:53:05 +0100 Subject: Removed remaining self-update code --- Emby.Notifications/CoreNotificationTypes.cs | 32 ++++++----------------------- Emby.Notifications/Notifications.cs | 4 ++-- 2 files changed, 8 insertions(+), 28 deletions(-) (limited to 'Emby.Notifications') diff --git a/Emby.Notifications/CoreNotificationTypes.cs b/Emby.Notifications/CoreNotificationTypes.cs index 8cc14fa012..0f9fc08d99 100644 --- a/Emby.Notifications/CoreNotificationTypes.cs +++ b/Emby.Notifications/CoreNotificationTypes.cs @@ -11,101 +11,81 @@ namespace Emby.Notifications public class CoreNotificationTypes : INotificationTypeFactory { private readonly ILocalizationManager _localization; - private readonly IServerApplicationHost _appHost; - public CoreNotificationTypes(ILocalizationManager localization, IServerApplicationHost appHost) + public CoreNotificationTypes(ILocalizationManager localization) { _localization = localization; - _appHost = appHost; } public IEnumerable GetNotificationTypes() { - var knownTypes = new List + var knownTypes = new NotificationTypeInfo[] { new NotificationTypeInfo { Type = NotificationType.ApplicationUpdateInstalled.ToString() }, - new NotificationTypeInfo { Type = NotificationType.InstallationFailed.ToString() }, - new NotificationTypeInfo { Type = NotificationType.PluginInstalled.ToString() }, - new NotificationTypeInfo { Type = NotificationType.PluginError.ToString() }, - new NotificationTypeInfo { Type = NotificationType.PluginUninstalled.ToString() }, - new NotificationTypeInfo { Type = NotificationType.PluginUpdateInstalled.ToString() }, - new NotificationTypeInfo { Type = NotificationType.ServerRestartRequired.ToString() }, - new NotificationTypeInfo { Type = NotificationType.TaskFailed.ToString() }, - new NotificationTypeInfo { Type = NotificationType.NewLibraryContent.ToString() }, - new NotificationTypeInfo { Type = NotificationType.AudioPlayback.ToString() }, - new NotificationTypeInfo { Type = NotificationType.VideoPlayback.ToString() }, - new NotificationTypeInfo { Type = NotificationType.AudioPlaybackStopped.ToString() }, - new NotificationTypeInfo { Type = NotificationType.VideoPlaybackStopped.ToString() }, - new NotificationTypeInfo { Type = NotificationType.CameraImageUploaded.ToString() }, - new NotificationTypeInfo { Type = NotificationType.UserLockedOut.ToString() - } - }; - - if (!_appHost.CanSelfUpdate) - { - knownTypes.Add(new NotificationTypeInfo + }, + new NotificationTypeInfo { Type = NotificationType.ApplicationUpdateAvailable.ToString() - }); - } + } + }; foreach (var type in knownTypes) { diff --git a/Emby.Notifications/Notifications.cs b/Emby.Notifications/Notifications.cs index d3290479f4..449331f9c4 100644 --- a/Emby.Notifications/Notifications.cs +++ b/Emby.Notifications/Notifications.cs @@ -65,7 +65,7 @@ namespace Emby.Notifications _localization = localization; _activityManager = activityManager; - _coreNotificationTypes = new CoreNotificationTypes(localization, appHost).GetNotificationTypes().Select(i => i.Type).ToArray(); + _coreNotificationTypes = new CoreNotificationTypes(localization).GetNotificationTypes().Select(i => i.Type).ToArray(); } public Task RunAsync() @@ -127,7 +127,7 @@ namespace Emby.Notifications async void _appHost_HasUpdateAvailableChanged(object sender, EventArgs e) { // This notification is for users who can't auto-update (aka running as service) - if (!_appHost.HasUpdateAvailable || _appHost.CanSelfUpdate) + if (!_appHost.HasUpdateAvailable) { return; } -- cgit v1.2.3 From 25253cf961e4309cef49612f1a729ab69507b604 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Wed, 6 Feb 2019 21:00:21 +0100 Subject: Fix style issues in changed files --- Emby.Notifications/Notifications.cs | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'Emby.Notifications') diff --git a/Emby.Notifications/Notifications.cs b/Emby.Notifications/Notifications.cs index 449331f9c4..7defd8510e 100644 --- a/Emby.Notifications/Notifications.cs +++ b/Emby.Notifications/Notifications.cs @@ -5,21 +5,17 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Updates; using MediaBrowser.Controller; -using MediaBrowser.Controller.Devices; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Notifications; using MediaBrowser.Controller.Plugins; -using MediaBrowser.Controller.Session; using MediaBrowser.Model.Activity; using MediaBrowser.Model.Events; using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Notifications; -using MediaBrowser.Model.Tasks; using Microsoft.Extensions.Logging; namespace Emby.Notifications @@ -29,39 +25,36 @@ namespace Emby.Notifications /// public class Notifications : IServerEntryPoint { - private readonly IInstallationManager _installationManager; - private readonly IUserManager _userManager; private readonly ILogger _logger; - private readonly ITaskManager _taskManager; private readonly INotificationManager _notificationManager; private readonly ILibraryManager _libraryManager; - private readonly ISessionManager _sessionManager; private readonly IServerApplicationHost _appHost; private Timer LibraryUpdateTimer { get; set; } private readonly object _libraryChangedSyncLock = new object(); private readonly IConfigurationManager _config; - private readonly IDeviceManager _deviceManager; private readonly ILocalizationManager _localization; private readonly IActivityManager _activityManager; private string[] _coreNotificationTypes; - public Notifications(IInstallationManager installationManager, IActivityManager activityManager, ILocalizationManager localization, IUserManager userManager, ILogger logger, ITaskManager taskManager, INotificationManager notificationManager, ILibraryManager libraryManager, ISessionManager sessionManager, IServerApplicationHost appHost, IConfigurationManager config, IDeviceManager deviceManager) + public Notifications( + IActivityManager activityManager, + ILocalizationManager localization, + ILogger logger, + INotificationManager notificationManager, + ILibraryManager libraryManager, + IServerApplicationHost appHost, + IConfigurationManager config) { - _installationManager = installationManager; - _userManager = userManager; _logger = logger; - _taskManager = taskManager; _notificationManager = notificationManager; _libraryManager = libraryManager; - _sessionManager = sessionManager; _appHost = appHost; _config = config; - _deviceManager = deviceManager; _localization = localization; _activityManager = activityManager; @@ -124,7 +117,7 @@ namespace Emby.Notifications return _config.GetConfiguration("notifications"); } - async void _appHost_HasUpdateAvailableChanged(object sender, EventArgs e) + private async void _appHost_HasUpdateAvailableChanged(object sender, EventArgs e) { // This notification is for users who can't auto-update (aka running as service) if (!_appHost.HasUpdateAvailable) @@ -145,7 +138,7 @@ namespace Emby.Notifications } private readonly List _itemsAdded = new List(); - void _libraryManager_ItemAdded(object sender, ItemChangeEventArgs e) + private void _libraryManager_ItemAdded(object sender, ItemChangeEventArgs e) { if (!FilterItem(e.Item)) { -- cgit v1.2.3 From 7554f6355195443b721a9b65f04ef4f9f4c097e9 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sat, 9 Feb 2019 15:55:23 +0100 Subject: Remove more self-update code --- Emby.Notifications/Notifications.cs | 1 - MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs | 16 ++-------------- .../Configuration/BaseApplicationConfiguration.cs | 15 --------------- 3 files changed, 2 insertions(+), 30 deletions(-) (limited to 'Emby.Notifications') diff --git a/Emby.Notifications/Notifications.cs b/Emby.Notifications/Notifications.cs index 7defd8510e..ec08fd1935 100644 --- a/Emby.Notifications/Notifications.cs +++ b/Emby.Notifications/Notifications.cs @@ -119,7 +119,6 @@ namespace Emby.Notifications private async void _appHost_HasUpdateAvailableChanged(object sender, EventArgs e) { - // This notification is for users who can't auto-update (aka running as service) if (!_appHost.HasUpdateAvailable) { return; diff --git a/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs b/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs index 16b036912c..b7e94b73f2 100644 --- a/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs +++ b/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs @@ -197,16 +197,6 @@ namespace MediaBrowser.Api.ScheduledTasks throw new ResourceNotFoundException("Task not found"); } - if (string.Equals(task.ScheduledTask.Key, "SystemUpdateTask", StringComparison.OrdinalIgnoreCase)) - { - // This is a hack for now just to get the update application function to work when auto-update is disabled - if (!_config.Configuration.EnableAutoUpdate) - { - _config.Configuration.EnableAutoUpdate = true; - _config.SaveConfiguration(); - } - } - TaskManager.Execute(task, new TaskOptions()); } @@ -238,16 +228,14 @@ namespace MediaBrowser.Api.ScheduledTasks // https://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Text/ServiceStack.Text/Controller/PathInfo.cs var id = GetPathValue(1); - var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, id)); + var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, id, StringComparison.Ordinal)); if (task == null) { throw new ResourceNotFoundException("Task not found"); } - var triggerInfos = request; - - task.Triggers = triggerInfos.ToArray(); + task.Triggers = request.ToArray(); } } } diff --git a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs b/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs index ce4ef1cfe4..6a1a0f0901 100644 --- a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs +++ b/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs @@ -7,20 +7,6 @@ namespace MediaBrowser.Model.Configuration /// public class BaseApplicationConfiguration { - // TODO: @bond Remove? - /// - /// Gets or sets a value indicating whether [enable debug level logging]. - /// - /// true if [enable debug level logging]; otherwise, false. - public bool EnableDebugLevelLogging { get; set; } - - /// - /// Enable automatically and silently updating of the application - /// - /// true if [enable auto update]; otherwise, false. - public bool EnableAutoUpdate { get; set; } - - // TODO: @bond Remove? /// /// The number of days we should retain log files /// @@ -44,7 +30,6 @@ namespace MediaBrowser.Model.Configuration /// public BaseApplicationConfiguration() { - EnableAutoUpdate = true; LogFileRetentionDays = 3; } } -- cgit v1.2.3