From a709cbdc64de36a1ce989636a19344af61d9026d Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sun, 27 Jan 2019 12:03:43 +0100 Subject: Fix more analyzer warnings --- Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs | 2 +- Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'Emby.Server.Implementations/LiveTv') diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 4805e54dd..2572a1254 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -2193,7 +2193,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV if (lockData) { - writer.WriteElementString("lockdata", true.ToString().ToLower()); + writer.WriteElementString("lockdata", true.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()); } if (item.CriticRating.HasValue) diff --git a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs index 724e8afdf..1144c9ab1 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -399,7 +399,7 @@ namespace Emby.Server.Implementations.LiveTv { var name = serviceName + externalId + InternalVersionNumber; - return _libraryManager.GetNewItemId(name.ToLower(), typeof(LiveTvChannel)); + return _libraryManager.GetNewItemId(name.ToLowerInvariant(), typeof(LiveTvChannel)); } private const string ServiceName = "Emby"; @@ -407,21 +407,21 @@ namespace Emby.Server.Implementations.LiveTv { var name = ServiceName + externalId + InternalVersionNumber; - return name.ToLower().GetMD5().ToString("N"); + return name.ToLowerInvariant().GetMD5().ToString("N"); } public Guid GetInternalSeriesTimerId(string externalId) { var name = ServiceName + externalId + InternalVersionNumber; - return name.ToLower().GetMD5(); + return name.ToLowerInvariant().GetMD5(); } public Guid GetInternalProgramId(string externalId) { var name = ServiceName + externalId + InternalVersionNumber; - return _libraryManager.GetNewItemId(name.ToLower(), typeof(LiveTvProgram)); + return _libraryManager.GetNewItemId(name.ToLowerInvariant(), typeof(LiveTvProgram)); } public async Task GetTimerInfo(TimerInfoDto dto, bool isNew, LiveTvManager liveTv, CancellationToken cancellationToken) -- cgit v1.2.3 From 85a58fd655240fd0ddd10bdaaad4a9bb8cd7051d Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sun, 27 Jan 2019 15:40:37 +0100 Subject: Start startup tasks async --- Emby.Dlna/DlnaManager.cs | 9 +++--- Emby.Dlna/Main/DlnaEntryPoint.cs | 4 +-- Emby.Notifications/Notifications.cs | 4 ++- .../Activity/ActivityLogEntryPoint.cs | 5 +++- Emby.Server.Implementations/ApplicationHost.cs | 35 +++++++++------------- .../Collections/CollectionManager.cs | 2 +- .../Devices/DeviceManager.cs | 2 +- .../EntryPoints/AutomaticRestartEntryPoint.cs | 4 ++- .../EntryPoints/ExternalPortForwarding.cs | 8 +++-- .../EntryPoints/LibraryChangedNotifier.cs | 5 +++- .../EntryPoints/RecordingNotifier.cs | 5 +++- .../EntryPoints/ServerEventNotifier.cs | 5 +++- .../EntryPoints/StartupWizard.cs | 7 +++-- .../EntryPoints/UdpServerEntryPoint.cs | 5 +++- .../EntryPoints/UserDataChangeNotifier.cs | 4 ++- Emby.Server.Implementations/IO/LibraryMonitor.cs | 3 +- Emby.Server.Implementations/Library/UserManager.cs | 4 ++- .../LiveTv/EmbyTV/EmbyTV.cs | 2 +- .../LiveTv/EmbyTV/EntryPoint.cs | 5 ++-- Jellyfin.Server/Program.cs | 4 --- MediaBrowser.Api/ApiEntryPoint.cs | 7 +++-- .../Plugins/IServerEntryPoint.cs | 3 +- MediaBrowser.WebDashboard/Api/DashboardService.cs | 6 ++-- MediaBrowser.WebDashboard/ServerEntryPoint.cs | 5 +++- MediaBrowser.XbmcMetadata/EntryPoint.cs | 5 +++- 25 files changed, 87 insertions(+), 61 deletions(-) (limited to 'Emby.Server.Implementations/LiveTv') diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs index f795b58cb..3be596865 100644 --- a/Emby.Dlna/DlnaManager.cs +++ b/Emby.Dlna/DlnaManager.cs @@ -4,6 +4,7 @@ using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; +using System.Threading.Tasks; using Emby.Dlna.Profiles; using Emby.Dlna.Server; using MediaBrowser.Common.Configuration; @@ -48,11 +49,11 @@ namespace Emby.Dlna _assemblyInfo = assemblyInfo; } - public void InitProfiles() + public async Task InitProfilesAsync() { try { - ExtractSystemProfiles(); + await ExtractSystemProfilesAsync(); LoadProfiles(); } catch (Exception ex) @@ -359,7 +360,7 @@ namespace Emby.Dlna }; } - private void ExtractSystemProfiles() + private async Task ExtractSystemProfilesAsync() { var namespaceName = GetType().Namespace + ".Profiles.Xml."; @@ -383,7 +384,7 @@ namespace Emby.Dlna using (var fileStream = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) { - stream.CopyTo(fileStream); + await stream.CopyToAsync(fileStream); } } } diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs index 1ab6014eb..89cba4c47 100644 --- a/Emby.Dlna/Main/DlnaEntryPoint.cs +++ b/Emby.Dlna/Main/DlnaEntryPoint.cs @@ -125,9 +125,9 @@ namespace Emby.Dlna.Main Current = this; } - public void Run() + public async Task RunAsync() { - ((DlnaManager)_dlnaManager).InitProfiles(); + await ((DlnaManager)_dlnaManager).InitProfilesAsync().ConfigureAwait(false); ReloadComponents(); diff --git a/Emby.Notifications/Notifications.cs b/Emby.Notifications/Notifications.cs index fbdc39f94..045aa6f16 100644 --- a/Emby.Notifications/Notifications.cs +++ b/Emby.Notifications/Notifications.cs @@ -71,12 +71,14 @@ namespace Emby.Notifications _coreNotificationTypes = new CoreNotificationTypes(localization, appHost).GetNotificationTypes().Select(i => i.Type).ToArray(); } - public void Run() + public Task RunAsync() { _libraryManager.ItemAdded += _libraryManager_ItemAdded; _appHost.HasPendingRestartChanged += _appHost_HasPendingRestartChanged; _appHost.HasUpdateAvailableChanged += _appHost_HasUpdateAvailableChanged; _activityManager.EntryCreated += _activityManager_EntryCreated; + + return Task.CompletedTask; } private async void _appHost_HasPendingRestartChanged(object sender, EventArgs e) diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs index a8e8f815a..9cdb3b1b5 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; @@ -58,7 +59,7 @@ namespace Emby.Server.Implementations.Activity _deviceManager = deviceManager; } - public void Run() + public Task RunAsync() { _taskManager.TaskCompleted += _taskManager_TaskCompleted; @@ -90,6 +91,8 @@ namespace Emby.Server.Implementations.Activity _deviceManager.CameraImageUploaded += _deviceManager_CameraImageUploaded; _appHost.ApplicationUpdated += _appHost_ApplicationUpdated; + + return Task.CompletedTask; } void _deviceManager_CameraImageUploaded(object sender, GenericEventArgs e) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index f0a914922..c71b917b8 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -647,8 +647,10 @@ namespace Emby.Server.Implementations /// /// Runs the startup tasks. /// - public Task RunStartupTasks() + public async Task RunStartupTasks() { + Logger.LogInformation("Running startup tasks"); + Resolve().AddTasks(GetExports(false)); ConfigurationManager.ConfigurationUpdated += OnConfigurationUpdated; @@ -667,20 +669,20 @@ namespace Emby.Server.Implementations Logger.LogInformation("ServerId: {0}", SystemId); var entryPoints = GetExports(); - RunEntryPoints(entryPoints, true); + + var now = DateTime.UtcNow; + await Task.WhenAll(StartEntryPoints(entryPoints, true)); + Logger.LogInformation("Executed all pre-startup entry points in {Elapsed:fff} ms", DateTime.Now - now); Logger.LogInformation("Core startup complete"); HttpServer.GlobalResponse = null; - Logger.LogInformation("Post-init migrations complete"); - - RunEntryPoints(entryPoints, false); - Logger.LogInformation("All entry points have started"); - - return Task.CompletedTask; + now = DateTime.UtcNow; + await Task.WhenAll(StartEntryPoints(entryPoints, false)); + Logger.LogInformation("Executed all post-startup entry points in {Elapsed:fff} ms", DateTime.Now - now); } - private void RunEntryPoints(IEnumerable entryPoints, bool isBeforeStartup) + private IEnumerable StartEntryPoints(IEnumerable entryPoints, bool isBeforeStartup) { foreach (var entryPoint in entryPoints) { @@ -689,18 +691,9 @@ namespace Emby.Server.Implementations continue; } - var name = entryPoint.GetType().FullName; - Logger.LogInformation("Starting entry point {Name}", name); - var now = DateTime.UtcNow; - try - { - entryPoint.Run(); - } - catch (Exception ex) - { - Logger.LogError(ex, "Error while running entrypoint {Name}", name); - } - Logger.LogInformation("Entry point completed: {Name}. Duration: {Duration} seconds", name, (DateTime.UtcNow - now).TotalSeconds.ToString(CultureInfo.InvariantCulture), "ImageInfos"); + Logger.LogDebug("Starting entry point {Type}", entryPoint.GetType()); + + yield return entryPoint.RunAsync(); } } diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.cs index 0166bbc5a..7268811f8 100644 --- a/Emby.Server.Implementations/Collections/CollectionManager.cs +++ b/Emby.Server.Implementations/Collections/CollectionManager.cs @@ -353,7 +353,7 @@ namespace Emby.Server.Implementations.Collections _logger = logger; } - public async void Run() + public async Task RunAsync() { if (!_config.Configuration.CollectionsUpgraded && _config.Configuration.IsStartupWizardCompleted) { diff --git a/Emby.Server.Implementations/Devices/DeviceManager.cs b/Emby.Server.Implementations/Devices/DeviceManager.cs index 60d57519e..46d36f9f6 100644 --- a/Emby.Server.Implementations/Devices/DeviceManager.cs +++ b/Emby.Server.Implementations/Devices/DeviceManager.cs @@ -425,7 +425,7 @@ namespace Emby.Server.Implementations.Devices _logger = logger; } - public async void Run() + public async Task RunAsync() { if (!_config.Configuration.CameraUploadUpgraded && _config.Configuration.IsStartupWizardCompleted) { diff --git a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs index 0fc4c3858..361656ff2 100644 --- a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs +++ b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs @@ -37,12 +37,14 @@ namespace Emby.Server.Implementations.EntryPoints _timerFactory = timerFactory; } - public void Run() + public Task RunAsync() { if (_appHost.CanSelfRestart) { _appHost.HasPendingRestartChanged += _appHost_HasPendingRestartChanged; } + + return Task.CompletedTask; } void _appHost_HasPendingRestartChanged(object sender, EventArgs e) diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs index 8755ee3a7..56c730c80 100644 --- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs +++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs @@ -61,17 +61,17 @@ namespace Emby.Server.Implementations.EntryPoints return string.Join("|", values.ToArray()); } - void _config_ConfigurationUpdated(object sender, EventArgs e) + private async void _config_ConfigurationUpdated(object sender, EventArgs e) { if (!string.Equals(_lastConfigIdentifier, GetConfigIdentifier(), StringComparison.OrdinalIgnoreCase)) { DisposeNat(); - Run(); + await RunAsync(); } } - public void Run() + public Task RunAsync() { if (_config.Configuration.EnableUPnP && _config.Configuration.EnableRemoteAccess) { @@ -80,6 +80,8 @@ namespace Emby.Server.Implementations.EntryPoints _config.ConfigurationUpdated -= _config_ConfigurationUpdated; _config.ConfigurationUpdated += _config_ConfigurationUpdated; + + return Task.CompletedTask; } private void Start() diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs index 7a8b09cf7..98c08e6ba 100644 --- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Threading; +using System.Threading.Tasks; using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; @@ -65,7 +66,7 @@ namespace Emby.Server.Implementations.EntryPoints _providerManager = providerManager; } - public void Run() + public Task RunAsync() { _libraryManager.ItemAdded += libraryManager_ItemAdded; _libraryManager.ItemUpdated += libraryManager_ItemUpdated; @@ -74,6 +75,8 @@ namespace Emby.Server.Implementations.EntryPoints _providerManager.RefreshCompleted += _providerManager_RefreshCompleted; _providerManager.RefreshStarted += _providerManager_RefreshStarted; _providerManager.RefreshProgress += _providerManager_RefreshProgress; + + return Task.CompletedTask; } private Dictionary _lastProgressMessageTimes = new Dictionary(); diff --git a/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs b/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs index e37ea96a1..0186da9e1 100644 --- a/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using System.Threading; +using System.Threading.Tasks; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Plugins; @@ -24,12 +25,14 @@ namespace Emby.Server.Implementations.EntryPoints _liveTvManager = liveTvManager; } - public void Run() + public Task RunAsync() { _liveTvManager.TimerCancelled += _liveTvManager_TimerCancelled; _liveTvManager.SeriesTimerCancelled += _liveTvManager_SeriesTimerCancelled; _liveTvManager.TimerCreated += _liveTvManager_TimerCreated; _liveTvManager.SeriesTimerCreated += _liveTvManager_SeriesTimerCreated; + + return Task.CompletedTask; } private void _liveTvManager_SeriesTimerCreated(object sender, MediaBrowser.Model.Events.GenericEventArgs e) diff --git a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs b/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs index 92ea3a8f4..091dd6a45 100644 --- a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading; +using System.Threading.Tasks; using MediaBrowser.Common.Plugins; using MediaBrowser.Common.Updates; using MediaBrowser.Controller; @@ -49,7 +50,7 @@ namespace Emby.Server.Implementations.EntryPoints _sessionManager = sessionManager; } - public void Run() + public Task RunAsync() { _userManager.UserDeleted += userManager_UserDeleted; _userManager.UserUpdated += userManager_UserUpdated; @@ -65,6 +66,8 @@ namespace Emby.Server.Implementations.EntryPoints _installationManager.PackageInstallationFailed += _installationManager_PackageInstallationFailed; _taskManager.TaskCompleted += _taskManager_TaskCompleted; + + return Task.CompletedTask; } void _installationManager_PackageInstalling(object sender, InstallationEventArgs e) diff --git a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs index 05c8b07ab..1d44bffbb 100644 --- a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs +++ b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs @@ -1,3 +1,4 @@ +using System.Threading.Tasks; using Emby.Server.Implementations.Browser; using MediaBrowser.Controller; using MediaBrowser.Controller.Configuration; @@ -32,11 +33,11 @@ namespace Emby.Server.Implementations.EntryPoints /// /// Runs this instance. /// - public void Run() + public Task RunAsync() { if (!_appHost.CanLaunchWebBrowser) { - return; + return Task.CompletedTask; } if (!_config.Configuration.IsStartupWizardCompleted) @@ -52,6 +53,8 @@ namespace Emby.Server.Implementations.EntryPoints BrowserLauncher.OpenWebApp(_appHost); } } + + return Task.CompletedTask; } /// diff --git a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs index 2c8246d13..5b90dc1fb 100644 --- a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs +++ b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; using Emby.Server.Implementations.Udp; using MediaBrowser.Controller; using MediaBrowser.Controller.Plugins; @@ -43,7 +44,7 @@ namespace Emby.Server.Implementations.EntryPoints /// /// Runs this instance. /// - public void Run() + public Task RunAsync() { var udpServer = new UdpServer(_logger, _appHost, _json, _socketFactory); @@ -57,6 +58,8 @@ namespace Emby.Server.Implementations.EntryPoints { _logger.LogError(ex, "Failed to start UDP Server"); } + + return Task.CompletedTask; } /// diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs index 9e71ffceb..d1d05eeb0 100644 --- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs @@ -38,9 +38,11 @@ namespace Emby.Server.Implementations.EntryPoints _timerFactory = timerFactory; } - public void Run() + public Task RunAsync() { _userDataManager.UserDataSaved += _userDataManager_UserDataSaved; + + return Task.CompletedTask; } void _userDataManager_UserDataSaved(object sender, UserDataSaveEventArgs e) diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs index 204f9d949..e432b31da 100644 --- a/Emby.Server.Implementations/IO/LibraryMonitor.cs +++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs @@ -627,9 +627,10 @@ namespace Emby.Server.Implementations.IO _monitor = monitor; } - public void Run() + public Task RunAsync() { _monitor.Start(); + return Task.CompletedTask; } public void Dispose() diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs index 6139659b7..6e4450bb1 100644 --- a/Emby.Server.Implementations/Library/UserManager.cs +++ b/Emby.Server.Implementations/Library/UserManager.cs @@ -1204,9 +1204,11 @@ namespace Emby.Server.Implementations.Library _sessionManager = sessionManager; } - public void Run() + public Task RunAsync() { _userManager.UserPolicyUpdated += _userManager_UserPolicyUpdated; + + return Task.CompletedTask; } private void _userManager_UserPolicyUpdated(object sender, GenericEventArgs e) diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 4805e54dd..4e131c941 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -124,7 +124,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV } } - public async void Start() + public async Task Start() { _timerProvider.RestartTimers(); diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs index 982a54b68..9c9ba09f5 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs @@ -1,12 +1,13 @@ +using System.Threading.Tasks; using MediaBrowser.Controller.Plugins; namespace Emby.Server.Implementations.LiveTv.EmbyTV { public class EntryPoint : IServerEntryPoint { - public void Run() + public Task RunAsync() { - EmbyTV.Current.Start(); + return EmbyTV.Current.Start(); } public void Dispose() diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 66586d4e4..4dfe83441 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -103,8 +103,6 @@ namespace Jellyfin.Server appHost.ImageProcessor.ImageEncoder = GetImageEncoder(fileSystem, appPaths, appHost.LocalizationManager); - _logger.LogInformation("Running startup tasks"); - await appHost.RunStartupTasks(); // TODO: read input for a stop command @@ -118,8 +116,6 @@ namespace Jellyfin.Server { // Don't throw on cancellation } - - _logger.LogInformation("Disposing app host"); } if (_restartOnShutdown) diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index 8ae0ad942..cfd37667a 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -130,7 +130,7 @@ namespace MediaBrowser.Api /// /// Runs this instance. /// - public void Run() + public Task RunAsync() { try { @@ -148,6 +148,8 @@ namespace MediaBrowser.Api { Logger.LogError(ex, "Error deleting encoded media cache"); } + + return Task.CompletedTask; } public EncodingOptions GetEncodingOptions() @@ -162,8 +164,7 @@ namespace MediaBrowser.Api { var path = _config.ApplicationPaths.TranscodingTempPath; - foreach (var file in _fileSystem.GetFilePaths(path, true) - .ToList()) + foreach (var file in _fileSystem.GetFilePaths(path, true)) { _fileSystem.DeleteFile(file); } diff --git a/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs b/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs index 7b7a591aa..e57929989 100644 --- a/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs +++ b/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; namespace MediaBrowser.Controller.Plugins { @@ -10,7 +11,7 @@ namespace MediaBrowser.Controller.Plugins /// /// Runs this instance. /// - void Run(); + Task RunAsync(); } public interface IRunBeforeStartup diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index db0011114..5405934ce 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -425,11 +425,9 @@ namespace MediaBrowser.WebDashboard.Api private async Task DumpFile(PackageCreator packageCreator, string resourceVirtualPath, string destinationFilePath, string mode, string appVersion) { using (var stream = await packageCreator.GetResource(resourceVirtualPath, mode, null, appVersion).ConfigureAwait(false)) + using (var fs = _fileSystem.GetFileStream(destinationFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) { - using (var fs = _fileSystem.GetFileStream(destinationFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) - { - stream.CopyTo(fs); - } + await stream.CopyToAsync(fs); } } diff --git a/MediaBrowser.WebDashboard/ServerEntryPoint.cs b/MediaBrowser.WebDashboard/ServerEntryPoint.cs index 221fa62c7..18ed54a78 100644 --- a/MediaBrowser.WebDashboard/ServerEntryPoint.cs +++ b/MediaBrowser.WebDashboard/ServerEntryPoint.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using MediaBrowser.Common; using MediaBrowser.Controller.Plugins; @@ -23,9 +24,11 @@ namespace MediaBrowser.WebDashboard Instance = this; } - public void Run() + public Task RunAsync() { PluginConfigurationPages = _appHost.GetExports().ToList(); + + return Task.CompletedTask; } public void Dispose() diff --git a/MediaBrowser.XbmcMetadata/EntryPoint.cs b/MediaBrowser.XbmcMetadata/EntryPoint.cs index 37a1d4c35..992991a7e 100644 --- a/MediaBrowser.XbmcMetadata/EntryPoint.cs +++ b/MediaBrowser.XbmcMetadata/EntryPoint.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; using MediaBrowser.Common.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; @@ -28,9 +29,11 @@ namespace MediaBrowser.XbmcMetadata _config = config; } - public void Run() + public Task RunAsync() { _userDataManager.UserDataSaved += _userDataManager_UserDataSaved; + + return Task.CompletedTask; } void _userDataManager_UserDataSaved(object sender, UserDataSaveEventArgs e) -- cgit v1.2.3 From 5ac6d0ae59731cdf9de0a5565d0cd894695bdc12 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Fri, 1 Feb 2019 21:56:50 +0100 Subject: Fix more warnings --- Emby.Server.Implementations/IO/LibraryMonitor.cs | 14 ++++++++++---- Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs | 16 ++++++++-------- .../LiveTv/TunerHosts/SharedHttpStream.cs | 2 +- .../Updates/InstallationManager.cs | 4 ++-- Jellyfin.Server/Program.cs | 8 ++++---- MediaBrowser.Api/PackageService.cs | 2 +- MediaBrowser.Api/UserLibrary/PlaystateService.cs | 10 +++++----- 7 files changed, 31 insertions(+), 25 deletions(-) (limited to 'Emby.Server.Implementations/LiveTv') diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs index dad81c195..ed5fddb52 100644 --- a/Emby.Server.Implementations/IO/LibraryMonitor.cs +++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs @@ -601,20 +601,26 @@ namespace Emby.Server.Implementations.IO /// public void Dispose() { - _disposed = true; Dispose(true); } /// /// Releases unmanaged and - optionally - managed resources. /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected virtual void Dispose(bool dispose) + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + protected virtual void Dispose(bool disposing) { - if (dispose) + if (_disposed) + { + return; + } + + if (disposing) { Stop(); } + + _disposed = true; } } diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 4e68bb545..bce9c240d 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -35,7 +35,6 @@ using MediaBrowser.Model.Providers; using MediaBrowser.Model.Querying; using MediaBrowser.Model.Reflection; using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.System; using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; @@ -275,7 +274,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV foreach (var timer in seriesTimers) { - await UpdateTimersForSeriesTimer(timer, false, true).ConfigureAwait(false); + UpdateTimersForSeriesTimer(timer, false, true); } } @@ -763,12 +762,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV _timerProvider.AddOrUpdate(timer, false); } - await UpdateTimersForSeriesTimer(info, true, false).ConfigureAwait(false); + UpdateTimersForSeriesTimer(info, true, false); return info.Id; } - public async Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken) + public Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken) { var instance = _seriesTimerProvider.GetAll().FirstOrDefault(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase)); @@ -792,8 +791,10 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV _seriesTimerProvider.Update(instance); - await UpdateTimersForSeriesTimer(instance, true, true).ConfigureAwait(false); + UpdateTimersForSeriesTimer(instance, true, true); } + + return Task.CompletedTask; } public Task UpdateTimerAsync(TimerInfo updatedTimer, CancellationToken cancellationToken) @@ -2346,10 +2347,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV } } - private async Task UpdateTimersForSeriesTimer(SeriesTimerInfo seriesTimer, bool updateTimerSettings, bool deleteInvalidTimers) + private void UpdateTimersForSeriesTimer(SeriesTimerInfo seriesTimer, bool updateTimerSettings, bool deleteInvalidTimers) { - var allTimers = GetTimersForSeries(seriesTimer) - .ToList(); + var allTimers = GetTimersForSeries(seriesTimer).ToList(); var enabledTimersForSeries = new List(); diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs index 716417ccb..4eff9252e 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs @@ -94,7 +94,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts var now = DateTime.UtcNow; - StartStreaming(response, taskCompletionSource, LiveStreamCancellationTokenSource.Token); + var _ = StartStreaming(response, taskCompletionSource, LiveStreamCancellationTokenSource.Token); //OpenedMediaSource.Protocol = MediaProtocol.File; //OpenedMediaSource.Path = tempFile; diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index 552155635..9a49b97c7 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.Updates /// Gets all available packages. /// /// Task{List{PackageInfo}}. - public async Task> GetAvailablePackages(CancellationToken cancellationToken, + public Task> GetAvailablePackages(CancellationToken cancellationToken, bool withRegistration = true, string packageType = null, Version applicationVersion = null) @@ -172,7 +172,7 @@ namespace Emby.Server.Implementations.Updates // TODO cvium: when plugins get back this would need to be fixed // var packages = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false); - return new List(); //FilterPackages(packages, packageType, applicationVersion); + return Task.FromResult(new List()); //FilterPackages(packages, packageType, applicationVersion); } /// diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 2f1828336..88b10cdbe 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -62,7 +62,7 @@ namespace Jellyfin.Server // $JELLYFIN_LOG_DIR needs to be set for the logger configuration manager Environment.SetEnvironmentVariable("JELLYFIN_LOG_DIR", appPaths.LogDirectoryPath); - await createLogger(appPaths); + await CreateLogger(appPaths); _logger = _loggerFactory.CreateLogger("Main"); AppDomain.CurrentDomain.UnhandledException += (sender, e) @@ -95,7 +95,7 @@ namespace Jellyfin.Server _logger.LogInformation("Jellyfin version: {Version}", Assembly.GetEntryAssembly().GetName().Version); - EnvironmentInfo environmentInfo = new EnvironmentInfo(getOperatingSystem()); + EnvironmentInfo environmentInfo = new EnvironmentInfo(GetOperatingSystem()); ApplicationHost.LogEnvironmentInfo(_logger, appPaths, environmentInfo); SQLitePCL.Batteries_V2.Init(); @@ -226,7 +226,7 @@ namespace Jellyfin.Server return new ServerApplicationPaths(programDataPath, appPath, appPath, logDir, configDir); } - private static async Task createLogger(IApplicationPaths appPaths) + private static async Task CreateLogger(IApplicationPaths appPaths) { try { @@ -286,7 +286,7 @@ namespace Jellyfin.Server return new NullImageEncoder(); } - private static MediaBrowser.Model.System.OperatingSystem getOperatingSystem() + private static MediaBrowser.Model.System.OperatingSystem GetOperatingSystem() { switch (Environment.OSVersion.Platform) { diff --git a/MediaBrowser.Api/PackageService.cs b/MediaBrowser.Api/PackageService.cs index 16819ee37..fbb876dea 100644 --- a/MediaBrowser.Api/PackageService.cs +++ b/MediaBrowser.Api/PackageService.cs @@ -197,7 +197,7 @@ namespace MediaBrowser.Api throw new ResourceNotFoundException(string.Format("Package not found: {0}", request.Name)); } - Task.Run(() => _installationManager.InstallPackage(package, true, new SimpleProgress(), CancellationToken.None)); + await _installationManager.InstallPackage(package, true, new SimpleProgress(), CancellationToken.None); } /// diff --git a/MediaBrowser.Api/UserLibrary/PlaystateService.cs b/MediaBrowser.Api/UserLibrary/PlaystateService.cs index 72a943092..a133bc8e9 100644 --- a/MediaBrowser.Api/UserLibrary/PlaystateService.cs +++ b/MediaBrowser.Api/UserLibrary/PlaystateService.cs @@ -247,14 +247,14 @@ namespace MediaBrowser.Api.UserLibrary /// Posts the specified request. /// /// The request. - public async Task Post(MarkPlayedItem request) + public object Post(MarkPlayedItem request) { - var result = await MarkPlayed(request).ConfigureAwait(false); + var result = MarkPlayed(request); return ToOptimizedResult(result); } - private async Task MarkPlayed(MarkPlayedItem request) + private UserItemDataDto MarkPlayed(MarkPlayedItem request) { var user = _userManager.GetUserById(request.UserId); @@ -403,10 +403,10 @@ namespace MediaBrowser.Api.UserLibrary { var task = MarkUnplayed(request); - return ToOptimizedResult(task.Result); + return ToOptimizedResult(task); } - private async Task MarkUnplayed(MarkUnplayedItem request) + private UserItemDataDto MarkUnplayed(MarkUnplayedItem request) { var user = _userManager.GetUserById(request.UserId); -- cgit v1.2.3 From 8b073e2ba5e4b1dafc7ef11554cd13ef59339a5c Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sat, 2 Feb 2019 12:19:02 +0100 Subject: Remove unused field --- Emby.Server.Implementations/ApplicationHost.cs | 2 +- Emby.Server.Implementations/LiveTv/LiveTvManager.cs | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'Emby.Server.Implementations/LiveTv') diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 87e3b45ab..c59a648e5 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -904,7 +904,7 @@ namespace Emby.Server.Implementations PlaylistManager = new PlaylistManager(LibraryManager, FileSystemManager, LibraryMonitor, LoggerFactory, UserManager, ProviderManager); RegisterSingleInstance(PlaylistManager); - LiveTvManager = new LiveTvManager(this, ServerConfigurationManager, LoggerFactory, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager, FileSystemManager, () => ChannelManager); + LiveTvManager = new LiveTvManager(this, ServerConfigurationManager, LoggerFactory, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, FileSystemManager, () => ChannelManager); RegisterSingleInstance(LiveTvManager); UserViewManager = new UserViewManager(LibraryManager, LocalizationManager, UserManager, ChannelManager, LiveTvManager, ServerConfigurationManager); diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index 575cb1c77..c0c91e345 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using Emby.Server.Implementations.Library; using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.Net; using MediaBrowser.Common.Progress; using MediaBrowser.Controller; using MediaBrowser.Controller.Channels; @@ -24,7 +23,6 @@ using MediaBrowser.Controller.Sorting; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Events; -using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Globalization; using MediaBrowser.Model.IO; using MediaBrowser.Model.LiveTv; @@ -48,7 +46,6 @@ namespace Emby.Server.Implementations.LiveTv private readonly ILibraryManager _libraryManager; private readonly ITaskManager _taskManager; private readonly IJsonSerializer _jsonSerializer; - private readonly IProviderManager _providerManager; private readonly Func _channelManager; private readonly IDtoService _dtoService; @@ -85,7 +82,6 @@ namespace Emby.Server.Implementations.LiveTv ITaskManager taskManager, ILocalizationManager localization, IJsonSerializer jsonSerializer, - IProviderManager providerManager, IFileSystem fileSystem, Func channelManager) { @@ -97,7 +93,6 @@ namespace Emby.Server.Implementations.LiveTv _taskManager = taskManager; _localization = localization; _jsonSerializer = jsonSerializer; - _providerManager = providerManager; _fileSystem = fileSystem; _dtoService = dtoService; _userDataManager = userDataManager; -- cgit v1.2.3 From 1385d89df6d6af178dcfdfa1dee6346c6efcad2a Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sat, 2 Feb 2019 12:27:06 +0100 Subject: Remove MoreLINQ --- .../Collections/CollectionImageProvider.cs | 3 +- Emby.Server.Implementations/Dto/DtoService.cs | 3 +- .../EntryPoints/LibraryChangedNotifier.cs | 17 +++-- .../EntryPoints/UserDataChangeNotifier.cs | 3 +- Emby.Server.Implementations/IO/FileRefresher.cs | 4 +- .../LiveTv/LiveTvManager.cs | 3 +- .../Networking/NetworkManager.cs | 6 +- .../Playlists/PlaylistImageProvider.cs | 4 +- .../UserViews/DynamicImageProvider.cs | 4 +- MediaBrowser.Api/Library/LibraryService.cs | 15 ++-- MediaBrowser.Api/Movies/MoviesService.cs | 6 +- .../Entities/CollectionFolder.cs | 6 +- MediaBrowser.Controller/Entities/TV/Series.cs | 2 +- MediaBrowser.Controller/Library/NameExtensions.cs | 8 +- MediaBrowser.Model/Extensions/LinqExtensions.cs | 85 ---------------------- 15 files changed, 53 insertions(+), 116 deletions(-) delete mode 100644 MediaBrowser.Model/Extensions/LinqExtensions.cs (limited to 'Emby.Server.Implementations/LiveTv') diff --git a/Emby.Server.Implementations/Collections/CollectionImageProvider.cs b/Emby.Server.Implementations/Collections/CollectionImageProvider.cs index 6642d1ef4..6aeadda2f 100644 --- a/Emby.Server.Implementations/Collections/CollectionImageProvider.cs +++ b/Emby.Server.Implementations/Collections/CollectionImageProvider.cs @@ -70,7 +70,8 @@ namespace Emby.Server.Implementations.Collections return null; }) .Where(i => i != null) - .DistinctBy(i => i.Id) + .GroupBy(x => x.Id) + .Select(x => x.First()) .OrderBy(i => Guid.NewGuid()) .ToList(); } diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index a3529fdb4..f5634690f 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -620,7 +620,8 @@ namespace Emby.Server.Implementations.Dto } }).Where(i => i != null) - .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase) + .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase) + .Select(x => x.First()) .ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase); for (var i = 0; i < people.Count; i++) diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs index 7a8b09cf7..a670a289c 100644 --- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs @@ -277,14 +277,21 @@ namespace Emby.Server.Implementations.EntryPoints lock (_libraryChangedSyncLock) { // Remove dupes in case some were saved multiple times - var foldersAddedTo = _foldersAddedTo.DistinctBy(i => i.Id).ToList(); + var foldersAddedTo = _foldersAddedTo + .GroupBy(x => x.Id) + .Select(x => x.First()) + .ToList(); - var foldersRemovedFrom = _foldersRemovedFrom.DistinctBy(i => i.Id).ToList(); + var foldersRemovedFrom = _foldersRemovedFrom + .GroupBy(x => x.Id) + .Select(x => x.First()) + .ToList(); var itemsUpdated = _itemsUpdated - .Where(i => !_itemsAdded.Contains(i)) - .DistinctBy(i => i.Id) - .ToList(); + .Where(i => !_itemsAdded.Contains(i)) + .GroupBy(x => x.Id) + .Select(x => x.First()) + .ToList(); SendChangeNotifications(_itemsAdded.ToList(), itemsUpdated, _itemsRemoved.ToList(), foldersAddedTo, foldersRemovedFrom, CancellationToken.None); diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs index 9e71ffceb..69784e410 100644 --- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs @@ -121,7 +121,8 @@ namespace Emby.Server.Implementations.EntryPoints var user = _userManager.GetUserById(userId); var dtoList = changedItems - .DistinctBy(i => i.Id) + .GroupBy(x => x.Id) + .Select(x => x.First()) .Select(i => { var dto = _userDataManager.GetUserDataDto(i, user); diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.cs index 12532a497..1cac0ba5c 100644 --- a/Emby.Server.Implementations/IO/FileRefresher.cs +++ b/Emby.Server.Implementations/IO/FileRefresher.cs @@ -146,8 +146,8 @@ namespace Emby.Server.Implementations.IO .Distinct(StringComparer.OrdinalIgnoreCase) .Select(GetAffectedBaseItem) .Where(item => item != null) - .DistinctBy(i => i.Id) - .ToList(); + .GroupBy(x => x.Id) + .Select(x => x.First()); foreach (var item in itemsToRefresh) { diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index c0c91e345..c3437bcda 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -2464,7 +2464,8 @@ namespace Emby.Server.Implementations.LiveTv .Where(i => i != null) .Where(i => i.IsVisibleStandalone(user)) .SelectMany(i => _libraryManager.GetCollectionFolders(i)) - .DistinctBy(i => i.Id) + .GroupBy(x => x.Id) + .Select(x => x.First()) .OrderBy(i => i.SortName) .ToList(); diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs index f4b9f84dc..aa884664f 100644 --- a/Emby.Server.Implementations/Networking/NetworkManager.cs +++ b/Emby.Server.Implementations/Networking/NetworkManager.cs @@ -111,7 +111,8 @@ namespace Emby.Server.Implementations.Networking .OrderBy(i => i.AddressFamily == AddressFamily.InterNetwork ? 0 : 1) .ThenBy(i => listClone.IndexOf(i)) .Where(FilterIpAddress) - .DistinctBy(i => i.ToString()) + .GroupBy(i => i.ToString()) + .Select(x => x.First()) .ToList(); } @@ -429,7 +430,8 @@ namespace Emby.Server.Implementations.Networking return new List(); } - }).DistinctBy(i => i.ToString()) + }).GroupBy(i => i.ToString()) + .Select(x => x.First()) .ToList(); } diff --git a/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs b/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs index 223153164..8a7c1492d 100644 --- a/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs +++ b/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs @@ -13,7 +13,6 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Playlists; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Extensions; using MediaBrowser.Model.IO; using MediaBrowser.Model.Querying; @@ -64,7 +63,8 @@ namespace Emby.Server.Implementations.Playlists }) .Where(i => i != null) .OrderBy(i => Guid.NewGuid()) - .DistinctBy(i => i.Id) + .GroupBy(x => x.Id) + .Select(x => x.First()) .ToList(); } } diff --git a/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs b/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs index 937db3f23..4ec68e550 100644 --- a/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs +++ b/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs @@ -12,7 +12,6 @@ using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Extensions; using MediaBrowser.Model.IO; namespace Emby.Server.Implementations.UserViews @@ -83,7 +82,8 @@ namespace Emby.Server.Implementations.UserViews return i; - }).DistinctBy(i => i.Id); + }).GroupBy(x => x.Id) + .Select(x => x.First()); if (isUsingCollectionStrip) { diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index 8e6d1febb..d44b07256 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -551,7 +551,8 @@ namespace MediaBrowser.Api.Library Name = i.Name, DefaultEnabled = IsSaverEnabledByDefault(i.Name, types, isNewLibrary) }) - .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase) + .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase) + .Select(x => x.First()) .ToArray(); result.MetadataReaders = plugins @@ -561,7 +562,8 @@ namespace MediaBrowser.Api.Library Name = i.Name, DefaultEnabled = true }) - .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase) + .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase) + .Select(x => x.First()) .ToArray(); result.SubtitleFetchers = plugins @@ -571,7 +573,8 @@ namespace MediaBrowser.Api.Library Name = i.Name, DefaultEnabled = true }) - .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase) + .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase) + .Select(x => x.First()) .ToArray(); var typeOptions = new List(); @@ -593,7 +596,8 @@ namespace MediaBrowser.Api.Library Name = i.Name, DefaultEnabled = IsMetadataFetcherEnabledByDefault(i.Name, type, isNewLibrary) }) - .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase) + .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase) + .Select(x => x.First()) .ToArray(), ImageFetchers = plugins @@ -604,7 +608,8 @@ namespace MediaBrowser.Api.Library Name = i.Name, DefaultEnabled = IsImageFetcherEnabledByDefault(i.Name, type, isNewLibrary) }) - .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase) + .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase) + .Select(x => x.First()) .ToArray(), SupportedImageTypes = plugins diff --git a/MediaBrowser.Api/Movies/MoviesService.cs b/MediaBrowser.Api/Movies/MoviesService.cs index 996087018..91766255f 100644 --- a/MediaBrowser.Api/Movies/MoviesService.cs +++ b/MediaBrowser.Api/Movies/MoviesService.cs @@ -268,7 +268,8 @@ namespace MediaBrowser.Api.Movies EnableGroupByMetadataKey = true, DtoOptions = dtoOptions - }).DistinctBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N")) + }).GroupBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N")) + .Select(x => x.First()) .Take(itemLimit) .ToList(); @@ -308,7 +309,8 @@ namespace MediaBrowser.Api.Movies EnableGroupByMetadataKey = true, DtoOptions = dtoOptions - }).DistinctBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N")) + }).GroupBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N")) + .Select(x => x.First()) .Take(itemLimit) .ToList(); diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 91cfcd0ce..275052d48 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -335,7 +335,11 @@ namespace MediaBrowser.Controller.Entities .OfType() .ToList(); - return PhysicalLocations.Where(i => !FileSystem.AreEqual(i, Path)).SelectMany(i => GetPhysicalParents(i, rootChildren)).DistinctBy(i => i.Id); + return PhysicalLocations + .Where(i => !FileSystem.AreEqual(i, Path)) + .SelectMany(i => GetPhysicalParents(i, rootChildren)) + .GroupBy(x => x.Id) + .Select(x => x.First()); } private IEnumerable GetPhysicalParents(string path, List rootChildren) diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index 4539ab0f2..570e9389e 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -270,7 +270,7 @@ namespace MediaBrowser.Controller.Entities.TV // This depends on settings for that series // When this happens, remove the duplicate from season 0 - return allEpisodes.DistinctBy(i => i.Id).Reverse(); + return allEpisodes.GroupBy(i => i.Id).Select(x => x.First()).Reverse(); } public async Task RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress progress, CancellationToken cancellationToken) diff --git a/MediaBrowser.Controller/Library/NameExtensions.cs b/MediaBrowser.Controller/Library/NameExtensions.cs index e2988a831..6b0b7e53a 100644 --- a/MediaBrowser.Controller/Library/NameExtensions.cs +++ b/MediaBrowser.Controller/Library/NameExtensions.cs @@ -1,7 +1,7 @@ using System; +using System.Linq; using System.Collections.Generic; using MediaBrowser.Controller.Extensions; -using MediaBrowser.Model.Extensions; namespace MediaBrowser.Controller.Library { @@ -14,13 +14,11 @@ namespace MediaBrowser.Controller.Library return string.Empty; } - //return name; return name.RemoveDiacritics(); } public static IEnumerable DistinctNames(this IEnumerable names) - { - return names.DistinctBy(RemoveDiacritics, StringComparer.OrdinalIgnoreCase); - } + => names.GroupBy(RemoveDiacritics, StringComparer.OrdinalIgnoreCase) + .Select(x => x.First()); } } diff --git a/MediaBrowser.Model/Extensions/LinqExtensions.cs b/MediaBrowser.Model/Extensions/LinqExtensions.cs deleted file mode 100644 index f0febf1d0..000000000 --- a/MediaBrowser.Model/Extensions/LinqExtensions.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Collections.Generic; - -// TODO: @bond Remove -namespace MediaBrowser.Model.Extensions -{ - // MoreLINQ - Extensions to LINQ to Objects - // Copyright (c) 2008 Jonathan Skeet. All rights reserved. - // - // Licensed under the Apache License, Version 2.0 (the "License"); - // you may not use this file except in compliance with the License. - // You may obtain a copy of the License at - // - // http://www.apache.org/licenses/LICENSE-2.0 - // - // Unless required by applicable law or agreed to in writing, software - // distributed under the License is distributed on an "AS IS" BASIS, - // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - // See the License for the specific language governing permissions and - // limitations under the License. - - public static class LinqExtensions - { - /// - /// Returns all distinct elements of the given source, where "distinctness" - /// is determined via a projection and the default equality comparer for the projected type. - /// - /// - /// This operator uses deferred execution and streams the results, although - /// a set of already-seen keys is retained. If a key is seen multiple times, - /// only the first element with that key is returned. - /// - /// Type of the source sequence - /// Type of the projected element - /// Source sequence - /// Projection for determining "distinctness" - /// A sequence consisting of distinct elements from the source sequence, - /// comparing them by the specified key projection. - - public static IEnumerable DistinctBy(this IEnumerable source, - Func keySelector) - { - return source.DistinctBy(keySelector, null); - } - - /// - /// Returns all distinct elements of the given source, where "distinctness" - /// is determined via a projection and the specified comparer for the projected type. - /// - /// - /// This operator uses deferred execution and streams the results, although - /// a set of already-seen keys is retained. If a key is seen multiple times, - /// only the first element with that key is returned. - /// - /// Type of the source sequence - /// Type of the projected element - /// Source sequence - /// Projection for determining "distinctness" - /// The equality comparer to use to determine whether or not keys are equal. - /// If null, the default equality comparer for TSource is used. - /// A sequence consisting of distinct elements from the source sequence, - /// comparing them by the specified key projection. - - public static IEnumerable DistinctBy(this IEnumerable source, - Func keySelector, IEqualityComparer comparer) - { - if (source == null) throw new ArgumentNullException(nameof(source)); - if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); - return DistinctByImpl(source, keySelector, comparer); - } - - private static IEnumerable DistinctByImpl(IEnumerable source, - Func keySelector, IEqualityComparer comparer) - { - var knownKeys = new HashSet(comparer); - foreach (var element in source) - { - if (knownKeys.Add(keySelector(element))) - { - yield return element; - } - } - } - } -} -- cgit v1.2.3 From 78e4e2ed929155b433fc0cbb2ea6fc7f64411a72 Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Sat, 2 Feb 2019 21:45:29 +0100 Subject: Fix all warnings --- Emby.Drawing/ImageProcessor.cs | 9 ------ Emby.Server.Implementations/Library/UserManager.cs | 34 +++++++++++----------- .../LiveTv/EmbyTV/EmbyTV.cs | 1 - .../LiveTv/LiveTvManager.cs | 27 ++++++++--------- MediaBrowser.Controller/LiveTv/ILiveTvService.cs | 5 ---- 5 files changed, 31 insertions(+), 45 deletions(-) (limited to 'Emby.Server.Implementations/LiveTv') diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index f229d9a0b..097b4c40b 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -261,15 +261,6 @@ namespace Emby.Drawing return (cacheFilePath, GetMimeType(outputFormat, cacheFilePath), _fileSystem.GetLastWriteTimeUtc(cacheFilePath)); } - catch (ArgumentOutOfRangeException ex) - { - // Decoder failed to decode it -#if DEBUG - _logger.LogError(ex, "Error encoding image"); -#endif - // Just spit out the original file if all the options are default - return (originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified); - } catch (Exception ex) { // If it fails for whatever reason, return the original image diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs index b33ae72b7..215978341 100644 --- a/Emby.Server.Implementations/Library/UserManager.cs +++ b/Emby.Server.Implementations/Library/UserManager.cs @@ -448,30 +448,30 @@ namespace Emby.Server.Implementations.Library private void UpdateInvalidLoginAttemptCount(User user, int newValue) { - if (user.Policy.InvalidLoginAttemptCount != newValue || newValue > 0) + if (user.Policy.InvalidLoginAttemptCount == newValue || newValue <= 0) { - user.Policy.InvalidLoginAttemptCount = newValue; + return; + } - var maxCount = user.Policy.IsAdministrator ? 3 : 5; + user.Policy.InvalidLoginAttemptCount = newValue; - // TODO: Fix - /* - var fireLockout = false; + var maxCount = user.Policy.IsAdministrator ? 3 : 5; - if (newValue >= maxCount) - { - _logger.LogDebug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue.ToString(CultureInfo.InvariantCulture)); - user.Policy.IsDisabled = true; + var fireLockout = false; - fireLockout = true; - }*/ + if (newValue >= maxCount) + { + _logger.LogDebug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue); + user.Policy.IsDisabled = true; - UpdateUserPolicy(user, user.Policy, false); + fireLockout = true; + } - /* if (fireLockout) - { - UserLockedOut?.Invoke(this, new GenericEventArgs(user)); - }*/ + UpdateUserPolicy(user, user.Policy, false); + + if (fireLockout) + { + UserLockedOut?.Invoke(this, new GenericEventArgs(user)); } } diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index bce9c240d..c5c0ac463 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -64,7 +64,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV public static EmbyTV Current; - public event EventHandler DataSourceChanged; public event EventHandler> TimerCreated; public event EventHandler> TimerCancelled; diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index c3437bcda..a36302876 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.LiveTv private readonly LiveTvDtoService _tvDtoService; - private ILiveTvService[] _services = new ILiveTvService[] { }; + private ILiveTvService[] _services = Array.Empty(); private ITunerHost[] _tunerHosts = Array.Empty(); private IListingsProvider[] _listingProviders = Array.Empty(); @@ -127,8 +127,6 @@ namespace Emby.Server.Implementations.LiveTv foreach (var service in _services) { - service.DataSourceChanged += service_DataSourceChanged; - if (service is EmbyTV.EmbyTV embyTv) { embyTv.TimerCreated += EmbyTv_TimerCreated; @@ -184,14 +182,6 @@ namespace Emby.Server.Implementations.LiveTv return EmbyTV.EmbyTV.Current.DiscoverTuners(newDevicesOnly, cancellationToken); } - void service_DataSourceChanged(object sender, EventArgs e) - { - if (!_isDisposed) - { - _taskManager.CancelIfRunningAndQueue(); - } - } - public QueryResult GetInternalChannels(LiveTvChannelQuery query, DtoOptions dtoOptions, CancellationToken cancellationToken) { var user = query.UserId.Equals(Guid.Empty) ? null : _userManager.GetUserById(query.UserId); @@ -2153,17 +2143,28 @@ namespace Emby.Server.Implementations.LiveTv Dispose(true); } - private bool _isDisposed = false; + private bool _disposed = false; /// /// Releases unmanaged and - optionally - managed resources. /// /// true to release both managed and unmanaged resources; false to release only unmanaged resources. protected virtual void Dispose(bool dispose) { + if (_disposed) + { + return; + } + if (dispose) { - _isDisposed = true; + // TODO: Dispose stuff } + + _services = null; + _listingProviders = null; + _tunerHosts = null; + + _disposed = true; } private LiveTvServiceInfo[] GetServiceInfos() diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs index ba3813d8a..b71a76648 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs @@ -12,11 +12,6 @@ namespace MediaBrowser.Controller.LiveTv /// public interface ILiveTvService { - /// - /// Occurs when [data source changed]. - /// - event EventHandler DataSourceChanged; - /// /// Gets the name. /// -- cgit v1.2.3 From 0ef2b46106937c8acbab8e2a6a1e08affb823d31 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Tue, 5 Feb 2019 09:49:46 +0100 Subject: Remove custom Threading --- Emby.Dlna/Main/DlnaEntryPoint.cs | 11 ++----- Emby.Dlna/PlayTo/Device.cs | 14 +++------ Emby.Dlna/PlayTo/PlayToManager.cs | 7 ++--- Emby.Dlna/Ssdp/DeviceDiscovery.cs | 8 ++--- Emby.Notifications/Notifications.cs | 9 ++---- Emby.Server.Implementations/ApplicationHost.cs | 14 +++------ .../EntryPoints/AutomaticRestartEntryPoint.cs | 9 ++---- .../EntryPoints/ExternalPortForwarding.cs | 9 ++---- .../EntryPoints/LibraryChangedNotifier.cs | 13 +++----- .../EntryPoints/UserDataChangeNotifier.cs | 9 ++---- Emby.Server.Implementations/IO/FileRefresher.cs | 10 +++--- Emby.Server.Implementations/IO/LibraryMonitor.cs | 6 +--- .../Library/MediaSourceManager.cs | 4 --- .../LiveTv/EmbyTV/EmbyTV.cs | 4 +-- .../LiveTv/EmbyTV/TimerManager.cs | 10 +++--- .../Session/SessionManager.cs | 14 +++------ .../Threading/CommonTimer.cs | 36 ---------------------- .../Threading/TimerFactory.cs | 18 ----------- MediaBrowser.Api/ApiEntryPoint.cs | 15 +++------ MediaBrowser.Api/Playback/BaseStreamingService.cs | 2 +- MediaBrowser.Api/Playback/TranscodingThrottler.cs | 10 +++--- .../Net/BasePeriodicWebSocketListener.cs | 19 +++++------- MediaBrowser.Controller/Session/SessionInfo.cs | 8 ++--- MediaBrowser.Model/Threading/ITimer.cs | 10 ------ MediaBrowser.Model/Threading/ITimerFactory.cs | 10 ------ RSSDP/SsdpDeviceLocator.cs | 9 ++---- RSSDP/SsdpDevicePublisher.cs | 9 ++---- 27 files changed, 75 insertions(+), 222 deletions(-) delete mode 100644 Emby.Server.Implementations/Threading/CommonTimer.cs delete mode 100644 Emby.Server.Implementations/Threading/TimerFactory.cs delete mode 100644 MediaBrowser.Model/Threading/ITimer.cs delete mode 100644 MediaBrowser.Model/Threading/ITimerFactory.cs (limited to 'Emby.Server.Implementations/LiveTv') diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs index 7398b24cd..a20006578 100644 --- a/Emby.Dlna/Main/DlnaEntryPoint.cs +++ b/Emby.Dlna/Main/DlnaEntryPoint.cs @@ -20,7 +20,6 @@ using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Net; using MediaBrowser.Model.System; -using MediaBrowser.Model.Threading; using MediaBrowser.Model.Xml; using Microsoft.Extensions.Logging; using Rssdp; @@ -49,8 +48,7 @@ namespace Emby.Dlna.Main private readonly IDeviceDiscovery _deviceDiscovery; private SsdpDevicePublisher _Publisher; - - private readonly ITimerFactory _timerFactory; + private readonly ISocketFactory _socketFactory; private readonly IEnvironmentInfo _environmentInfo; private readonly INetworkManager _networkManager; @@ -78,7 +76,6 @@ namespace Emby.Dlna.Main IDeviceDiscovery deviceDiscovery, IMediaEncoder mediaEncoder, ISocketFactory socketFactory, - ITimerFactory timerFactory, IEnvironmentInfo environmentInfo, INetworkManager networkManager, IUserViewManager userViewManager, @@ -99,7 +96,6 @@ namespace Emby.Dlna.Main _deviceDiscovery = deviceDiscovery; _mediaEncoder = mediaEncoder; _socketFactory = socketFactory; - _timerFactory = timerFactory; _environmentInfo = environmentInfo; _networkManager = networkManager; _logger = loggerFactory.CreateLogger("Dlna"); @@ -233,7 +229,7 @@ namespace Emby.Dlna.Main try { - _Publisher = new SsdpDevicePublisher(_communicationsServer, _timerFactory, _environmentInfo.OperatingSystemName, _environmentInfo.OperatingSystemVersion); + _Publisher = new SsdpDevicePublisher(_communicationsServer, _environmentInfo.OperatingSystemName, _environmentInfo.OperatingSystemVersion); _Publisher.LogFunction = LogMessage; _Publisher.SupportPnpRootDevice = false; @@ -353,8 +349,7 @@ namespace Emby.Dlna.Main _userDataManager, _localization, _mediaSourceManager, - _mediaEncoder, - _timerFactory); + _mediaEncoder); _manager.Start(); } diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.cs index 85a522d1c..e49168d34 100644 --- a/Emby.Dlna/PlayTo/Device.cs +++ b/Emby.Dlna/PlayTo/Device.cs @@ -10,7 +10,6 @@ using Emby.Dlna.Server; using Emby.Dlna.Ssdp; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace Emby.Dlna.PlayTo @@ -19,7 +18,7 @@ namespace Emby.Dlna.PlayTo { #region Fields & Properties - private ITimer _timer; + private Timer _timer; public DeviceInfo Properties { get; set; } @@ -64,21 +63,18 @@ namespace Emby.Dlna.PlayTo public DateTime DateLastActivity { get; private set; } public Action OnDeviceUnavailable { get; set; } - private readonly ITimerFactory _timerFactory; - - public Device(DeviceInfo deviceProperties, IHttpClient httpClient, ILogger logger, IServerConfigurationManager config, ITimerFactory timerFactory) + public Device(DeviceInfo deviceProperties, IHttpClient httpClient, ILogger logger, IServerConfigurationManager config) { Properties = deviceProperties; _httpClient = httpClient; _logger = logger; _config = config; - _timerFactory = timerFactory; } public void Start() { _logger.LogDebug("Dlna Device.Start"); - _timer = _timerFactory.Create(TimerCallback, null, 1000, Timeout.Infinite); + _timer = new Timer(TimerCallback, null, 1000, Timeout.Infinite); } private DateTime _lastVolumeRefresh; @@ -890,7 +886,7 @@ namespace Emby.Dlna.PlayTo set; } - public static async Task CreateuPnpDeviceAsync(Uri url, IHttpClient httpClient, IServerConfigurationManager config, ILogger logger, ITimerFactory timerFactory, CancellationToken cancellationToken) + public static async Task CreateuPnpDeviceAsync(Uri url, IHttpClient httpClient, IServerConfigurationManager config, ILogger logger, CancellationToken cancellationToken) { var ssdpHttpClient = new SsdpHttpClient(httpClient, config); @@ -1001,7 +997,7 @@ namespace Emby.Dlna.PlayTo } } - var device = new Device(deviceProperties, httpClient, logger, config, timerFactory); + var device = new Device(deviceProperties, httpClient, logger, config); return device; } diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.cs index 790625705..6cce312ee 100644 --- a/Emby.Dlna/PlayTo/PlayToManager.cs +++ b/Emby.Dlna/PlayTo/PlayToManager.cs @@ -16,7 +16,6 @@ using MediaBrowser.Model.Events; using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Net; using MediaBrowser.Model.Session; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace Emby.Dlna.PlayTo @@ -39,13 +38,12 @@ namespace Emby.Dlna.PlayTo private readonly IDeviceDiscovery _deviceDiscovery; private readonly IMediaSourceManager _mediaSourceManager; private readonly IMediaEncoder _mediaEncoder; - private readonly ITimerFactory _timerFactory; private bool _disposed; private SemaphoreSlim _sessionLock = new SemaphoreSlim(1, 1); private CancellationTokenSource _disposeCancellationTokenSource = new CancellationTokenSource(); - public PlayToManager(ILogger logger, ISessionManager sessionManager, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IImageProcessor imageProcessor, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient, IServerConfigurationManager config, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder, ITimerFactory timerFactory) + public PlayToManager(ILogger logger, ISessionManager sessionManager, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IImageProcessor imageProcessor, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient, IServerConfigurationManager config, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder) { _logger = logger; _sessionManager = sessionManager; @@ -61,7 +59,6 @@ namespace Emby.Dlna.PlayTo _localization = localization; _mediaSourceManager = mediaSourceManager; _mediaEncoder = mediaEncoder; - _timerFactory = timerFactory; } public void Start() @@ -168,7 +165,7 @@ namespace Emby.Dlna.PlayTo if (controller == null) { - var device = await Device.CreateuPnpDeviceAsync(uri, _httpClient, _config, _logger, _timerFactory, cancellationToken).ConfigureAwait(false); + var device = await Device.CreateuPnpDeviceAsync(uri, _httpClient, _config, _logger, cancellationToken).ConfigureAwait(false); string deviceName = device.Properties.Name; diff --git a/Emby.Dlna/Ssdp/DeviceDiscovery.cs b/Emby.Dlna/Ssdp/DeviceDiscovery.cs index 89a88705f..298f68a28 100644 --- a/Emby.Dlna/Ssdp/DeviceDiscovery.cs +++ b/Emby.Dlna/Ssdp/DeviceDiscovery.cs @@ -5,7 +5,6 @@ using MediaBrowser.Controller.Configuration; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Events; using MediaBrowser.Model.Net; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; using Rssdp; using Rssdp.Infrastructure; @@ -48,20 +47,17 @@ namespace Emby.Dlna.Ssdp private SsdpDeviceLocator _deviceLocator; - private readonly ITimerFactory _timerFactory; private readonly ISocketFactory _socketFactory; private ISsdpCommunicationsServer _commsServer; public DeviceDiscovery( ILoggerFactory loggerFactory, IServerConfigurationManager config, - ISocketFactory socketFactory, - ITimerFactory timerFactory) + ISocketFactory socketFactory) { _logger = loggerFactory.CreateLogger(nameof(DeviceDiscovery)); _config = config; _socketFactory = socketFactory; - _timerFactory = timerFactory; } // Call this method from somewhere in your code to start the search. @@ -78,7 +74,7 @@ namespace Emby.Dlna.Ssdp { if (_listenerCount > 0 && _deviceLocator == null) { - _deviceLocator = new SsdpDeviceLocator(_commsServer, _timerFactory); + _deviceLocator = new SsdpDeviceLocator(_commsServer); // (Optional) Set the filter so we only see notifications for devices we care about // (can be any search target value i.e device type, uuid value etc - any value that appears in the diff --git a/Emby.Notifications/Notifications.cs b/Emby.Notifications/Notifications.cs index 045aa6f16..d3290479f 100644 --- a/Emby.Notifications/Notifications.cs +++ b/Emby.Notifications/Notifications.cs @@ -20,7 +20,6 @@ using MediaBrowser.Model.Events; using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Notifications; using MediaBrowser.Model.Tasks; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace Emby.Notifications @@ -40,9 +39,8 @@ namespace Emby.Notifications private readonly ILibraryManager _libraryManager; private readonly ISessionManager _sessionManager; private readonly IServerApplicationHost _appHost; - private readonly ITimerFactory _timerFactory; - private ITimer LibraryUpdateTimer { get; set; } + private Timer LibraryUpdateTimer { get; set; } private readonly object _libraryChangedSyncLock = new object(); private readonly IConfigurationManager _config; @@ -52,7 +50,7 @@ namespace Emby.Notifications 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, ITimerFactory timerFactory) + 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) { _installationManager = installationManager; _userManager = userManager; @@ -64,7 +62,6 @@ namespace Emby.Notifications _appHost = appHost; _config = config; _deviceManager = deviceManager; - _timerFactory = timerFactory; _localization = localization; _activityManager = activityManager; @@ -159,7 +156,7 @@ namespace Emby.Notifications { if (LibraryUpdateTimer == null) { - LibraryUpdateTimer = _timerFactory.Create(LibraryUpdateTimerCallback, null, 5000, + LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, 5000, Timeout.Infinite); } else diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 365eb5856..3808810cf 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -43,7 +43,6 @@ using Emby.Server.Implementations.ScheduledTasks; using Emby.Server.Implementations.Security; using Emby.Server.Implementations.Serialization; using Emby.Server.Implementations.Session; -using Emby.Server.Implementations.Threading; using Emby.Server.Implementations.TV; using Emby.Server.Implementations.Updates; using Emby.Server.Implementations.Xml; @@ -99,7 +98,6 @@ using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Services; using MediaBrowser.Model.System; using MediaBrowser.Model.Tasks; -using MediaBrowser.Model.Threading; using MediaBrowser.Model.Updates; using MediaBrowser.Model.Xml; using MediaBrowser.Providers.Chapters; @@ -347,7 +345,6 @@ namespace Emby.Server.Implementations internal IImageEncoder ImageEncoder { get; private set; } protected IProcessFactory ProcessFactory { get; private set; } - protected ITimerFactory TimerFactory { get; private set; } protected ICryptoProvider CryptographyProvider = new CryptographyProvider(); protected readonly IXmlSerializer XmlSerializer; @@ -772,9 +769,6 @@ namespace Emby.Server.Implementations ProcessFactory = new ProcessFactory(); RegisterSingleInstance(ProcessFactory); - TimerFactory = new TimerFactory(); - RegisterSingleInstance(TimerFactory); - var streamHelper = CreateStreamHelper(); ApplicationHost.StreamHelper = streamHelper; RegisterSingleInstance(streamHelper); @@ -837,7 +831,7 @@ namespace Emby.Server.Implementations var musicManager = new MusicManager(LibraryManager); RegisterSingleInstance(new MusicManager(LibraryManager)); - LibraryMonitor = new LibraryMonitor(LoggerFactory, TaskManager, LibraryManager, ServerConfigurationManager, FileSystemManager, TimerFactory, EnvironmentInfo); + LibraryMonitor = new LibraryMonitor(LoggerFactory, TaskManager, LibraryManager, ServerConfigurationManager, FileSystemManager, EnvironmentInfo); RegisterSingleInstance(LibraryMonitor); RegisterSingleInstance(() => new SearchEngine(LoggerFactory, LibraryManager, UserManager)); @@ -869,7 +863,7 @@ namespace Emby.Server.Implementations DeviceManager = new DeviceManager(AuthenticationRepository, JsonSerializer, LibraryManager, LocalizationManager, UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LoggerFactory, NetworkManager); RegisterSingleInstance(DeviceManager); - MediaSourceManager = new MediaSourceManager(ItemRepository, ApplicationPaths, LocalizationManager, UserManager, LibraryManager, LoggerFactory, JsonSerializer, FileSystemManager, UserDataManager, TimerFactory, () => MediaEncoder); + MediaSourceManager = new MediaSourceManager(ItemRepository, ApplicationPaths, LocalizationManager, UserManager, LibraryManager, LoggerFactory, JsonSerializer, FileSystemManager, UserDataManager, () => MediaEncoder); RegisterSingleInstance(MediaSourceManager); SubtitleManager = new SubtitleManager(LoggerFactory, FileSystemManager, LibraryMonitor, MediaSourceManager, LocalizationManager); @@ -884,7 +878,7 @@ namespace Emby.Server.Implementations ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LoggerFactory, ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, LocalizationManager, HttpClient, ProviderManager); RegisterSingleInstance(ChannelManager); - SessionManager = new SessionManager(UserDataManager, LoggerFactory, LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager, MediaSourceManager, TimerFactory); + SessionManager = new SessionManager(UserDataManager, LoggerFactory, LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager, MediaSourceManager); RegisterSingleInstance(SessionManager); var dlnaManager = new DlnaManager(XmlSerializer, FileSystemManager, ApplicationPaths, LoggerFactory, JsonSerializer, this, assemblyInfo); @@ -905,7 +899,7 @@ namespace Emby.Server.Implementations NotificationManager = new NotificationManager(LoggerFactory, UserManager, ServerConfigurationManager); RegisterSingleInstance(NotificationManager); - RegisterSingleInstance(new DeviceDiscovery(LoggerFactory, ServerConfigurationManager, SocketFactory, TimerFactory)); + RegisterSingleInstance(new DeviceDiscovery(LoggerFactory, ServerConfigurationManager, SocketFactory)); ChapterManager = new ChapterManager(LibraryManager, LoggerFactory, ServerConfigurationManager, ItemRepository); RegisterSingleInstance(ChapterManager); diff --git a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs index 361656ff2..19ea09359 100644 --- a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs +++ b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs @@ -9,7 +9,6 @@ using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Session; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Tasks; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.EntryPoints @@ -22,11 +21,10 @@ namespace Emby.Server.Implementations.EntryPoints private readonly ISessionManager _sessionManager; private readonly IServerConfigurationManager _config; private readonly ILiveTvManager _liveTvManager; - private readonly ITimerFactory _timerFactory; - private ITimer _timer; + private Timer _timer; - public AutomaticRestartEntryPoint(IServerApplicationHost appHost, ILogger logger, ITaskManager iTaskManager, ISessionManager sessionManager, IServerConfigurationManager config, ILiveTvManager liveTvManager, ITimerFactory timerFactory) + public AutomaticRestartEntryPoint(IServerApplicationHost appHost, ILogger logger, ITaskManager iTaskManager, ISessionManager sessionManager, IServerConfigurationManager config, ILiveTvManager liveTvManager) { _appHost = appHost; _logger = logger; @@ -34,7 +32,6 @@ namespace Emby.Server.Implementations.EntryPoints _sessionManager = sessionManager; _config = config; _liveTvManager = liveTvManager; - _timerFactory = timerFactory; } public Task RunAsync() @@ -53,7 +50,7 @@ namespace Emby.Server.Implementations.EntryPoints if (_appHost.HasPendingRestart) { - _timer = _timerFactory.Create(TimerCallback, null, TimeSpan.FromMinutes(15), TimeSpan.FromMinutes(15)); + _timer = new Timer(TimerCallback, null, TimeSpan.FromMinutes(15), TimeSpan.FromMinutes(15)); } } diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs index 56c730c80..f26a70586 100644 --- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs +++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs @@ -10,7 +10,6 @@ using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Plugins; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Events; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; using Mono.Nat; @@ -24,19 +23,17 @@ namespace Emby.Server.Implementations.EntryPoints private readonly IServerConfigurationManager _config; private readonly IDeviceDiscovery _deviceDiscovery; - private ITimer _timer; - private readonly ITimerFactory _timerFactory; + private Timer _timer; private NatManager _natManager; - public ExternalPortForwarding(ILoggerFactory loggerFactory, IServerApplicationHost appHost, IServerConfigurationManager config, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient, ITimerFactory timerFactory) + public ExternalPortForwarding(ILoggerFactory loggerFactory, IServerApplicationHost appHost, IServerConfigurationManager config, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient) { _logger = loggerFactory.CreateLogger("PortMapper"); _appHost = appHost; _config = config; _deviceDiscovery = deviceDiscovery; _httpClient = httpClient; - _timerFactory = timerFactory; _config.ConfigurationUpdated += _config_ConfigurationUpdated1; } @@ -94,7 +91,7 @@ namespace Emby.Server.Implementations.EntryPoints _natManager.StartDiscovery(); } - _timer = _timerFactory.Create(ClearCreatedRules, null, TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(10)); + _timer = new Timer(ClearCreatedRules, null, TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(10)); _deviceDiscovery.DeviceDiscovered += _deviceDiscovery_DeviceDiscovered; diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs index 9b61809c7..038965647 100644 --- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs @@ -14,7 +14,6 @@ using MediaBrowser.Controller.Session; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Events; using MediaBrowser.Model.Extensions; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.EntryPoints @@ -29,7 +28,6 @@ namespace Emby.Server.Implementations.EntryPoints private readonly ISessionManager _sessionManager; private readonly IUserManager _userManager; private readonly ILogger _logger; - private readonly ITimerFactory _timerFactory; /// /// The _library changed sync lock @@ -47,7 +45,7 @@ namespace Emby.Server.Implementations.EntryPoints /// Gets or sets the library update timer. /// /// The library update timer. - private ITimer LibraryUpdateTimer { get; set; } + private Timer LibraryUpdateTimer { get; set; } /// /// The library update duration @@ -56,13 +54,12 @@ namespace Emby.Server.Implementations.EntryPoints private readonly IProviderManager _providerManager; - public LibraryChangedNotifier(ILibraryManager libraryManager, ISessionManager sessionManager, IUserManager userManager, ILogger logger, ITimerFactory timerFactory, IProviderManager providerManager) + public LibraryChangedNotifier(ILibraryManager libraryManager, ISessionManager sessionManager, IUserManager userManager, ILogger logger, IProviderManager providerManager) { _libraryManager = libraryManager; _sessionManager = sessionManager; _userManager = userManager; _logger = logger; - _timerFactory = timerFactory; _providerManager = providerManager; } @@ -191,7 +188,7 @@ namespace Emby.Server.Implementations.EntryPoints { if (LibraryUpdateTimer == null) { - LibraryUpdateTimer = _timerFactory.Create(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, + LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite); } else @@ -225,7 +222,7 @@ namespace Emby.Server.Implementations.EntryPoints { if (LibraryUpdateTimer == null) { - LibraryUpdateTimer = _timerFactory.Create(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, + LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite); } else @@ -253,7 +250,7 @@ namespace Emby.Server.Implementations.EntryPoints { if (LibraryUpdateTimer == null) { - LibraryUpdateTimer = _timerFactory.Create(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, + LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite); } else diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs index d91a2d581..774ed09da 100644 --- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs @@ -10,7 +10,6 @@ using MediaBrowser.Controller.Session; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Session; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.EntryPoints @@ -23,19 +22,17 @@ namespace Emby.Server.Implementations.EntryPoints private readonly IUserManager _userManager; private readonly object _syncLock = new object(); - private ITimer UpdateTimer { get; set; } - private readonly ITimerFactory _timerFactory; + private Timer UpdateTimer { get; set; } private const int UpdateDuration = 500; private readonly Dictionary> _changedItems = new Dictionary>(); - public UserDataChangeNotifier(IUserDataManager userDataManager, ISessionManager sessionManager, ILogger logger, IUserManager userManager, ITimerFactory timerFactory) + public UserDataChangeNotifier(IUserDataManager userDataManager, ISessionManager sessionManager, ILogger logger, IUserManager userManager) { _userDataManager = userDataManager; _sessionManager = sessionManager; _logger = logger; _userManager = userManager; - _timerFactory = timerFactory; } public Task RunAsync() @@ -56,7 +53,7 @@ namespace Emby.Server.Implementations.EntryPoints { if (UpdateTimer == null) { - UpdateTimer = _timerFactory.Create(UpdateTimerCallback, null, UpdateDuration, + UpdateTimer = new Timer(UpdateTimerCallback, null, UpdateDuration, Timeout.Infinite); } else diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.cs index 1cac0ba5c..3668f6a7a 100644 --- a/Emby.Server.Implementations/IO/FileRefresher.cs +++ b/Emby.Server.Implementations/IO/FileRefresher.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Threading; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; @@ -9,7 +10,6 @@ using MediaBrowser.Model.Extensions; using MediaBrowser.Model.IO; using MediaBrowser.Model.System; using MediaBrowser.Model.Tasks; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.IO @@ -22,8 +22,7 @@ namespace Emby.Server.Implementations.IO private IServerConfigurationManager ConfigurationManager { get; set; } private readonly IFileSystem _fileSystem; private readonly List _affectedPaths = new List(); - private ITimer _timer; - private readonly ITimerFactory _timerFactory; + private Timer _timer; private readonly object _timerLock = new object(); public string Path { get; private set; } @@ -31,7 +30,7 @@ namespace Emby.Server.Implementations.IO private readonly IEnvironmentInfo _environmentInfo; private readonly ILibraryManager _libraryManager; - public FileRefresher(string path, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, ITaskManager taskManager, ILogger logger, ITimerFactory timerFactory, IEnvironmentInfo environmentInfo, ILibraryManager libraryManager1) + public FileRefresher(string path, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, ITaskManager taskManager, ILogger logger, IEnvironmentInfo environmentInfo, ILibraryManager libraryManager1) { logger.LogDebug("New file refresher created for {0}", path); Path = path; @@ -41,7 +40,6 @@ namespace Emby.Server.Implementations.IO LibraryManager = libraryManager; TaskManager = taskManager; Logger = logger; - _timerFactory = timerFactory; _environmentInfo = environmentInfo; _libraryManager = libraryManager1; AddPath(path); @@ -90,7 +88,7 @@ namespace Emby.Server.Implementations.IO if (_timer == null) { - _timer = _timerFactory.Create(OnTimerCallback, null, TimeSpan.FromSeconds(ConfigurationManager.Configuration.LibraryMonitorDelay), TimeSpan.FromMilliseconds(-1)); + _timer = new Timer(OnTimerCallback, null, TimeSpan.FromSeconds(ConfigurationManager.Configuration.LibraryMonitorDelay), TimeSpan.FromMilliseconds(-1)); } else { diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs index 3a746ef60..11c684b12 100644 --- a/Emby.Server.Implementations/IO/LibraryMonitor.cs +++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs @@ -11,7 +11,6 @@ using MediaBrowser.Controller.Plugins; using MediaBrowser.Model.IO; using MediaBrowser.Model.System; using MediaBrowser.Model.Tasks; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.IO @@ -134,7 +133,6 @@ namespace Emby.Server.Implementations.IO private IServerConfigurationManager ConfigurationManager { get; set; } private readonly IFileSystem _fileSystem; - private readonly ITimerFactory _timerFactory; private readonly IEnvironmentInfo _environmentInfo; /// @@ -146,7 +144,6 @@ namespace Emby.Server.Implementations.IO ILibraryManager libraryManager, IServerConfigurationManager configurationManager, IFileSystem fileSystem, - ITimerFactory timerFactory, IEnvironmentInfo environmentInfo) { if (taskManager == null) @@ -159,7 +156,6 @@ namespace Emby.Server.Implementations.IO Logger = loggerFactory.CreateLogger(GetType().Name); ConfigurationManager = configurationManager; _fileSystem = fileSystem; - _timerFactory = timerFactory; _environmentInfo = environmentInfo; } @@ -545,7 +541,7 @@ namespace Emby.Server.Implementations.IO } } - var newRefresher = new FileRefresher(path, _fileSystem, ConfigurationManager, LibraryManager, TaskManager, Logger, _timerFactory, _environmentInfo, LibraryManager); + var newRefresher = new FileRefresher(path, _fileSystem, ConfigurationManager, LibraryManager, TaskManager, Logger, _environmentInfo, LibraryManager); newRefresher.Completed += NewRefresher_Completed; _activeRefreshers.Add(newRefresher); } diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs index 4f72651d4..24ab8e761 100644 --- a/Emby.Server.Implementations/Library/MediaSourceManager.cs +++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs @@ -20,7 +20,6 @@ using MediaBrowser.Model.Globalization; using MediaBrowser.Model.IO; using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.Library @@ -36,7 +35,6 @@ namespace Emby.Server.Implementations.Library private IMediaSourceProvider[] _providers; private readonly ILogger _logger; private readonly IUserDataManager _userDataManager; - private readonly ITimerFactory _timerFactory; private readonly Func _mediaEncoder; private ILocalizationManager _localizationManager; private IApplicationPaths _appPaths; @@ -51,7 +49,6 @@ namespace Emby.Server.Implementations.Library IJsonSerializer jsonSerializer, IFileSystem fileSystem, IUserDataManager userDataManager, - ITimerFactory timerFactory, Func mediaEncoder) { _itemRepo = itemRepo; @@ -61,7 +58,6 @@ namespace Emby.Server.Implementations.Library _jsonSerializer = jsonSerializer; _fileSystem = fileSystem; _userDataManager = userDataManager; - _timerFactory = timerFactory; _mediaEncoder = mediaEncoder; _localizationManager = localizationManager; _appPaths = applicationPaths; diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index b9a42a6ff..84ca130b7 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -35,7 +35,6 @@ using MediaBrowser.Model.Providers; using MediaBrowser.Model.Querying; using MediaBrowser.Model.Reflection; using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.LiveTv.EmbyTV @@ -86,7 +85,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV ILibraryMonitor libraryMonitor, IProviderManager providerManager, IMediaEncoder mediaEncoder, - ITimerFactory timerFactory, IProcessFactory processFactory) { Current = this; @@ -108,7 +106,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV _streamHelper = streamHelper; _seriesTimerProvider = new SeriesTimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "seriestimers")); - _timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"), _logger, timerFactory); + _timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"), _logger); _timerProvider.TimerFired += _timerProvider_TimerFired; _config.NamedConfigurationUpdated += _config_NamedConfigurationUpdated; diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs index 7f67d70a9..1dcb02f43 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs @@ -2,29 +2,27 @@ using System; using System.Collections.Concurrent; using System.Globalization; using System.Linq; +using System.Threading; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Model.Events; using MediaBrowser.Model.IO; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.LiveTv.EmbyTV { public class TimerManager : ItemDataProvider { - private readonly ConcurrentDictionary _timers = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); + private readonly ConcurrentDictionary _timers = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); private readonly ILogger _logger; public event EventHandler> TimerFired; - private readonly ITimerFactory _timerFactory; - public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath, ILogger logger1, ITimerFactory timerFactory) + public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath, ILogger logger1) : base(fileSystem, jsonSerializer, logger, dataPath, (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase)) { _logger = logger1; - _timerFactory = timerFactory; } public void RestartTimers() @@ -125,7 +123,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV private void StartTimer(TimerInfo item, TimeSpan dueTime) { - var timer = _timerFactory.Create(TimerCallback, item.Id, dueTime, TimeSpan.Zero); + var timer = new Timer(TimerCallback, item.Id, dueTime, TimeSpan.Zero); if (_timers.TryAdd(item.Id, timer)) { diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index b03345e03..fa0ab62d3 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -27,7 +27,6 @@ using MediaBrowser.Model.Library; using MediaBrowser.Model.Querying; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Session; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.Session @@ -60,7 +59,6 @@ namespace Emby.Server.Implementations.Session private readonly IAuthenticationRepository _authRepo; private readonly IDeviceManager _deviceManager; - private readonly ITimerFactory _timerFactory; /// /// The _active connections @@ -103,8 +101,7 @@ namespace Emby.Server.Implementations.Session IHttpClient httpClient, IAuthenticationRepository authRepo, IDeviceManager deviceManager, - IMediaSourceManager mediaSourceManager, - ITimerFactory timerFactory) + IMediaSourceManager mediaSourceManager) { _userDataManager = userDataManager; _logger = loggerFactory.CreateLogger(nameof(SessionManager)); @@ -119,7 +116,6 @@ namespace Emby.Server.Implementations.Session _authRepo = authRepo; _deviceManager = deviceManager; _mediaSourceManager = mediaSourceManager; - _timerFactory = timerFactory; _deviceManager.DeviceOptionsUpdated += _deviceManager_DeviceOptionsUpdated; } @@ -503,13 +499,13 @@ namespace Emby.Server.Implementations.Session return users; } - private ITimer _idleTimer; + private Timer _idleTimer; private void StartIdleCheckTimer() { if (_idleTimer == null) { - _idleTimer = _timerFactory.Create(CheckForIdlePlayback, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5)); + _idleTimer = new Timer(CheckForIdlePlayback, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5)); } } private void StopIdleCheckTimer() @@ -606,7 +602,7 @@ namespace Emby.Server.Implementations.Session ClearTranscodingInfo(session.DeviceId); } - session.StartAutomaticProgress(_timerFactory, info); + session.StartAutomaticProgress(info); var users = GetUsers(session); @@ -717,7 +713,7 @@ namespace Emby.Server.Implementations.Session if (!isAutomated) { - session.StartAutomaticProgress(_timerFactory, info); + session.StartAutomaticProgress(info); } StartIdleCheckTimer(); diff --git a/Emby.Server.Implementations/Threading/CommonTimer.cs b/Emby.Server.Implementations/Threading/CommonTimer.cs deleted file mode 100644 index 5a05da564..000000000 --- a/Emby.Server.Implementations/Threading/CommonTimer.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Threading; -using MediaBrowser.Model.Threading; - -namespace Emby.Server.Implementations.Threading -{ - public class CommonTimer : ITimer - { - private readonly Timer _timer; - - public CommonTimer(Action callback, object state, TimeSpan dueTime, TimeSpan period) - { - _timer = new Timer(new TimerCallback(callback), state, dueTime, period); - } - - public CommonTimer(Action callback, object state, int dueTimeMs, int periodMs) - { - _timer = new Timer(new TimerCallback(callback), state, dueTimeMs, periodMs); - } - - public void Change(TimeSpan dueTime, TimeSpan period) - { - _timer.Change(dueTime, period); - } - - public void Change(int dueTimeMs, int periodMs) - { - _timer.Change(dueTimeMs, periodMs); - } - - public void Dispose() - { - _timer.Dispose(); - } - } -} diff --git a/Emby.Server.Implementations/Threading/TimerFactory.cs b/Emby.Server.Implementations/Threading/TimerFactory.cs deleted file mode 100644 index ca50064c7..000000000 --- a/Emby.Server.Implementations/Threading/TimerFactory.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using MediaBrowser.Model.Threading; - -namespace Emby.Server.Implementations.Threading -{ - public class TimerFactory : ITimerFactory - { - public ITimer Create(Action callback, object state, TimeSpan dueTime, TimeSpan period) - { - return new CommonTimer(callback, state, dueTime, period); - } - - public ITimer Create(Action callback, object state, int dueTimeMs, int periodMs) - { - return new CommonTimer(callback, state, dueTimeMs, periodMs); - } - } -} diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index c1f753190..8dbc26356 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -18,7 +18,6 @@ using MediaBrowser.Model.Diagnostics; using MediaBrowser.Model.Dto; using MediaBrowser.Model.IO; using MediaBrowser.Model.Session; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace MediaBrowser.Api @@ -48,7 +47,6 @@ namespace MediaBrowser.Api private readonly ISessionManager _sessionManager; private readonly IFileSystem _fileSystem; private readonly IMediaSourceManager _mediaSourceManager; - public readonly ITimerFactory TimerFactory; public readonly IProcessFactory ProcessFactory; /// @@ -75,7 +73,6 @@ namespace MediaBrowser.Api IServerConfigurationManager config, IFileSystem fileSystem, IMediaSourceManager mediaSourceManager, - ITimerFactory timerFactory, IProcessFactory processFactory, IHttpResultFactory resultFactory) { @@ -84,7 +81,6 @@ namespace MediaBrowser.Api _config = config; _fileSystem = fileSystem; _mediaSourceManager = mediaSourceManager; - TimerFactory = timerFactory; ProcessFactory = processFactory; ResultFactory = resultFactory; @@ -260,7 +256,7 @@ namespace MediaBrowser.Api { lock (_activeTranscodingJobs) { - var job = new TranscodingJob(Logger, TimerFactory) + var job = new TranscodingJob(Logger) { Type = type, Path = path, @@ -765,9 +761,7 @@ namespace MediaBrowser.Api /// Gets or sets the kill timer. /// /// The kill timer. - private ITimer KillTimer { get; set; } - - private readonly ITimerFactory _timerFactory; + private Timer KillTimer { get; set; } public string DeviceId { get; set; } @@ -797,10 +791,9 @@ namespace MediaBrowser.Api public DateTime LastPingDate { get; set; } public int PingTimeout { get; set; } - public TranscodingJob(ILogger logger, ITimerFactory timerFactory) + public TranscodingJob(ILogger logger) { Logger = logger; - _timerFactory = timerFactory; } public void StopKillTimer() @@ -843,7 +836,7 @@ namespace MediaBrowser.Api if (KillTimer == null) { //Logger.LogDebug("Starting kill timer at {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId); - KillTimer = _timerFactory.Create(callback, this, intervalMs, Timeout.Infinite); + KillTimer = new Timer(new TimerCallback(callback), this, intervalMs, Timeout.Infinite); } else { diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 641d539f2..073686298 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -336,7 +336,7 @@ namespace MediaBrowser.Api.Playback { if (EnableThrottling(state)) { - transcodingJob.TranscodingThrottler = state.TranscodingThrottler = new TranscodingThrottler(transcodingJob, Logger, ServerConfigurationManager, ApiEntryPoint.Instance.TimerFactory, FileSystem); + transcodingJob.TranscodingThrottler = state.TranscodingThrottler = new TranscodingThrottler(transcodingJob, Logger, ServerConfigurationManager, FileSystem); state.TranscodingThrottler.Start(); } } diff --git a/MediaBrowser.Api/Playback/TranscodingThrottler.cs b/MediaBrowser.Api/Playback/TranscodingThrottler.cs index 9f416098a..0e73d77ef 100644 --- a/MediaBrowser.Api/Playback/TranscodingThrottler.cs +++ b/MediaBrowser.Api/Playback/TranscodingThrottler.cs @@ -1,9 +1,9 @@ using System; +using System.Threading; using System.Threading.Tasks; using MediaBrowser.Common.Configuration; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.IO; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace MediaBrowser.Api.Playback @@ -12,18 +12,16 @@ namespace MediaBrowser.Api.Playback { private readonly TranscodingJob _job; private readonly ILogger _logger; - private ITimer _timer; + private Timer _timer; private bool _isPaused; private readonly IConfigurationManager _config; - private readonly ITimerFactory _timerFactory; private readonly IFileSystem _fileSystem; - public TranscodingThrottler(TranscodingJob job, ILogger logger, IConfigurationManager config, ITimerFactory timerFactory, IFileSystem fileSystem) + public TranscodingThrottler(TranscodingJob job, ILogger logger, IConfigurationManager config, IFileSystem fileSystem) { _job = job; _logger = logger; _config = config; - _timerFactory = timerFactory; _fileSystem = fileSystem; } @@ -34,7 +32,7 @@ namespace MediaBrowser.Api.Playback public void Start() { - _timer = _timerFactory.Create(TimerCallback, null, 5000, 5000); + _timer = new Timer(TimerCallback, null, 5000, 5000); } private async void TimerCallback(object state) diff --git a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs index 4e7e1c8ed..4242a00e2 100644 --- a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs +++ b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs @@ -6,7 +6,6 @@ using System.Net.WebSockets; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.Net; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Net @@ -23,8 +22,8 @@ namespace MediaBrowser.Controller.Net /// /// The _active connections /// - protected readonly List> ActiveConnections = - new List>(); + protected readonly List> ActiveConnections = + new List>(); /// /// Gets the name. @@ -44,8 +43,6 @@ namespace MediaBrowser.Controller.Net /// protected ILogger Logger; - protected ITimerFactory TimerFactory { get; private set; } - protected BasePeriodicWebSocketListener(ILogger logger) { if (logger == null) @@ -111,7 +108,7 @@ namespace MediaBrowser.Controller.Net Logger.LogDebug("{1} Begin transmitting over websocket to {0}", message.Connection.RemoteEndPoint, GetType().Name); var timer = SendOnTimer ? - TimerFactory.Create(TimerCallback, message.Connection, Timeout.Infinite, Timeout.Infinite) : + new Timer(TimerCallback, message.Connection, Timeout.Infinite, Timeout.Infinite) : null; var state = new TStateType @@ -122,7 +119,7 @@ namespace MediaBrowser.Controller.Net lock (ActiveConnections) { - ActiveConnections.Add(new Tuple(message.Connection, cancellationTokenSource, timer, state)); + ActiveConnections.Add(new Tuple(message.Connection, cancellationTokenSource, timer, state)); } if (timer != null) @@ -139,7 +136,7 @@ namespace MediaBrowser.Controller.Net { var connection = (IWebSocketConnection)state; - Tuple tuple; + Tuple tuple; lock (ActiveConnections) { @@ -162,7 +159,7 @@ namespace MediaBrowser.Controller.Net protected void SendData(bool force) { - Tuple[] tuples; + Tuple[] tuples; lock (ActiveConnections) { @@ -190,7 +187,7 @@ namespace MediaBrowser.Controller.Net } } - private async void SendData(Tuple tuple) + private async void SendData(Tuple tuple) { var connection = tuple.Item1; @@ -249,7 +246,7 @@ namespace MediaBrowser.Controller.Net /// Disposes the connection. /// /// The connection. - private void DisposeConnection(Tuple connection) + private void DisposeConnection(Tuple connection) { Logger.LogDebug("{1} stop transmitting over websocket to {0}", connection.Item1.RemoteEndPoint, GetType().Name); diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index d698795dd..f0e81e8e7 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -1,10 +1,10 @@ using System; using System.Linq; +using System.Threading; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Session; -using MediaBrowser.Model.Threading; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Session @@ -268,10 +268,10 @@ namespace MediaBrowser.Controller.Session } private readonly object _progressLock = new object(); - private ITimer _progressTimer; + private Timer _progressTimer; private PlaybackProgressInfo _lastProgressInfo; - public void StartAutomaticProgress(ITimerFactory timerFactory, PlaybackProgressInfo progressInfo) + public void StartAutomaticProgress(PlaybackProgressInfo progressInfo) { if (_disposed) { @@ -284,7 +284,7 @@ namespace MediaBrowser.Controller.Session if (_progressTimer == null) { - _progressTimer = timerFactory.Create(OnProgressTimerCallback, null, 1000, 1000); + _progressTimer = new Timer(OnProgressTimerCallback, null, 1000, 1000); } else { diff --git a/MediaBrowser.Model/Threading/ITimer.cs b/MediaBrowser.Model/Threading/ITimer.cs deleted file mode 100644 index 2bec22266..000000000 --- a/MediaBrowser.Model/Threading/ITimer.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace MediaBrowser.Model.Threading -{ - public interface ITimer : IDisposable - { - void Change(TimeSpan dueTime, TimeSpan period); - void Change(int dueTimeMs, int periodMs); - } -} diff --git a/MediaBrowser.Model/Threading/ITimerFactory.cs b/MediaBrowser.Model/Threading/ITimerFactory.cs deleted file mode 100644 index 1161958a4..000000000 --- a/MediaBrowser.Model/Threading/ITimerFactory.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace MediaBrowser.Model.Threading -{ - public interface ITimerFactory - { - ITimer Create(Action callback, object state, TimeSpan dueTime, TimeSpan period); - ITimer Create(Action callback, object state, int dueTimeMs, int periodMs); - } -} diff --git a/RSSDP/SsdpDeviceLocator.cs b/RSSDP/SsdpDeviceLocator.cs index 1348cce8d..128bdfcbb 100644 --- a/RSSDP/SsdpDeviceLocator.cs +++ b/RSSDP/SsdpDeviceLocator.cs @@ -8,7 +8,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.Net; -using MediaBrowser.Model.Threading; namespace Rssdp.Infrastructure { @@ -23,8 +22,7 @@ namespace Rssdp.Infrastructure private List _Devices; private ISsdpCommunicationsServer _CommunicationsServer; - private ITimer _BroadcastTimer; - private ITimerFactory _timerFactory; + private Timer _BroadcastTimer; private object _timerLock = new object(); private readonly TimeSpan DefaultSearchWaitTime = TimeSpan.FromSeconds(4); @@ -37,12 +35,11 @@ namespace Rssdp.Infrastructure /// /// Default constructor. /// - public SsdpDeviceLocator(ISsdpCommunicationsServer communicationsServer, ITimerFactory timerFactory) + public SsdpDeviceLocator(ISsdpCommunicationsServer communicationsServer) { if (communicationsServer == null) throw new ArgumentNullException(nameof(communicationsServer)); _CommunicationsServer = communicationsServer; - _timerFactory = timerFactory; _CommunicationsServer.ResponseReceived += CommsServer_ResponseReceived; _Devices = new List(); @@ -94,7 +91,7 @@ namespace Rssdp.Infrastructure { if (_BroadcastTimer == null) { - _BroadcastTimer = _timerFactory.Create(OnBroadcastTimerCallback, null, dueTime, period); + _BroadcastTimer = new Timer(OnBroadcastTimerCallback, null, dueTime, period); } else { diff --git a/RSSDP/SsdpDevicePublisher.cs b/RSSDP/SsdpDevicePublisher.cs index 8a73e6a2d..ce64ba117 100644 --- a/RSSDP/SsdpDevicePublisher.cs +++ b/RSSDP/SsdpDevicePublisher.cs @@ -7,7 +7,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.Net; -using MediaBrowser.Model.Threading; using Rssdp; namespace Rssdp.Infrastructure @@ -27,8 +26,7 @@ namespace Rssdp.Infrastructure private IList _Devices; private IReadOnlyList _ReadOnlyDevices; - private ITimer _RebroadcastAliveNotificationsTimer; - private ITimerFactory _timerFactory; + private Timer _RebroadcastAliveNotificationsTimer; private IDictionary _RecentSearchRequests; @@ -39,7 +37,7 @@ namespace Rssdp.Infrastructure /// /// Default constructor. /// - public SsdpDevicePublisher(ISsdpCommunicationsServer communicationsServer, ITimerFactory timerFactory, string osName, string osVersion) + public SsdpDevicePublisher(ISsdpCommunicationsServer communicationsServer, string osName, string osVersion) { if (communicationsServer == null) throw new ArgumentNullException(nameof(communicationsServer)); if (osName == null) throw new ArgumentNullException(nameof(osName)); @@ -48,7 +46,6 @@ namespace Rssdp.Infrastructure if (osVersion.Length == 0) throw new ArgumentException("osVersion cannot be an empty string.", nameof(osName)); _SupportPnpRootDevice = true; - _timerFactory = timerFactory; _Devices = new List(); _ReadOnlyDevices = new ReadOnlyCollection(_Devices); _RecentSearchRequests = new Dictionary(StringComparer.OrdinalIgnoreCase); @@ -64,7 +61,7 @@ namespace Rssdp.Infrastructure public void StartBroadcastingAliveMessages(TimeSpan interval) { - _RebroadcastAliveNotificationsTimer = _timerFactory.Create(SendAllAliveNotifications, null, TimeSpan.FromSeconds(5), interval); + _RebroadcastAliveNotificationsTimer = new Timer(SendAllAliveNotifications, null, TimeSpan.FromSeconds(5), interval); } /// -- cgit v1.2.3 From f1ef0b0b4c54b2c370704aacb13a37e9abd4a6a0 Mon Sep 17 00:00:00 2001 From: Erwin de Haan Date: Sat, 9 Feb 2019 10:10:33 +0100 Subject: Fix namespacing so it lines up properly with file names and paths (#715) * Fix stupid namespacing so it lines up properly with file names and paths. --- Emby.Server.Implementations/ApplicationHost.cs | 1 - .../LiveTv/Listings/XmlTvListingsProvider.cs | 2 +- .../Networking/IPNetwork/BigIntegerExt.cs | 9 ++++----- .../Networking/IPNetwork/IPAddressCollection.cs | 6 ++++-- .../Networking/IPNetwork/IPNetwork.cs | 22 ++++++++++++---------- .../Networking/IPNetwork/IPNetworkCollection.cs | 7 ++++--- .../Networking/NetworkManager.cs | 2 +- .../Serialization/JsonSerializer.cs | 3 +-- .../UserViews/FolderImageProvider.cs | 2 +- Jellyfin.Server/CoreAppHost.cs | 2 +- Jellyfin.Server/SocketSharp/HttpFile.cs | 2 +- Jellyfin.Server/SocketSharp/RequestMono.cs | 2 +- Jellyfin.Server/SocketSharp/SharpWebSocket.cs | 2 +- .../SocketSharp/WebSocketSharpListener.cs | 2 +- .../SocketSharp/WebSocketSharpRequest.cs | 2 +- .../SocketSharp/WebSocketSharpResponse.cs | 2 +- .../Manager/GenericPriorityQueue.cs | 1 + .../Movies/FanartMovieImageProvider.cs | 1 + .../Music/FanArtArtistProvider.cs | 1 + .../People/TvdbPersonImageProvider.cs | 1 + .../TV/FanArt/FanArtSeasonProvider.cs | 2 +- .../TV/FanArt/FanartSeriesProvider.cs | 2 +- .../TV/MissingEpisodeProvider.cs | 1 + .../TV/Omdb/OmdbEpisodeProvider.cs | 2 +- .../TV/TheMovieDb/MovieDbEpisodeImageProvider.cs | 2 +- .../TV/TheMovieDb/MovieDbEpisodeProvider.cs | 2 +- .../TV/TheMovieDb/MovieDbProviderBase.cs | 2 +- .../TV/TheMovieDb/MovieDbSeasonProvider.cs | 2 +- .../TV/TheMovieDb/MovieDbSeriesImageProvider.cs | 2 +- .../TV/TheMovieDb/MovieDbSeriesProvider.cs | 2 +- .../TV/TheTVDB/TvdbEpisodeImageProvider.cs | 2 +- .../TV/TheTVDB/TvdbEpisodeProvider.cs | 2 +- .../TV/TheTVDB/TvdbPrescanTask.cs | 2 +- .../TV/TheTVDB/TvdbSeasonImageProvider.cs | 2 +- .../TV/TheTVDB/TvdbSeriesImageProvider.cs | 2 +- .../TV/TheTVDB/TvdbSeriesProvider.cs | 2 +- MediaBrowser.Providers/TV/TvExternalIds.cs | 1 + 37 files changed, 56 insertions(+), 48 deletions(-) (limited to 'Emby.Server.Implementations/LiveTv') diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 3808810cf..bb475eb2c 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -12,7 +12,6 @@ using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading; using System.Threading.Tasks; -using Emby.Common.Implementations.Serialization; using Emby.Dlna; using Emby.Dlna.Main; using Emby.Dlna.Ssdp; diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs index f152ac465..69b10e6da 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs @@ -17,7 +17,7 @@ using MediaBrowser.Model.IO; using MediaBrowser.Model.LiveTv; using Microsoft.Extensions.Logging; -namespace Jellyfin.Server.Implementations.LiveTv.Listings +namespace Emby.Server.Implementations.LiveTv.Listings { public class XmlTvListingsProvider : IListingsProvider { diff --git a/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs b/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs index 447cbf403..e4e944839 100644 --- a/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs +++ b/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs @@ -1,11 +1,10 @@ +using System; using System.Collections.Generic; +using System.Numerics; +using System.Text; -namespace System.Net +namespace Emby.Server.Implementations.Networking.IPNetwork { - using System; - using System.Numerics; - using System.Text; - /// /// Extension methods to convert /// instances to hexadecimal, octal, and binary strings. diff --git a/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs b/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs index c5853135c..a0c5f73af 100644 --- a/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs +++ b/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs @@ -1,8 +1,10 @@ +using System; using System.Collections; using System.Collections.Generic; +using System.Net; using System.Numerics; -namespace System.Net +namespace Emby.Server.Implementations.Networking.IPNetwork { public class IPAddressCollection : IEnumerable, IEnumerator { @@ -29,7 +31,7 @@ namespace System.Net { throw new ArgumentOutOfRangeException(nameof(i)); } - byte width = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetwork ? (byte)32 : (byte)128; + byte width = this._ipnetwork.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork ? (byte)32 : (byte)128; var ipn = this._ipnetwork.Subnet(width); return ipn[i].Network; } diff --git a/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs b/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs index 16f39daf7..d6de61c0c 100644 --- a/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs +++ b/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs @@ -1,10 +1,12 @@ +using System; using System.Collections.Generic; using System.IO; +using System.Net; using System.Net.Sockets; using System.Numerics; using System.Text.RegularExpressions; -namespace System.Net +namespace Emby.Server.Implementations.Networking.IPNetwork { /// /// IP Network utility class. @@ -60,7 +62,7 @@ namespace System.Net get { - int width = this._family == Sockets.AddressFamily.InterNetwork ? 4 : 16; + int width = this._family == System.Net.Sockets.AddressFamily.InterNetwork ? 4 : 16; var uintBroadcast = this._network + this._netmask.PositiveReverse(width); return uintBroadcast; } @@ -73,7 +75,7 @@ namespace System.Net { get { - if (this._family == Sockets.AddressFamily.InterNetworkV6) + if (this._family == System.Net.Sockets.AddressFamily.InterNetworkV6) { return null; } @@ -88,7 +90,7 @@ namespace System.Net { get { - var fisrt = this._family == Sockets.AddressFamily.InterNetworkV6 + var fisrt = this._family == System.Net.Sockets.AddressFamily.InterNetworkV6 ? this._network : (this.Usable <= 0) ? this._network : this._network + 1; return IPNetwork.ToIPAddress(fisrt, this._family); @@ -102,7 +104,7 @@ namespace System.Net { get { - var last = this._family == Sockets.AddressFamily.InterNetworkV6 + var last = this._family == System.Net.Sockets.AddressFamily.InterNetworkV6 ? this._broadcast : (this.Usable <= 0) ? this._network : this._broadcast - 1; return IPNetwork.ToIPAddress(last, this._family); @@ -117,7 +119,7 @@ namespace System.Net get { - if (this._family == Sockets.AddressFamily.InterNetworkV6) + if (this._family == System.Net.Sockets.AddressFamily.InterNetworkV6) { return this.Total; } @@ -136,7 +138,7 @@ namespace System.Net get { - int max = this._family == Sockets.AddressFamily.InterNetwork ? 32 : 128; + int max = this._family == System.Net.Sockets.AddressFamily.InterNetwork ? 32 : 128; var count = BigInteger.Pow(2, (max - _cidr)); return count; } @@ -161,7 +163,7 @@ namespace System.Net IPNetwork(BigInteger ipaddress, AddressFamily family, byte cidr) { - int maxCidr = family == Sockets.AddressFamily.InterNetwork ? 32 : 128; + int maxCidr = family == System.Net.Sockets.AddressFamily.InterNetwork ? 32 : 128; if (cidr > maxCidr) { throw new ArgumentOutOfRangeException(nameof(cidr)); @@ -930,7 +932,7 @@ namespace System.Net /// return; /// } - int maxCidr = family == Sockets.AddressFamily.InterNetwork ? 32 : 128; + int maxCidr = family == System.Net.Sockets.AddressFamily.InterNetwork ? 32 : 128; if (cidr > maxCidr) { if (tryParse == false) @@ -1303,7 +1305,7 @@ namespace System.Net return; } - int maxCidr = network._family == Sockets.AddressFamily.InterNetwork ? 32 : 128; + int maxCidr = network._family == System.Net.Sockets.AddressFamily.InterNetwork ? 32 : 128; if (cidr > maxCidr) { if (trySubnet == false) diff --git a/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs b/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs index 7d3106624..4cda421e5 100644 --- a/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs +++ b/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs @@ -1,8 +1,9 @@ +using System; using System.Collections; using System.Collections.Generic; using System.Numerics; -namespace System.Net +namespace Emby.Server.Implementations.Networking.IPNetwork { public class IPNetworkCollection : IEnumerable, IEnumerator { @@ -25,7 +26,7 @@ namespace System.Net IPNetworkCollection(IPNetwork ipnetwork, byte cidrSubnet) { - int maxCidr = ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetwork ? 32 : 128; + int maxCidr = ipnetwork.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork ? 32 : 128; if (cidrSubnet > maxCidr) { throw new ArgumentOutOfRangeException(nameof(cidrSubnet)); @@ -61,7 +62,7 @@ namespace System.Net throw new ArgumentOutOfRangeException(nameof(i)); } - var last = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetworkV6 + var last = this._ipnetwork.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6 ? this._lastUsable : this._broadcast; var increment = (last - this._network) / this.Count; var uintNetwork = this._network + ((increment + 1) * i); diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs index aa884664f..60cc9b88e 100644 --- a/Emby.Server.Implementations/Networking/NetworkManager.cs +++ b/Emby.Server.Implementations/Networking/NetworkManager.cs @@ -281,7 +281,7 @@ namespace Emby.Server.Implementations.Networking if (normalizedSubnet.IndexOf('/') != -1) { - var ipnetwork = IPNetwork.Parse(normalizedSubnet); + var ipnetwork = IPNetwork.IPNetwork.Parse(normalizedSubnet); if (ipnetwork.Contains(address)) { return true; diff --git a/Emby.Server.Implementations/Serialization/JsonSerializer.cs b/Emby.Server.Implementations/Serialization/JsonSerializer.cs index 53ef5d60c..44898d498 100644 --- a/Emby.Server.Implementations/Serialization/JsonSerializer.cs +++ b/Emby.Server.Implementations/Serialization/JsonSerializer.cs @@ -3,9 +3,8 @@ using System.IO; using System.Threading.Tasks; using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; -using Microsoft.Extensions.Logging; -namespace Emby.Common.Implementations.Serialization +namespace Emby.Server.Implementations.Serialization { /// /// Provides a wrapper around third party json serialization. diff --git a/Emby.Server.Implementations/UserViews/FolderImageProvider.cs b/Emby.Server.Implementations/UserViews/FolderImageProvider.cs index 7629f6039..c810004ab 100644 --- a/Emby.Server.Implementations/UserViews/FolderImageProvider.cs +++ b/Emby.Server.Implementations/UserViews/FolderImageProvider.cs @@ -11,7 +11,7 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; using MediaBrowser.Model.Querying; -namespace Emby.Server.Implementations.Photos +namespace Emby.Server.Implementations.UserViews { public abstract class BaseFolderImageProvider : BaseDynamicImageProvider where T : Folder, new() diff --git a/Jellyfin.Server/CoreAppHost.cs b/Jellyfin.Server/CoreAppHost.cs index 5182ab4d7..315e34a04 100644 --- a/Jellyfin.Server/CoreAppHost.cs +++ b/Jellyfin.Server/CoreAppHost.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Reflection; using Emby.Server.Implementations; using Emby.Server.Implementations.HttpServer; -using Jellyfin.SocketSharp; +using Jellyfin.Server.SocketSharp; using MediaBrowser.Model.IO; using MediaBrowser.Model.System; using Microsoft.Extensions.Logging; diff --git a/Jellyfin.Server/SocketSharp/HttpFile.cs b/Jellyfin.Server/SocketSharp/HttpFile.cs index 77ce03510..89c75e536 100644 --- a/Jellyfin.Server/SocketSharp/HttpFile.cs +++ b/Jellyfin.Server/SocketSharp/HttpFile.cs @@ -1,7 +1,7 @@ using System.IO; using MediaBrowser.Model.Services; -namespace Jellyfin.SocketSharp +namespace Jellyfin.Server.SocketSharp { public class HttpFile : IHttpFile { diff --git a/Jellyfin.Server/SocketSharp/RequestMono.cs b/Jellyfin.Server/SocketSharp/RequestMono.cs index e39ed30ea..a8ba4cdb5 100644 --- a/Jellyfin.Server/SocketSharp/RequestMono.cs +++ b/Jellyfin.Server/SocketSharp/RequestMono.cs @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; using MediaBrowser.Model.Services; -namespace Jellyfin.SocketSharp +namespace Jellyfin.Server.SocketSharp { public partial class WebSocketSharpRequest : IHttpRequest { diff --git a/Jellyfin.Server/SocketSharp/SharpWebSocket.cs b/Jellyfin.Server/SocketSharp/SharpWebSocket.cs index d0dcd86eb..f371cb25a 100644 --- a/Jellyfin.Server/SocketSharp/SharpWebSocket.cs +++ b/Jellyfin.Server/SocketSharp/SharpWebSocket.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using Emby.Server.Implementations.Net; using Microsoft.Extensions.Logging; -namespace Jellyfin.SocketSharp +namespace Jellyfin.Server.SocketSharp { public class SharpWebSocket : IWebSocket { diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpListener.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpListener.cs index c7f9f01b5..a44343ab2 100644 --- a/Jellyfin.Server/SocketSharp/WebSocketSharpListener.cs +++ b/Jellyfin.Server/SocketSharp/WebSocketSharpListener.cs @@ -15,7 +15,7 @@ using MediaBrowser.Model.System; using Microsoft.Extensions.Logging; using SocketHttpListener.Net; -namespace Jellyfin.SocketSharp +namespace Jellyfin.Server.SocketSharp { public class WebSocketSharpListener : IHttpListener { diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs index 38e8d9699..ebeb18ea0 100644 --- a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs +++ b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs @@ -11,7 +11,7 @@ using IHttpRequest = MediaBrowser.Model.Services.IHttpRequest; using IHttpResponse = MediaBrowser.Model.Services.IHttpResponse; using IResponse = MediaBrowser.Model.Services.IResponse; -namespace Jellyfin.SocketSharp +namespace Jellyfin.Server.SocketSharp { public partial class WebSocketSharpRequest : IHttpRequest { diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpResponse.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpResponse.cs index 21bfac55d..cabc96b23 100644 --- a/Jellyfin.Server/SocketSharp/WebSocketSharpResponse.cs +++ b/Jellyfin.Server/SocketSharp/WebSocketSharpResponse.cs @@ -14,7 +14,7 @@ using IHttpResponse = MediaBrowser.Model.Services.IHttpResponse; using IRequest = MediaBrowser.Model.Services.IRequest; -namespace Jellyfin.SocketSharp +namespace Jellyfin.Server.SocketSharp { public class WebSocketSharpResponse : IHttpResponse { diff --git a/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs b/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs index b87f688e1..10ff2515c 100644 --- a/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs +++ b/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; +//TODO Fix namespace or replace namespace Priority_Queue { /// diff --git a/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs b/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs index 4a94bcb1a..70d187bf5 100644 --- a/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs +++ b/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs @@ -20,6 +20,7 @@ using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; using MediaBrowser.Providers.Music; using MediaBrowser.Providers.TV; +using MediaBrowser.Providers.TV.FanArt; namespace MediaBrowser.Providers.Movies { diff --git a/MediaBrowser.Providers/Music/FanArtArtistProvider.cs b/MediaBrowser.Providers/Music/FanArtArtistProvider.cs index 2efeb6985..75b4213c5 100644 --- a/MediaBrowser.Providers/Music/FanArtArtistProvider.cs +++ b/MediaBrowser.Providers/Music/FanArtArtistProvider.cs @@ -20,6 +20,7 @@ using MediaBrowser.Model.Net; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; using MediaBrowser.Providers.TV; +using MediaBrowser.Providers.TV.FanArt; namespace MediaBrowser.Providers.Music { diff --git a/MediaBrowser.Providers/People/TvdbPersonImageProvider.cs b/MediaBrowser.Providers/People/TvdbPersonImageProvider.cs index cf2acdf49..181e88820 100644 --- a/MediaBrowser.Providers/People/TvdbPersonImageProvider.cs +++ b/MediaBrowser.Providers/People/TvdbPersonImageProvider.cs @@ -18,6 +18,7 @@ using MediaBrowser.Model.IO; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Xml; using MediaBrowser.Providers.TV; +using MediaBrowser.Providers.TV.TheTVDB; namespace MediaBrowser.Providers.People { diff --git a/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs b/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs index 493729446..58356910f 100644 --- a/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs +++ b/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs @@ -19,7 +19,7 @@ using MediaBrowser.Model.Net; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.FanArt { public class FanArtSeasonProvider : IRemoteImageProvider, IHasOrder { diff --git a/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs b/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs index 172a7d2b8..49cd9596e 100644 --- a/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs @@ -22,7 +22,7 @@ using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; using MediaBrowser.Providers.Music; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.FanArt { public class FanartSeriesProvider : IRemoteImageProvider, IHasOrder { diff --git a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs index 4ac012399..25ad36620 100644 --- a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs @@ -16,6 +16,7 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Globalization; using MediaBrowser.Model.IO; using MediaBrowser.Model.Xml; +using MediaBrowser.Providers.TV.TheTVDB; using Microsoft.Extensions.Logging; namespace MediaBrowser.Providers.TV diff --git a/MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs index 6f7d9f791..d0749405b 100644 --- a/MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs @@ -14,7 +14,7 @@ using MediaBrowser.Model.Serialization; using MediaBrowser.Providers.Omdb; using Microsoft.Extensions.Logging; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.Omdb { class OmdbEpisodeProvider : IRemoteMetadataProvider, diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeImageProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeImageProvider.cs index 2482aa8d4..e4248afe1 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeImageProvider.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeImageProvider.cs @@ -16,7 +16,7 @@ using MediaBrowser.Model.Serialization; using MediaBrowser.Providers.Movies; using Microsoft.Extensions.Logging; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.TheMovieDb { public class MovieDbEpisodeImageProvider : MovieDbProviderBase, diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs index 347c91742..44590515e 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs @@ -18,7 +18,7 @@ using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.TheMovieDb { class MovieDbEpisodeProvider : MovieDbProviderBase, diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbProviderBase.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbProviderBase.cs index 9f1102946..6e438ebd8 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbProviderBase.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbProviderBase.cs @@ -12,7 +12,7 @@ using MediaBrowser.Model.Serialization; using MediaBrowser.Providers.Movies; using Microsoft.Extensions.Logging; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.TheMovieDb { public abstract class MovieDbProviderBase { diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs index 790b38074..6be1b101d 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs @@ -18,7 +18,7 @@ using MediaBrowser.Model.Serialization; using MediaBrowser.Providers.Movies; using Microsoft.Extensions.Logging; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.TheMovieDb { public class MovieDbSeasonProvider : IRemoteMetadataProvider { diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesImageProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesImageProvider.cs index fdc8cd7f1..26686356f 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesImageProvider.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesImageProvider.cs @@ -14,7 +14,7 @@ using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; using MediaBrowser.Providers.Movies; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.TheMovieDb { public class MovieDbSeriesImageProvider : IRemoteImageProvider, IHasOrder { diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs index 76031a7cd..b51fb6af8 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs @@ -20,7 +20,7 @@ using MediaBrowser.Model.Serialization; using MediaBrowser.Providers.Movies; using Microsoft.Extensions.Logging; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.TheMovieDb { public class MovieDbSeriesProvider : IRemoteMetadataProvider, IHasOrder { diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs index 39d2fa77a..102a3d4ec 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs @@ -14,7 +14,7 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; using MediaBrowser.Model.Providers; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.TheTVDB { public class TvdbEpisodeImageProvider : IRemoteImageProvider { diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs index 25fc214b5..be137e879 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs @@ -18,7 +18,7 @@ using MediaBrowser.Model.Providers; using MediaBrowser.Model.Xml; using Microsoft.Extensions.Logging; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.TheTVDB { /// diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs index 6f7cb72d3..d45696057 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs @@ -19,7 +19,7 @@ using MediaBrowser.Model.Net; using MediaBrowser.Model.Xml; using Microsoft.Extensions.Logging; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.TheTVDB { /// /// Class TvdbPrescanTask diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs index af36d1ebf..01ede44bb 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs @@ -19,7 +19,7 @@ using MediaBrowser.Model.IO; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Xml; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.TheTVDB { public class TvdbSeasonImageProvider : IRemoteImageProvider, IHasOrder { diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs index 82fa14f49..2b4337ed1 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs @@ -19,7 +19,7 @@ using MediaBrowser.Model.IO; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Xml; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.TheTVDB { public class TvdbSeriesImageProvider : IRemoteImageProvider, IHasOrder { diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs index 6006ed052..52e60a8ed 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs @@ -23,7 +23,7 @@ using MediaBrowser.Model.Providers; using MediaBrowser.Model.Xml; using Microsoft.Extensions.Logging; -namespace MediaBrowser.Providers.TV +namespace MediaBrowser.Providers.TV.TheTVDB { public class TvdbSeriesProvider : IRemoteMetadataProvider, IHasOrder { diff --git a/MediaBrowser.Providers/TV/TvExternalIds.cs b/MediaBrowser.Providers/TV/TvExternalIds.cs index 001ce1465..5c246e300 100644 --- a/MediaBrowser.Providers/TV/TvExternalIds.cs +++ b/MediaBrowser.Providers/TV/TvExternalIds.cs @@ -1,6 +1,7 @@ using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; +using MediaBrowser.Providers.TV.TheTVDB; namespace MediaBrowser.Providers.TV { -- cgit v1.2.3