From ded9dee22c38e443a237d738bef97bd6d4442324 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Fri, 25 Jan 2019 23:05:01 +0100 Subject: [PATCH] Remove more compile time warnings --- .../Activity/ActivityLogEntryPoint.cs | 1 - .../ApplicationHost.cs | 3 +-- MediaBrowser.Api/PluginService.cs | 26 ++++++------------- .../UserLibrary/PlaystateService.cs | 10 +++---- .../Subtitles/ISubtitleManager.cs | 5 ---- .../Subtitles/SubtitleManager.cs | 9 ------- 6 files changed, 14 insertions(+), 40 deletions(-) diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs index aef72c697..d6a7c8b37 100644 --- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs +++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs @@ -502,7 +502,6 @@ namespace Emby.Server.Implementations.Activity _sessionManager.PlaybackStart -= _sessionManager_PlaybackStart; _sessionManager.PlaybackStopped -= _sessionManager_PlaybackStopped; - _subManager.SubtitlesDownloaded -= _subManager_SubtitlesDownloaded; _subManager.SubtitleDownloadFailure -= _subManager_SubtitleDownloadFailure; _userManager.UserCreated -= _userManager_UserCreated; diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index f5a4f1581..07e3368fe 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -112,7 +112,6 @@ using ServiceStack; using ServiceStack.Text.Jsv; using StringExtensions = MediaBrowser.Controller.Extensions.StringExtensions; using X509Certificate = System.Security.Cryptography.X509Certificates.X509Certificate; -using UtfUnknown; namespace Emby.Server.Implementations { @@ -888,7 +887,7 @@ namespace Emby.Server.Implementations MediaSourceManager = new MediaSourceManager(ItemRepository, ApplicationPaths, LocalizationManager, UserManager, LibraryManager, LoggerFactory, JsonSerializer, FileSystemManager, UserDataManager, TimerFactory, () => MediaEncoder); RegisterSingleInstance(MediaSourceManager); - SubtitleManager = new SubtitleManager(LoggerFactory, FileSystemManager, LibraryMonitor, MediaSourceManager, ServerConfigurationManager, LocalizationManager); + SubtitleManager = new SubtitleManager(LoggerFactory, FileSystemManager, LibraryMonitor, MediaSourceManager, LocalizationManager); RegisterSingleInstance(SubtitleManager); ProviderManager = new ProviderManager(HttpClient, SubtitleManager, ServerConfigurationManager, LibraryMonitor, LoggerFactory, FileSystemManager, ApplicationPaths, () => LibraryManager, JsonSerializer); diff --git a/MediaBrowser.Api/PluginService.cs b/MediaBrowser.Api/PluginService.cs index 94be45474..af61887b2 100644 --- a/MediaBrowser.Api/PluginService.cs +++ b/MediaBrowser.Api/PluginService.cs @@ -153,7 +153,11 @@ namespace MediaBrowser.Api private readonly INetworkManager _network; private readonly IDeviceManager _deviceManager; - public PluginService(IJsonSerializer jsonSerializer, IApplicationHost appHost, IInstallationManager installationManager, INetworkManager network, IDeviceManager deviceManager) + public PluginService(IJsonSerializer jsonSerializer, + IApplicationHost appHost, + IInstallationManager installationManager, + INetworkManager network, + IDeviceManager deviceManager) : base() { if (jsonSerializer == null) @@ -173,7 +177,7 @@ namespace MediaBrowser.Api /// /// The request. /// System.Object. - public async Task Get(GetRegistrationStatus request) + public object Get(GetRegistrationStatus request) { var record = new MBRegistrationRecord { @@ -187,26 +191,12 @@ namespace MediaBrowser.Api return ToOptimizedResult(record); } - //TODO this function is only kept for compatibility and should be removed once paid plugins break - public async Task Get(GetRegistration request) - { - var info = new RegistrationInfo - { - ExpirationDate = DateTime.Now.AddYears(100), - IsRegistered = true, - IsTrial = false, - Name = request.Name - }; - - return ToOptimizedResult(info); - } - /// /// Gets the specified request. /// /// The request. /// System.Object. - public async Task Get(GetPlugins request) + public object Get(GetPlugins request) { var result = _appHost.Plugins.OrderBy(p => p.Name).Select(p => p.GetPluginInfo()).ToArray(); return ToOptimizedResult(result); @@ -230,7 +220,7 @@ namespace MediaBrowser.Api /// /// The request. /// System.Object. - public async Task Get(GetPluginSecurityInfo request) + public object Get(GetPluginSecurityInfo request) { var result = new PluginSecurityInfo { diff --git a/MediaBrowser.Api/UserLibrary/PlaystateService.cs b/MediaBrowser.Api/UserLibrary/PlaystateService.cs index 76f91e373..72a943092 100644 --- a/MediaBrowser.Api/UserLibrary/PlaystateService.cs +++ b/MediaBrowser.Api/UserLibrary/PlaystateService.cs @@ -267,13 +267,13 @@ namespace MediaBrowser.Api.UserLibrary var session = GetSession(_sessionContext); - var dto = await UpdatePlayedStatus(user, request.Id, true, datePlayed).ConfigureAwait(false); + var dto = UpdatePlayedStatus(user, request.Id, true, datePlayed); foreach (var additionalUserInfo in session.AdditionalUsers) { var additionalUser = _userManager.GetUserById(additionalUserInfo.UserId); - await UpdatePlayedStatus(additionalUser, request.Id, true, datePlayed).ConfigureAwait(false); + UpdatePlayedStatus(additionalUser, request.Id, true, datePlayed); } return dto; @@ -412,13 +412,13 @@ namespace MediaBrowser.Api.UserLibrary var session = GetSession(_sessionContext); - var dto = await UpdatePlayedStatus(user, request.Id, false, null).ConfigureAwait(false); + var dto = UpdatePlayedStatus(user, request.Id, false, null); foreach (var additionalUserInfo in session.AdditionalUsers) { var additionalUser = _userManager.GetUserById(additionalUserInfo.UserId); - await UpdatePlayedStatus(additionalUser, request.Id, false, null).ConfigureAwait(false); + UpdatePlayedStatus(additionalUser, request.Id, false, null); } return dto; @@ -432,7 +432,7 @@ namespace MediaBrowser.Api.UserLibrary /// if set to true [was played]. /// The date played. /// Task. - private async Task UpdatePlayedStatus(User user, string itemId, bool wasPlayed, DateTime? datePlayed) + private UserItemDataDto UpdatePlayedStatus(User user, string itemId, bool wasPlayed, DateTime? datePlayed) { var item = _libraryManager.GetItemById(itemId); diff --git a/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs b/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs index 2ee58bbe6..0872335c5 100644 --- a/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs +++ b/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs @@ -15,11 +15,6 @@ namespace MediaBrowser.Controller.Subtitles /// event EventHandler SubtitleDownloadFailure; - /// - /// Occurs when [subtitles downloaded]. - /// - event EventHandler SubtitlesDownloaded; - /// /// Adds the parts. /// diff --git a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs index 468ba730a..57e827061 100644 --- a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs +++ b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs @@ -30,9 +30,7 @@ namespace MediaBrowser.Providers.Subtitles private readonly IFileSystem _fileSystem; private readonly ILibraryMonitor _monitor; private readonly IMediaSourceManager _mediaSourceManager; - private readonly IServerConfigurationManager _config; - public event EventHandler SubtitlesDownloaded; public event EventHandler SubtitleDownloadFailure; private ILocalizationManager _localization; @@ -42,14 +40,12 @@ namespace MediaBrowser.Providers.Subtitles IFileSystem fileSystem, ILibraryMonitor monitor, IMediaSourceManager mediaSourceManager, - IServerConfigurationManager config, ILocalizationManager localizationManager) { _logger = loggerFactory.CreateLogger(nameof(SubtitleManager)); _fileSystem = fileSystem; _monitor = monitor; _mediaSourceManager = mediaSourceManager; - _config = config; _localization = localizationManager; } @@ -134,11 +130,6 @@ namespace MediaBrowser.Providers.Subtitles return results.SelectMany(i => i).ToArray(); } - private SubtitleOptions GetOptions() - { - return _config.GetConfiguration("subtitles"); - } - public Task DownloadSubtitles(Video video, string subtitleId, CancellationToken cancellationToken) { var libraryOptions = BaseItem.LibraryManager.GetLibraryOptions(video);