The Free Software Media System - Server Backend & API
More cleanup
Bond_009ea8f40e84a72
diff --git a/Emby.Dlna/Didl/Filter.cs b/Emby.Dlna/Didl/Filter.csindex d703f043eb..6db6f3ae30 100644--- a/Emby.Dlna/Didl/Filter.cs+++ b/Emby.Dlna/Didl/Filter.cs@@ -17,8 +17,7 @@ namespace Emby.Dlna.Didlpublic Filter(string filter){_all = string.Equals(filter, "*", StringComparison.OrdinalIgnoreCase);-- _fields = (filter ?? string.Empty).Split(',', StringSplitOptions.RemoveEmptyEntries);+ _fields = filter.Split(',', StringSplitOptions.RemoveEmptyEntries);}public bool Contains(string field)diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.csindex 0b22880003..34fb8fddd6 100644--- a/Emby.Dlna/PlayTo/Device.cs+++ b/Emby.Dlna/PlayTo/Device.cs@@ -1179,6 +1179,7 @@ namespace Emby.Dlna.PlayToreturn new Device(deviceProperties, httpClientFactory, logger);}+#nullable enableprivate static DeviceIcon CreateIcon(XElement element){if (element == null)@@ -1186,68 +1187,60 @@ namespace Emby.Dlna.PlayTothrow new ArgumentNullException(nameof(element));}- var mimeType = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("mimetype"));var width = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("width"));var height = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("height"));- var depth = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("depth"));- var url = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("url"));- var widthValue = int.Parse(width, NumberStyles.Integer, CultureInfo.InvariantCulture);- var heightValue = int.Parse(height, NumberStyles.Integer, CultureInfo.InvariantCulture);+ _ = int.TryParse(width, NumberStyles.Integer, CultureInfo.InvariantCulture, out var widthValue);+ _ = int.TryParse(height, NumberStyles.Integer, CultureInfo.InvariantCulture, out var heightValue);return new DeviceIcon{- Depth = depth,+ Depth = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("depth")) ?? string.Empty,Height = heightValue,- MimeType = mimeType,- Url = url,+ MimeType = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("mimetype")) ?? string.Empty,+ Url = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("url")) ?? string.Empty,Width = widthValue};}private static DeviceService Create(XElement element)- {- var type = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("serviceType"));- var id = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("serviceId"));- var scpdUrl = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("SCPDURL"));- var controlURL = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("controlURL"));- var eventSubURL = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("eventSubURL"));-- return new DeviceService- {- ControlUrl = controlURL,- EventSubUrl = eventSubURL,- ScpdUrl = scpdUrl,- ServiceId = id,- ServiceType = type+ => new DeviceService()+ {+ ControlUrl = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("controlURL")) ?? string.Empty,+ EventSubUrl = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("eventSubURL")) ?? string.Empty,+ ScpdUrl = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("SCPDURL")) ?? string.Empty,+ ServiceId = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("serviceId")) ?? string.Empty,+ ServiceType = element.GetDescendantValue(UPnpNamespaces.Ud.GetName("serviceType")) ?? string.Empty};- }- private void UpdateMediaInfo(UBaseObject mediaInfo, TransportState state)+ private void UpdateMediaInfo(UBaseObject? mediaInfo, TransportState state){TransportState = state;var previousMediaInfo = CurrentMediaInfo;CurrentMediaInfo = mediaInfo;- if (previousMediaInfo == null && mediaInfo != null)+ if (mediaInfo == null){- if (state != TransportState.Stopped)+ if (previousMediaInfo != null){- OnPlaybackStart(mediaInfo);+ OnPlaybackStop(previousMediaInfo);}}- else if (mediaInfo != null && previousMediaInfo != null && !mediaInfo.Equals(previousMediaInfo))+ else if (previousMediaInfo == null){- OnMediaChanged(previousMediaInfo, mediaInfo);+ if (state != TransportState.Stopped)+ {+ OnPlaybackStart(mediaInfo);+ }}- else if (mediaInfo == null && previousMediaInfo != null)+ else if (mediaInfo.Equals(previousMediaInfo)){- OnPlaybackStop(previousMediaInfo);+ OnPlaybackProgress(mediaInfo);}- else if (mediaInfo != null && mediaInfo.Equals(previousMediaInfo))+ else{- OnPlaybackProgress(mediaInfo);+ OnMediaChanged(previousMediaInfo, mediaInfo);}}diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.csindex f25d8017ef..d0c9df68e3 100644--- a/Emby.Dlna/PlayTo/PlayToController.cs+++ b/Emby.Dlna/PlayTo/PlayToController.cs@@ -210,9 +210,9 @@ namespace Emby.Dlna.PlayTovar mediaSource = await streamInfo.GetMediaSource(CancellationToken.None).ConfigureAwait(false);- var duration = mediaSource == null ?- (_device.Duration == null ? (long?)null : _device.Duration.Value.Ticks) :- mediaSource.RunTimeTicks;+ var duration = mediaSource == null+ ? _device.Duration?.Ticks+ : mediaSource.RunTimeTicks;var playedToCompletion = positionTicks.HasValue && positionTicks.Value == 0;diff --git a/Emby.Dlna/PlayTo/TransportCommands.cs b/Emby.Dlna/PlayTo/TransportCommands.csindex b58669355d..d373b57f55 100644--- a/Emby.Dlna/PlayTo/TransportCommands.cs+++ b/Emby.Dlna/PlayTo/TransportCommands.cs@@ -175,7 +175,7 @@ namespace Emby.Dlna.PlayTovar sendValue = state.AllowedValues.FirstOrDefault(a => string.Equals(a, commandParameter, StringComparison.OrdinalIgnoreCase)) ??(state.AllowedValues.Count > 0 ? state.AllowedValues[0] : value);- return string.Format(CultureInfo.InvariantCulture, "<{0} xmlns:dt=\"urn:schemas-microsoft-com:datatypes\" dt:dt=\"{1}\">{2}</{0}>", argument.Name, state.DataType ?? "string", sendValue);+ return string.Format(CultureInfo.InvariantCulture, "<{0} xmlns:dt=\"urn:schemas-microsoft-com:datatypes\" dt:dt=\"{1}\">{2}</{0}>", argument.Name, state.DataType, sendValue);}return string.Format(CultureInfo.InvariantCulture, "<{0}>{1}</{0}>", argument.Name, value);diff --git a/Emby.Dlna/Profiles/DefaultProfile.cs b/Emby.Dlna/Profiles/DefaultProfile.csindex 8eaf12ba9a..8f4f2bd384 100644--- a/Emby.Dlna/Profiles/DefaultProfile.cs+++ b/Emby.Dlna/Profiles/DefaultProfile.cs@@ -167,8 +167,7 @@ namespace Emby.Dlna.Profilespublic void AddXmlRootAttribute(string name, string value){- var atts = XmlRootAttributes ?? System.Array.Empty<XmlAttribute>();- var list = atts.ToList();+ var list = XmlRootAttributes.ToList();list.Add(new XmlAttribute{diff --git a/Emby.Dlna/Server/DescriptionXmlBuilder.cs b/Emby.Dlna/Server/DescriptionXmlBuilder.csindex 80a45f2b25..8adaaea77e 100644--- a/Emby.Dlna/Server/DescriptionXmlBuilder.cs+++ b/Emby.Dlna/Server/DescriptionXmlBuilder.cs@@ -189,7 +189,7 @@ namespace Emby.Dlna.Serverbuilder.Append("<icon>");builder.Append("<mimetype>")- .Append(SecurityElement.Escape(icon.MimeType ?? string.Empty))+ .Append(SecurityElement.Escape(icon.MimeType)).Append("</mimetype>");builder.Append("<width>").Append(SecurityElement.Escape(icon.Width.ToString(CultureInfo.InvariantCulture)))@@ -198,7 +198,7 @@ namespace Emby.Dlna.Server.Append(SecurityElement.Escape(icon.Height.ToString(CultureInfo.InvariantCulture))).Append("</height>");builder.Append("<depth>")- .Append(SecurityElement.Escape(icon.Depth ?? string.Empty))+ .Append(SecurityElement.Escape(icon.Depth)).Append("</depth>");builder.Append("<url>").Append(BuildUrl(icon.Url))@@ -219,10 +219,10 @@ namespace Emby.Dlna.Serverbuilder.Append("<service>");builder.Append("<serviceType>")- .Append(SecurityElement.Escape(service.ServiceType ?? string.Empty))+ .Append(SecurityElement.Escape(service.ServiceType)).Append("</serviceType>");builder.Append("<serviceId>")- .Append(SecurityElement.Escape(service.ServiceId ?? string.Empty))+ .Append(SecurityElement.Escape(service.ServiceId)).Append("</serviceId>");builder.Append("<SCPDURL>").Append(BuildUrl(service.ScpdUrl))diff --git a/Emby.Dlna/Service/ServiceXmlBuilder.cs b/Emby.Dlna/Service/ServiceXmlBuilder.csindex 1e56d09b29..6e0bc6ad8b 100644--- a/Emby.Dlna/Service/ServiceXmlBuilder.cs+++ b/Emby.Dlna/Service/ServiceXmlBuilder.cs@@ -38,7 +38,7 @@ namespace Emby.Dlna.Servicebuilder.Append("<action>");builder.Append("<name>")- .Append(SecurityElement.Escape(item.Name ?? string.Empty))+ .Append(SecurityElement.Escape(item.Name)).Append("</name>");builder.Append("<argumentList>");@@ -48,13 +48,13 @@ namespace Emby.Dlna.Servicebuilder.Append("<argument>");builder.Append("<name>")- .Append(SecurityElement.Escape(argument.Name ?? string.Empty))+ .Append(SecurityElement.Escape(argument.Name)).Append("</name>");builder.Append("<direction>")- .Append(SecurityElement.Escape(argument.Direction ?? string.Empty))+ .Append(SecurityElement.Escape(argument.Direction)).Append("</direction>");builder.Append("<relatedStateVariable>")- .Append(SecurityElement.Escape(argument.RelatedStateVariable ?? string.Empty))+ .Append(SecurityElement.Escape(argument.RelatedStateVariable)).Append("</relatedStateVariable>");builder.Append("</argument>");@@ -81,10 +81,10 @@ namespace Emby.Dlna.Service.Append("\">");builder.Append("<name>")- .Append(SecurityElement.Escape(item.Name ?? string.Empty))+ .Append(SecurityElement.Escape(item.Name)).Append("</name>");builder.Append("<dataType>")- .Append(SecurityElement.Escape(item.DataType ?? string.Empty))+ .Append(SecurityElement.Escape(item.DataType)).Append("</dataType>");if (item.AllowedValues.Count > 0)diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.csindex 8ea711abe2..c9847aa2d8 100644--- a/Emby.Drawing/ImageProcessor.cs+++ b/Emby.Drawing/ImageProcessor.cs@@ -242,7 +242,7 @@ namespace Emby.Drawingreturn ImageFormat.Jpg;}- private string? GetMimeType(ImageFormat format, string path)+ private string GetMimeType(ImageFormat format, string path)=> format switch{ImageFormat.Bmp => MimeTypes.GetMimeType("i.bmp"),diff --git a/Emby.Naming/TV/SeriesPathParser.cs b/Emby.Naming/TV/SeriesPathParser.csindex 4dfbb36a37..23067e6a44 100644--- a/Emby.Naming/TV/SeriesPathParser.cs+++ b/Emby.Naming/TV/SeriesPathParser.cs@@ -50,7 +50,7 @@ namespace Emby.Naming.TVif (expression.IsNamed){result.SeriesName = match.Groups["seriesname"].Value;- result.Success = !string.IsNullOrEmpty(result.SeriesName) && !string.IsNullOrEmpty(match.Groups["seasonnumber"]?.Value);+ result.Success = !string.IsNullOrEmpty(result.SeriesName) && !match.Groups["seasonnumber"].ValueSpan.IsEmpty;}}diff --git a/Emby.Notifications/CoreNotificationTypes.cs b/Emby.Notifications/CoreNotificationTypes.csindex ec3490e23b..35aac3a11c 100644--- a/Emby.Notifications/CoreNotificationTypes.cs+++ b/Emby.Notifications/CoreNotificationTypes.cs@@ -24,63 +24,63 @@ namespace Emby.Notifications{new NotificationTypeInfo{- Type = NotificationType.ApplicationUpdateInstalled.ToString()+ Type = nameof(NotificationType.ApplicationUpdateInstalled)},new NotificationTypeInfo{- Type = NotificationType.InstallationFailed.ToString()+ Type = nameof(NotificationType.InstallationFailed)},new NotificationTypeInfo{- Type = NotificationType.PluginInstalled.ToString()+ Type = nameof(NotificationType.PluginInstalled)},new NotificationTypeInfo{- Type = NotificationType.PluginError.ToString()+ Type = nameof(NotificationType.PluginError)},new NotificationTypeInfo{- Type = NotificationType.PluginUninstalled.ToString()+ Type = nameof(NotificationType.PluginUninstalled)},new NotificationTypeInfo{- Type = NotificationType.PluginUpdateInstalled.ToString()+ Type = nameof(NotificationType.PluginUpdateInstalled)},new NotificationTypeInfo{- Type = NotificationType.ServerRestartRequired.ToString()+ Type = nameof(NotificationType.ServerRestartRequired)},new NotificationTypeInfo{- Type = NotificationType.TaskFailed.ToString()+ Type = nameof(NotificationType.TaskFailed)},new NotificationTypeInfo{- Type = NotificationType.NewLibraryContent.ToString()+ Type = nameof(NotificationType.NewLibraryContent)},new NotificationTypeInfo{- Type = NotificationType.AudioPlayback.ToString()+ Type = nameof(NotificationType.AudioPlayback)},new NotificationTypeInfo{- Type = NotificationType.VideoPlayback.ToString()+ Type = nameof(NotificationType.VideoPlayback)},new NotificationTypeInfo{- Type = NotificationType.AudioPlaybackStopped.ToString()+ Type = nameof(NotificationType.AudioPlaybackStopped)},new NotificationTypeInfo{- Type = NotificationType.VideoPlaybackStopped.ToString()+ Type = nameof(NotificationType.VideoPlaybackStopped)},new NotificationTypeInfo{- Type = NotificationType.UserLockedOut.ToString()+ Type = nameof(NotificationType.UserLockedOut)},new NotificationTypeInfo{- Type = NotificationType.ApplicationUpdateAvailable.ToString()+ Type = nameof(NotificationType.ApplicationUpdateAvailable)}};@@ -98,7 +98,7 @@ namespace Emby.Notificationsprivate void Update(NotificationTypeInfo note){- note.Name = _localization.GetLocalizedString("NotificationOption" + note.Type) ?? note.Type;+ note.Name = _localization.GetLocalizedString("NotificationOption" + note.Type);note.IsBasedOnUserEvent = note.Type.IndexOf("Playback", StringComparison.OrdinalIgnoreCase) != -1;diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.csindex 5ba4749a60..19fe0b1085 100644--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs@@ -371,7 +371,7 @@ namespace Emby.Server.Implementations.AppBaseNewConfiguration = configuration});- _configurations.AddOrUpdate(key, configuration, (k, v) => configuration);+ _configurations.AddOrUpdate(key, configuration, (_, _) => configuration);var path = GetConfigurationFile(key);Directory.CreateDirectory(Path.GetDirectoryName(path));diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.csindex 7fafbc9bea..a6b48b2120 100644--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs@@ -282,8 +282,6 @@ namespace Emby.Server.Implementations.Datatypeof(AggregateFolder)};- private readonly Dictionary<string, string> _types = GetTypeMapDictionary();-private static readonly Dictionary<BaseItemKind, string> _baseItemKindNames = new(){{ BaseItemKind.AggregateFolder, typeof(AggregateFolder).FullName },@@ -3440,11 +3438,6 @@ namespace Emby.Server.Implementations.Datareturn true;}- private bool IsValidType(string value)- {- return IsAlphaNumeric(value);- }-private bool IsValidMediaType(string value){return IsAlphaNumeric(value);@@ -4711,7 +4704,7 @@ namespace Emby.Server.Implementations.Dataif (statement == null){int index = 0;- string excludedTags = string.Join(',', query.ExcludeInheritedTags.Select(t => paramName + index++));+ string excludedTags = string.Join(',', query.ExcludeInheritedTags.Select(_ => paramName + index++));whereClauses.Add("((select CleanValue from itemvalues where ItemId=Guid and Type=6 and cleanvalue in (" + excludedTags + ")) is null)");}else@@ -4968,21 +4961,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type}}- private static Dictionary<string, string> GetTypeMapDictionary()- {- var dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);-- foreach (var t in _knownTypes)- {- dict[t.Name] = t.FullName;- }-- dict["Program"] = typeof(LiveTvProgram).FullName;- dict["TvChannel"] = typeof(LiveTvChannel).FullName;-- return dict;- }-public void DeleteItem(Guid id){if (id == Guid.Empty)diff --git a/Emby.Server.Implementations/Devices/DeviceId.cs b/Emby.Server.Implementations/Devices/DeviceId.csindex 0cfced8beb..b3f5549bcd 100644--- a/Emby.Server.Implementations/Devices/DeviceId.cs+++ b/Emby.Server.Implementations/Devices/DeviceId.cs@@ -37,7 +37,7 @@ namespace Emby.Server.Implementations.Devices{var value = File.ReadAllText(CachePath, Encoding.UTF8);- if (Guid.TryParse(value, out var guid))+ if (Guid.TryParse(value, out _)){return value;}diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.csindex a6406827cc..7ba34e74af 100644--- a/Emby.Server.Implementations/Dto/DtoService.cs+++ b/Emby.Server.Implementations/Dto/DtoService.cs@@ -109,7 +109,7 @@ namespace Emby.Server.Implementations.Dto}});- SetItemByNameInfo(item, dto, libraryItems, user);+ SetItemByNameInfo(item, dto, libraryItems);}}@@ -153,8 +153,7 @@ namespace Emby.Server.Implementations.Dtonew DtoOptions(false){EnableImages = false- }),- user);+ }));}return dto;@@ -311,13 +310,13 @@ namespace Emby.Server.Implementations.Dtoif (taggedItems != null && options.ContainsField(ItemFields.ItemCounts)){- SetItemByNameInfo(item, dto, taggedItems, user);+ SetItemByNameInfo(item, dto, taggedItems);}return dto;}- private static void SetItemByNameInfo(BaseItem item, BaseItemDto dto, IList<BaseItem> taggedItems, User user = null)+ private static void SetItemByNameInfo(BaseItem item, BaseItemDto dto, IList<BaseItem> taggedItems){if (item is MusicArtist){diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.csindex 331de45c1e..4a5f723273 100644--- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs+++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs@@ -101,7 +101,7 @@ namespace Emby.Server.Implementations.EntryPoints}}- _lastProgressMessageTimes.AddOrUpdate(item.Id, key => DateTime.UtcNow, (key, existing) => DateTime.UtcNow);+ _lastProgressMessageTimes.AddOrUpdate(item.Id, _ => DateTime.UtcNow, (_, _) => DateTime.UtcNow);var dict = new Dictionary<string, string>();dict["ItemId"] = item.Id.ToString("N", CultureInfo.InvariantCulture);@@ -144,7 +144,7 @@ namespace Emby.Server.Implementations.EntryPoints{OnProviderRefreshProgress(sender, new GenericEventArgs<Tuple<BaseItem, double>>(new Tuple<BaseItem, double>(e.Argument, 100)));- _lastProgressMessageTimes.TryRemove(e.Argument.Id, out DateTime removed);+ _lastProgressMessageTimes.TryRemove(e.Argument.Id, out _);}private static bool EnableRefreshMessage(BaseItem item)@@ -423,7 +423,6 @@ namespace Emby.Server.Implementations.EntryPointscontinue;}- var collectionFolders = _libraryManager.GetCollectionFolders(item, allUserRootChildren);foreach (var folder in allUserRootChildren){list.Add(folder.Id.ToString("N", CultureInfo.InvariantCulture));diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.csindex d3bcd5e13e..82c8d3ab6d 100644--- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs+++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs@@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.EntryPointsvar changes = _changedItems.ToList();_changedItems.Clear();- var task = SendNotifications(changes, CancellationToken.None);+ SendNotifications(changes, CancellationToken.None).GetAwaiter().GetResult();if (_updateTimer != null){diff --git a/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs b/Emby.Server.Implementations/HttpServer/Security/SessionContext.csindex a7647caf95..bb6041f28a 100644--- a/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs+++ b/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs@@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.HttpServer.Security{var session = await GetSession(requestContext).ConfigureAwait(false);- return session == null || session.UserId.Equals(Guid.Empty) ? null : _userManager.GetUserById(session.UserId);+ return session.UserId.Equals(Guid.Empty) ? null : _userManager.GetUserById(session.UserId);}public Task<User?> GetUser(object requestContext)diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.csindex e62361c1e1..6326208f71 100644--- a/Emby.Server.Implementations/IO/FileRefresher.cs+++ b/Emby.Server.Implementations/IO/FileRefresher.cs@@ -217,8 +217,13 @@ namespace Emby.Server.Implementations.IO/// <inheritdoc />public void Dispose(){- _disposed = true;+ if (_disposed)+ {+ return;+ }+DisposeTimer();+ _disposed = true;GC.SuppressFinalize(this);}}diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.csindex 9fcc7fe59c..657daac3fc 100644--- a/Emby.Server.Implementations/IO/LibraryMonitor.cs+++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs@@ -99,7 +99,7 @@ namespace Emby.Server.Implementations.IO// But if we make this delay too high, we risk missing legitimate changes, such as user adding a new file, or hand-editing metadataawait Task.Delay(45000).ConfigureAwait(false);- _tempIgnoredPaths.TryRemove(path, out var val);+ _tempIgnoredPaths.TryRemove(path, out _);if (refreshPath){diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.csindex 777cd2cd46..5c86dbbb7e 100644--- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs+++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs@@ -544,16 +544,6 @@ namespace Emby.Server.Implementations.IO/// <inheritdoc />public virtual bool AreEqual(string path1, string path2){- if (path1 == null && path2 == null)- {- return true;- }-- if (path1 == null || path2 == null)- {- return false;- }-return string.Equals(NormalizePath(path1),NormalizePath(path2),diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.csindex 270264dba8..e30fa7097b 100644--- a/Emby.Server.Implementations/Library/LibraryManager.cs+++ b/Emby.Server.Implementations/Library/LibraryManager.cs@@ -16,7 +16,7 @@ using Emby.Naming.TV;using Emby.Naming.Video;using Emby.Server.Implementations.Library.Validators;using Emby.Server.Implementations.Playlists;-using Emby.Server.Implementations.ScheduledTasks;+using Emby.Server.Implementations.ScheduledTasks.Tasks;using Jellyfin.Data.Entities;using Jellyfin.Data.Enums;using Jellyfin.Extensions;@@ -2678,7 +2678,7 @@ namespace Emby.Server.Implementations.Libraryreturn new ItemLookupInfo{- Name = VideoResolver.TryCleanString(result.Name, namingOptions, out var newName) ? newName.ToString() : result.Name,+ Name = VideoResolver.TryCleanString(result.Name, namingOptions, out var newName) ? newName : result.Name,Year = result.Year};}diff --git a/Emby.Server.Implementations/Library/LiveStreamHelper.cs b/Emby.Server.Implementations/Library/LiveStreamHelper.csindex 83acd8e9f2..20624cc7ae 100644--- a/Emby.Server.Implementations/Library/LiveStreamHelper.cs+++ b/Emby.Server.Implementations/Library/LiveStreamHelper.cs@@ -66,11 +66,8 @@ namespace Emby.Server.Implementations.Library{var delayMs = mediaSource.AnalyzeDurationMs ?? 0;delayMs = Math.Max(3000, delayMs);- if (delayMs > 0)- {- _logger.LogInformation("Waiting {0}ms before probing the live stream", delayMs);- await Task.Delay(delayMs, cancellationToken).ConfigureAwait(false);- }+ _logger.LogInformation("Waiting {0}ms before probing the live stream", delayMs);+ await Task.Delay(delayMs, cancellationToken).ConfigureAwait(false);}mediaSource.AnalyzeDurationMs = 3000;diff --git a/Emby.Server.Implementations/Library/MusicManager.cs b/Emby.Server.Implementations/Library/MusicManager.csindex d332135647..d35e74e7b3 100644--- a/Emby.Server.Implementations/Library/MusicManager.cs+++ b/Emby.Server.Implementations/Library/MusicManager.cs@@ -103,7 +103,7 @@ namespace Emby.Server.Implementations.Librarypublic List<BaseItem> GetInstantMixFromItem(BaseItem item, User user, DtoOptions dtoOptions){- if (item is MusicGenre genre)+ if (item is MusicGenre){return GetInstantMixFromGenreIds(new[] { item.Id }, user, dtoOptions);}diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.csindex a9819a3645..da00b9cfa8 100644--- a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs+++ b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs@@ -112,7 +112,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio/// Determine if the supplied list contains what we should consider music./// </summary>private bool ContainsMusic(- IEnumerable<FileSystemMetadata> list,+ ICollection<FileSystemMetadata> list,bool allowSubfolders,IDirectoryService directoryService){diff --git a/Emby.Server.Implementations/Library/UserDataManager.cs b/Emby.Server.Implementations/Library/UserDataManager.csindex bb3034142d..3810a76c45 100644--- a/Emby.Server.Implementations/Library/UserDataManager.cs+++ b/Emby.Server.Implementations/Library/UserDataManager.cs@@ -75,7 +75,7 @@ namespace Emby.Server.Implementations.Library}var cacheKey = GetCacheKey(userId, item.Id);- _userData.AddOrUpdate(cacheKey, userData, (k, v) => userData);+ _userData.AddOrUpdate(cacheKey, userData, (_, _) => userData);UserDataSaved?.Invoke(this, new UserDataSaveEventArgs{@@ -125,7 +125,7 @@ namespace Emby.Server.Implementations.Libraryvar cacheKey = GetCacheKey(userId, itemId);- return _userData.GetOrAdd(cacheKey, k => GetUserDataInternal(userId, keys));+ return _userData.GetOrAdd(cacheKey, _ => GetUserDataInternal(userId, keys));}private UserItemData GetUserDataInternal(long internalUserId, List<string> keys)diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.csindex ab8bc6328d..b00bc72e64 100644--- a/Emby.Server.Implementations/Library/UserViewManager.cs+++ b/Emby.Server.Implementations/Library/UserViewManager.cs@@ -173,7 +173,7 @@ namespace Emby.Server.Implementations.Librarystring viewType,string localizationKey,string sortName,- Jellyfin.Data.Entities.User user,+ User user,string[] presetViews){if (parents.Count == 1 && parents.All(i => string.Equals(i.CollectionType, viewType, StringComparison.OrdinalIgnoreCase)))@@ -359,7 +359,7 @@ namespace Emby.Server.Implementations.Library(ItemSortBy.SortName, SortOrder.Descending),(ItemSortBy.ProductionYear, SortOrder.Descending)},- IsFolder = includeItemTypes.Length == 0 ? false : (bool?)null,+ IsFolder = includeItemTypes.Length == 0 ? false : null,ExcludeItemTypes = excludeItemTypes,IsVirtualItem = false,Limit = limit * 5,diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.csindex 7ef93d1669..e7834ffd64 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs@@ -398,7 +398,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV}result = new EpgChannelData(channels);- _epgChannels.AddOrUpdate(info.Id, result, (k, v) => result);+ _epgChannels.AddOrUpdate(info.Id, result, (_, _) => result);}return result;@@ -1248,12 +1248,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVvar remoteMetadata = await FetchInternetMetadata(timer, CancellationToken.None).ConfigureAwait(false);var recordPath = GetRecordingPath(timer, remoteMetadata, out string seriesPath);- var recordingStatus = RecordingStatus.New;-- string liveStreamId = null;var channelItem = _liveTvManager.GetLiveTvChannel(timer, this);+ string liveStreamId = null;+ RecordingStatus recordingStatus;try{var allMediaSources = await _mediaSourceManager.GetPlaybackMediaSources(channelItem, null, true, false, CancellationToken.None).ConfigureAwait(false);@@ -1339,7 +1338,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVTriggerRefresh(recordPath);_libraryMonitor.ReportFileSystemChangeComplete(recordPath, false);- _activeRecordings.TryRemove(timer.Id, out var removed);+ _activeRecordings.TryRemove(timer.Id, out _);if (recordingStatus != RecordingStatus.Completed && DateTime.UtcNow < timer.EndDate && timer.RetryCount < 10){@@ -1937,7 +1936,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVwriter.WriteElementString("title", timer.EpisodeTitle);}- var premiereDate = item.PremiereDate ?? (!timer.IsRepeat ? DateTime.UtcNow : (DateTime?)null);+ var premiereDate = item.PremiereDate ?? (!timer.IsRepeat ? DateTime.UtcNow : null);if (premiereDate.HasValue){@@ -2126,12 +2125,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVprivate LiveTvProgram GetProgramInfoFromCache(TimerInfo timer){- return GetProgramInfoFromCache(timer.ProgramId, timer.ChannelId);- }-- private LiveTvProgram GetProgramInfoFromCache(string programId, string channelId)- {- return GetProgramInfoFromCache(programId);+ return GetProgramInfoFromCache(timer.ProgramId);}private LiveTvProgram GetProgramInfoFromCache(string channelId, DateTime startDateUtc)@@ -2277,7 +2271,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV{// Only update if not currently active - test both new timer and existing in case Id's are different// Id's could be different if the timer was created manually prior to series timer creation- if (!_activeRecordings.TryGetValue(timer.Id, out var activeRecordingInfo) && !_activeRecordings.TryGetValue(existingTimer.Id, out activeRecordingInfo))+ if (!_activeRecordings.TryGetValue(timer.Id, out _) && !_activeRecordings.TryGetValue(existingTimer.Id, out _)){UpdateExistingTimerWithNewMetadata(existingTimer, timer);@@ -2298,17 +2292,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVenabledTimersForSeries.Add(existingTimer);}- if (updateTimerSettings)- {- existingTimer.KeepUntil = seriesTimer.KeepUntil;- existingTimer.IsPostPaddingRequired = seriesTimer.IsPostPaddingRequired;- existingTimer.IsPrePaddingRequired = seriesTimer.IsPrePaddingRequired;- existingTimer.PostPaddingSeconds = seriesTimer.PostPaddingSeconds;- existingTimer.PrePaddingSeconds = seriesTimer.PrePaddingSeconds;- existingTimer.Priority = seriesTimer.Priority;- }-+ existingTimer.KeepUntil = seriesTimer.KeepUntil;+ existingTimer.IsPostPaddingRequired = seriesTimer.IsPostPaddingRequired;+ existingTimer.IsPrePaddingRequired = seriesTimer.IsPrePaddingRequired;+ existingTimer.PostPaddingSeconds = seriesTimer.PostPaddingSeconds;+ existingTimer.PrePaddingSeconds = seriesTimer.PrePaddingSeconds;+ existingTimer.Priority = seriesTimer.Priority;existingTimer.SeriesTimerId = seriesTimer.Id;+_timerProvider.Update(existingTimer);}}diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.csindex a88a1fe849..7fa47e7db1 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs@@ -62,12 +62,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVusing var durationToken = new CancellationTokenSource(duration);using var cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, durationToken.Token);- await RecordFromFile(mediaSource, mediaSource.Path, targetFile, duration, onStarted, cancellationTokenSource.Token).ConfigureAwait(false);+ await RecordFromFile(mediaSource, mediaSource.Path, targetFile, onStarted, cancellationTokenSource.Token).ConfigureAwait(false);_logger.LogInformation("Recording completed to file {0}", targetFile);}- private async Task RecordFromFile(MediaSourceInfo mediaSource, string inputFile, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken)+ private async Task RecordFromFile(MediaSourceInfo mediaSource, string inputFile, string targetFile, Action onStarted, CancellationToken cancellationToken){_targetPath = targetFile;Directory.CreateDirectory(Path.GetDirectoryName(targetFile));@@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVRedirectStandardInput = true,FileName = _mediaEncoder.EncoderPath,- Arguments = GetCommandLineArgs(mediaSource, inputFile, targetFile, duration),+ Arguments = GetCommandLineArgs(mediaSource, inputFile, targetFile),WindowStyle = ProcessWindowStyle.Hidden,ErrorDialog = false@@ -103,7 +103,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVStartInfo = processStartInfo,EnableRaisingEvents = true};- _process.Exited += (sender, args) => OnFfMpegProcessExited(_process);+ _process.Exited += (_, _) => OnFfMpegProcessExited(_process);_process.Start();@@ -117,7 +117,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV_logger.LogInformation("ffmpeg recording process started for {0}", _targetPath);}- private string GetCommandLineArgs(MediaSourceInfo mediaSource, string inputTempFile, string targetFile, TimeSpan duration)+ private string GetCommandLineArgs(MediaSourceInfo mediaSource, string inputTempFile, string targetFile){string videoArgs;if (EncodeVideo(mediaSource))diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.csindex dd0cb6c5de..2fbd47bc77 100644--- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs@@ -159,8 +159,8 @@ namespace Emby.Server.Implementations.LiveTv.Listingsvar programEntry = programDict[schedule.ProgramId];var allImages = images[imageIndex].Data;- var imagesWithText = allImages.Where(i => string.Equals(i.Text, "yes", StringComparison.OrdinalIgnoreCase));- var imagesWithoutText = allImages.Where(i => string.Equals(i.Text, "no", StringComparison.OrdinalIgnoreCase));+ var imagesWithText = allImages.Where(i => string.Equals(i.Text, "yes", StringComparison.OrdinalIgnoreCase)).ToList();+ var imagesWithoutText = allImages.Where(i => string.Equals(i.Text, "no", StringComparison.OrdinalIgnoreCase)).ToList();const double DesiredAspect = 2.0 / 3;@@ -820,10 +820,5 @@ namespace Emby.Server.Implementations.LiveTv.Listingsreturn list;}-- private static string NormalizeName(string value)- {- return value.Replace(" ", string.Empty, StringComparison.Ordinal).Replace("-", string.Empty, StringComparison.Ordinal);- }}}diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.csindex 78ea7bd0f5..532790019e 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs@@ -630,7 +630,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun}catch (HttpRequestException ex){- if (ex.StatusCode.HasValue && ex.StatusCode.Value == System.Net.HttpStatusCode.NotFound)+ if (ex.StatusCode.HasValue && ex.StatusCode.Value == HttpStatusCode.NotFound){// HDHR4 doesn't have this apireturn;diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.csindex 9ab4cc628b..f009c77cf3 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs@@ -122,7 +122,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerunif (!TryGetReturnValueOfGetSet(buffer.AsSpan(0, receivedBytes), out _)){await ReleaseLockkey(_tcpClient, lockKeyValue).ConfigureAwait(false);- continue;}}diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.csindex 99486f25ca..dd83f9a533 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs@@ -131,7 +131,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostspublic async Task Validate(TunerHostInfo info){- using (var stream = await new M3uParser(Logger, _httpClientFactory).GetListingsStream(info, CancellationToken.None).ConfigureAwait(false))+ using (await new M3uParser(Logger, _httpClientFactory).GetListingsStream(info, CancellationToken.None).ConfigureAwait(false)){}}diff --git a/Emby.Server.Implementations/Net/SocketFactory.cs b/Emby.Server.Implementations/Net/SocketFactory.csindex 6d0c8731e9..fd3fc31c92 100644--- a/Emby.Server.Implementations/Net/SocketFactory.cs+++ b/Emby.Server.Implementations/Net/SocketFactory.cs@@ -19,7 +19,7 @@ namespace Emby.Server.Implementations.Netthrow new ArgumentException("localPort cannot be less than zero.", nameof(localPort));}- var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);+ var retVal = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);try{retVal.EnableBroadcast = true;@@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.Netthrow new ArgumentException("localPort cannot be less than zero.", nameof(localPort));}- var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);+ var retVal = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);try{retVal.EnableBroadcast = true;@@ -85,7 +85,7 @@ namespace Emby.Server.Implementations.Netthrow new ArgumentException("localPort cannot be less than zero.", nameof(localPort));}- var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);+ var retVal = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);try{diff --git a/Emby.Server.Implementations/Plugins/PluginManager.cs b/Emby.Server.Implementations/Plugins/PluginManager.csindex d70a15dbc1..a805924ddf 100644--- a/Emby.Server.Implementations/Plugins/PluginManager.cs+++ b/Emby.Server.Implementations/Plugins/PluginManager.cs@@ -360,11 +360,6 @@ namespace Emby.Server.Implementations.Plugins/// <inheritdoc/>public async Task<bool> GenerateManifest(PackageInfo packageInfo, Version version, string path, PluginStatus status){- if (packageInfo == null)- {- return false;- }-var versionInfo = packageInfo.Versions.First(v => v.Version == version.ToString());var imagePath = string.Empty;@@ -617,7 +612,7 @@ namespace Emby.Server.Implementations.Pluginsif (versionIndex != -1){// Get the version number from the filename if possible.- metafile = Path.GetFileName(dir[..versionIndex]) ?? dir[..versionIndex];+ metafile = Path.GetFileName(dir[..versionIndex]);version = Version.TryParse(dir.AsSpan()[(versionIndex + 1)..], out Version? parsedVersion) ? parsedVersion : _appVersion;}else@@ -682,7 +677,6 @@ namespace Emby.Server.Implementations.Pluginscontinue;}- var manifest = entry.Manifest;var cleaned = false;var path = entry.Path;if (_config.RemoveOldPlugins)@@ -707,12 +701,6 @@ namespace Emby.Server.Implementations.Plugins}else{- if (manifest == null)- {- _logger.LogWarning("Unable to disable plugin {Path}", entry.Path);- continue;- }-ChangePluginState(entry, PluginStatus.Deleted);}}diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.csindex 21a7f4f5f2..299f10544b 100644--- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs+++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs@@ -9,6 +9,7 @@ using System.Linq;using System.Text.Json;using System.Threading;using System.Threading.Tasks;+using Emby.Server.Implementations.ScheduledTasks.Triggers;using Jellyfin.Data.Events;using Jellyfin.Extensions.Json;using MediaBrowser.Common.Configuration;diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.csindex 8b185419f3..a5786a3d72 100644--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs@@ -17,7 +17,7 @@ using MediaBrowser.Model.Globalization;using MediaBrowser.Model.IO;using MediaBrowser.Model.Tasks;-namespace Emby.Server.Implementations.ScheduledTasks+namespace Emby.Server.Implementations.ScheduledTasks.Tasks{/// <summary>/// Class ChapterImagesTask.diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.csindex 53c692a461..34780111bf 100644--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs@@ -8,7 +8,7 @@ using MediaBrowser.Controller.Library;using MediaBrowser.Model.Globalization;using MediaBrowser.Model.Tasks;-namespace Emby.Server.Implementations.ScheduledTasks+namespace Emby.Server.Implementations.ScheduledTasks.Tasks{/// <summary>/// Class PeopleValidationTask.diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.csindex 11a5fb79f4..b3973cecb3 100644--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs@@ -12,7 +12,7 @@ using MediaBrowser.Model.Globalization;using MediaBrowser.Model.Tasks;using Microsoft.Extensions.Logging;-namespace Emby.Server.Implementations.ScheduledTasks+namespace Emby.Server.Implementations.ScheduledTasks.Tasks{/// <summary>/// Plugin Update Task.diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.csindex 2184b3d033..f7b3cfedcc 100644--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs@@ -9,7 +9,7 @@ using MediaBrowser.Controller.Library;using MediaBrowser.Model.Globalization;using MediaBrowser.Model.Tasks;-namespace Emby.Server.Implementations.ScheduledTasks+namespace Emby.Server.Implementations.ScheduledTasks.Tasks{/// <summary>/// Class RefreshMediaLibraryTask.diff --git a/Emby.Server.Implementations/ScheduledTasks/Triggers/DailyTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/Triggers/DailyTrigger.csindex 29ab6a73dc..dc5eb73911 100644--- a/Emby.Server.Implementations/ScheduledTasks/Triggers/DailyTrigger.cs+++ b/Emby.Server.Implementations/ScheduledTasks/Triggers/DailyTrigger.cs@@ -3,7 +3,7 @@ using System.Threading;using MediaBrowser.Model.Tasks;using Microsoft.Extensions.Logging;-namespace Emby.Server.Implementations.ScheduledTasks+namespace Emby.Server.Implementations.ScheduledTasks.Triggers{/// <summary>/// Represents a task trigger that fires everyday.@@ -41,7 +41,7 @@ namespace Emby.Server.Implementations.ScheduledTasks/// <param name="logger">The logger.</param>/// <param name="taskName">The name of the task.</param>/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>- public void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup)+ public void Start(TaskResult? lastResult, ILogger logger, string taskName, bool isApplicationStartup){DisposeTimer();@@ -54,7 +54,7 @@ namespace Emby.Server.Implementations.ScheduledTaskslogger.LogInformation("Daily trigger for {Task} set to fire at {TriggerDate:yyyy-MM-dd HH:mm:ss.fff zzz}, which is {DueTime:c} from now.", taskName, triggerDate, dueTime);- _timer = new Timer(state => OnTriggered(), null, dueTime, TimeSpan.FromMilliseconds(-1));+ _timer = new Timer(_ => OnTriggered(), null, dueTime, TimeSpan.FromMilliseconds(-1));}/// <summary>diff --git a/Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.csindex 30568e8092..927f57e95a 100644--- a/Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.cs+++ b/Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.cs@@ -4,7 +4,7 @@ using System.Threading;using MediaBrowser.Model.Tasks;using Microsoft.Extensions.Logging;-namespace Emby.Server.Implementations.ScheduledTasks+namespace Emby.Server.Implementations.ScheduledTasks.Triggers{/// <summary>/// Represents a task trigger that runs repeatedly on an interval.@@ -43,7 +43,7 @@ namespace Emby.Server.Implementations.ScheduledTasks/// <param name="logger">The logger.</param>/// <param name="taskName">The name of the task.</param>/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>- public void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup)+ public void Start(TaskResult? lastResult, ILogger logger, string taskName, bool isApplicationStartup){DisposeTimer();@@ -72,7 +72,7 @@ namespace Emby.Server.Implementations.ScheduledTasksdueTime = maxDueTime;}- _timer = new Timer(state => OnTriggered(), null, dueTime, TimeSpan.FromMilliseconds(-1));+ _timer = new Timer(_ => OnTriggered(), null, dueTime, TimeSpan.FromMilliseconds(-1));}/// <summary>diff --git a/Emby.Server.Implementations/ScheduledTasks/Triggers/StartupTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/Triggers/StartupTrigger.csindex 18b9a8b75a..b16693c078 100644--- a/Emby.Server.Implementations/ScheduledTasks/Triggers/StartupTrigger.cs+++ b/Emby.Server.Implementations/ScheduledTasks/Triggers/StartupTrigger.cs@@ -5,7 +5,7 @@ using System.Threading.Tasks;using MediaBrowser.Model.Tasks;using Microsoft.Extensions.Logging;-namespace Emby.Server.Implementations.ScheduledTasks+namespace Emby.Server.Implementations.ScheduledTasks.Triggers{/// <summary>/// Class StartupTaskTrigger.@@ -40,7 +40,7 @@ namespace Emby.Server.Implementations.ScheduledTasks/// <param name="logger">The logger.</param>/// <param name="taskName">The name of the task.</param>/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>- public async void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup)+ public async void Start(TaskResult? lastResult, ILogger logger, string taskName, bool isApplicationStartup){if (isApplicationStartup){diff --git a/Emby.Server.Implementations/ScheduledTasks/Triggers/WeeklyTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/Triggers/WeeklyTrigger.csindex 36ae190b05..2392b20fd0 100644--- a/Emby.Server.Implementations/ScheduledTasks/Triggers/WeeklyTrigger.cs+++ b/Emby.Server.Implementations/ScheduledTasks/Triggers/WeeklyTrigger.cs@@ -3,7 +3,7 @@ using System.Threading;using MediaBrowser.Model.Tasks;using Microsoft.Extensions.Logging;-namespace Emby.Server.Implementations.ScheduledTasks+namespace Emby.Server.Implementations.ScheduledTasks.Triggers{/// <summary>/// Represents a task trigger that fires on a weekly basis.@@ -44,13 +44,13 @@ namespace Emby.Server.Implementations.ScheduledTasks/// <param name="logger">The logger.</param>/// <param name="taskName">The name of the task.</param>/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>- public void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup)+ public void Start(TaskResult? lastResult, ILogger logger, string taskName, bool isApplicationStartup){DisposeTimer();var triggerDate = GetNextTriggerDateTime();- _timer = new Timer(state => OnTriggered(), null, triggerDate - DateTime.Now, TimeSpan.FromMilliseconds(-1));+ _timer = new Timer(_ => OnTriggered(), null, triggerDate - DateTime.Now, TimeSpan.FromMilliseconds(-1));}/// <summary>diff --git a/Emby.Server.Implementations/Sorting/AlbumComparer.cs b/Emby.Server.Implementations/Sorting/AlbumComparer.csindex 4d09dda842..4bed0fca12 100644--- a/Emby.Server.Implementations/Sorting/AlbumComparer.cs+++ b/Emby.Server.Implementations/Sorting/AlbumComparer.cs@@ -33,7 +33,7 @@ namespace Emby.Server.Implementations.Sorting/// </summary>/// <param name="x">The x.</param>/// <returns>System.String.</returns>- private static string? GetValue(BaseItem? x)+ private static string GetValue(BaseItem? x){return x is Audio audio ? audio.Album : string.Empty;}diff --git a/Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs b/Emby.Server.Implementations/SyncPlay/SyncPlayManager.csindex 2ebeea7176..53e3b3577f 100644--- a/Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs+++ b/Emby.Server.Implementations/SyncPlay/SyncPlayManager.cs@@ -250,7 +250,6 @@ namespace Emby.Server.Implementations.SyncPlayvar error = new GroupUpdate<string>(Guid.Empty, GroupUpdateType.NotInGroup, string.Empty);_sessionManager.SendSyncPlayGroupUpdate(session.Id, error, CancellationToken.None);- return;}}}@@ -365,7 +364,7 @@ namespace Emby.Server.Implementations.SyncPlay{var session = e.SessionInfo;- if (_sessionToGroupMap.TryGetValue(session.Id, out var group))+ if (_sessionToGroupMap.TryGetValue(session.Id, out _)){var leaveGroupRequest = new LeaveGroupRequest();LeaveGroup(session, leaveGroupRequest, CancellationToken.None);@@ -378,7 +377,7 @@ namespace Emby.Server.Implementations.SyncPlayvar newSessionsCounter = _activeUsers.AddOrUpdate(userId,1,- (key, sessionsCounter) => sessionsCounter + toAdd);+ (_, sessionsCounter) => sessionsCounter + toAdd);// Should never happen.if (newSessionsCounter < 0)diff --git a/MediaBrowser.Model/Tasks/ITaskTrigger.cs b/MediaBrowser.Model/Tasks/ITaskTrigger.csindex 999db9605d..8c3ec6626c 100644--- a/MediaBrowser.Model/Tasks/ITaskTrigger.cs+++ b/MediaBrowser.Model/Tasks/ITaskTrigger.cs@@ -25,7 +25,7 @@ namespace MediaBrowser.Model.Tasks/// <param name="logger">The <see cref="ILogger"/>.</param>/// <param name="taskName">The name of the task.</param>/// <param name="isApplicationStartup">Wheter or not this is is fired during startup.</param>- void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup);+ void Start(TaskResult? lastResult, ILogger logger, string taskName, bool isApplicationStartup);/// <summary>/// Stops waiting for the trigger action.