The Free Software Media System - Server Backend & API
Remove nullable, add async task
crobibero9a51f484af3d
diff --git a/Jellyfin.Api/Controllers/ActivityLogController.cs b/Jellyfin.Api/Controllers/ActivityLogController.csindex 895d9f719d..4ae7cf5069 100644--- a/Jellyfin.Api/Controllers/ActivityLogController.cs+++ b/Jellyfin.Api/Controllers/ActivityLogController.cs@@ -1,4 +1,3 @@-#nullable enable#pragma warning disable CA1801using System;diff --git a/Jellyfin.Api/Controllers/ConfigurationController.cs b/Jellyfin.Api/Controllers/ConfigurationController.csindex 780a38aa81..ae5685156e 100644--- a/Jellyfin.Api/Controllers/ConfigurationController.cs+++ b/Jellyfin.Api/Controllers/ConfigurationController.cs@@ -1,5 +1,3 @@-#nullable enable-using System.Text.Json;using System.Threading.Tasks;using Jellyfin.Api.Constants;diff --git a/Jellyfin.Api/Controllers/DevicesController.cs b/Jellyfin.Api/Controllers/DevicesController.csindex 1754b0cbda..1575307c55 100644--- a/Jellyfin.Api/Controllers/DevicesController.cs+++ b/Jellyfin.Api/Controllers/DevicesController.cs@@ -1,5 +1,3 @@-#nullable enable-using System;using Jellyfin.Api.Constants;using MediaBrowser.Controller.Devices;diff --git a/Jellyfin.Api/Controllers/FilterController.cs b/Jellyfin.Api/Controllers/FilterController.csindex 46911ce938..6a6e6a64a3 100644--- a/Jellyfin.Api/Controllers/FilterController.cs+++ b/Jellyfin.Api/Controllers/FilterController.cs@@ -1,5 +1,4 @@-#nullable enable-#pragma warning disable CA1801+#pragma warning disable CA1801using System;using System.Linq;diff --git a/Jellyfin.Api/Controllers/ImageByNameController.cs b/Jellyfin.Api/Controllers/ImageByNameController.csindex fa46b6dd17..70f46ffa49 100644--- a/Jellyfin.Api/Controllers/ImageByNameController.cs+++ b/Jellyfin.Api/Controllers/ImageByNameController.cs@@ -1,5 +1,3 @@-#nullable enable-using System;using System.Collections.Generic;using System.IO;diff --git a/Jellyfin.Api/Controllers/ItemRefreshController.cs b/Jellyfin.Api/Controllers/ItemRefreshController.csindex d9b8357d2e..a1df22e411 100644--- a/Jellyfin.Api/Controllers/ItemRefreshController.cs+++ b/Jellyfin.Api/Controllers/ItemRefreshController.cs@@ -1,4 +1,3 @@-#nullable enable#pragma warning disable CA1801using System.ComponentModel;diff --git a/Jellyfin.Api/Controllers/LibraryStructureController.cs b/Jellyfin.Api/Controllers/LibraryStructureController.csindex a989efe7f1..ca2905b114 100644--- a/Jellyfin.Api/Controllers/LibraryStructureController.cs+++ b/Jellyfin.Api/Controllers/LibraryStructureController.cs@@ -1,4 +1,3 @@-#nullable enable#pragma warning disable CA1801using System;@@ -175,20 +174,18 @@ namespace Jellyfin.Api.Controllers{CollectionFolder.OnCollectionFolderChange();- Task.Run(() =>+ Task.Run(async () =>{// No need to start if scanning the library because it will handle itif (refreshLibrary){- _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);+ await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);}else{// Need to add a delay here or directory watchers may still pick up the changes- var task = Task.Delay(1000);// Have to block here to allow exceptions to bubble- Task.WaitAll(task);-+ await Task.Delay(1000).ConfigureAwait(false);_libraryMonitor.Start();}});@@ -230,20 +227,18 @@ namespace Jellyfin.Api.Controllers}finally{- Task.Run(() =>+ Task.Run(async () =>{// No need to start if scanning the library because it will handle itif (refreshLibrary){- _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);+ await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);}else{// Need to add a delay here or directory watchers may still pick up the changes- var task = Task.Delay(1000);// Have to block here to allow exceptions to bubble- Task.WaitAll(task);-+ await Task.Delay(1000).ConfigureAwait(false);_libraryMonitor.Start();}});@@ -304,20 +299,18 @@ namespace Jellyfin.Api.Controllers}finally{- Task.Run(() =>+ Task.Run(async () =>{// No need to start if scanning the library because it will handle itif (refreshLibrary){- _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);+ await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);}else{// Need to add a delay here or directory watchers may still pick up the changes- var task = Task.Delay(1000);// Have to block here to allow exceptions to bubble- Task.WaitAll(task);-+ await Task.Delay(1000).ConfigureAwait(false);_libraryMonitor.Start();}});diff --git a/Jellyfin.Api/Controllers/NotificationsController.cs b/Jellyfin.Api/Controllers/NotificationsController.csindex a76675d5a9..a1f9b9e8f7 100644--- a/Jellyfin.Api/Controllers/NotificationsController.cs+++ b/Jellyfin.Api/Controllers/NotificationsController.cs@@ -1,4 +1,3 @@-#nullable enable#pragma warning disable CA1801using System;diff --git a/Jellyfin.Api/Controllers/PackageController.cs b/Jellyfin.Api/Controllers/PackageController.csindex 8200f891c8..4f125f16b4 100644--- a/Jellyfin.Api/Controllers/PackageController.cs+++ b/Jellyfin.Api/Controllers/PackageController.cs@@ -1,5 +1,3 @@-#nullable enable-using System;using System.Collections.Generic;using System.ComponentModel.DataAnnotations;diff --git a/Jellyfin.Api/Controllers/PluginsController.cs b/Jellyfin.Api/Controllers/PluginsController.csindex 59196a41aa..fdb2f4c35b 100644--- a/Jellyfin.Api/Controllers/PluginsController.cs+++ b/Jellyfin.Api/Controllers/PluginsController.cs@@ -1,5 +1,4 @@-#nullable enable-#pragma warning disable CA1801+#pragma warning disable CA1801using System;using System.Collections.Generic;diff --git a/Jellyfin.Api/Controllers/Images/RemoteImageController.cs b/Jellyfin.Api/Controllers/RemoteImageController.cssimilarity index 99%rename from Jellyfin.Api/Controllers/Images/RemoteImageController.csrename to Jellyfin.Api/Controllers/RemoteImageController.csindex 7c5f17e9e8..80983ee649 100644--- a/Jellyfin.Api/Controllers/Images/RemoteImageController.cs+++ b/Jellyfin.Api/Controllers/RemoteImageController.cs@@ -1,5 +1,3 @@-#nullable enable-using System;using System.Collections.Generic;using System.IO;@@ -21,7 +19,7 @@ using Microsoft.AspNetCore.Http;using Microsoft.AspNetCore.Mvc;using Microsoft.AspNetCore.Mvc.ModelBinding;-namespace Jellyfin.Api.Controllers.Images+namespace Jellyfin.Api.Controllers{/// <summary>/// Remote Images Controller.diff --git a/Jellyfin.Api/Controllers/SubtitleController.cs b/Jellyfin.Api/Controllers/SubtitleController.csindex 97df8c60d8..caf30031ba 100644--- a/Jellyfin.Api/Controllers/SubtitleController.cs+++ b/Jellyfin.Api/Controllers/SubtitleController.cs@@ -1,4 +1,3 @@-#nullable enable#pragma warning disable CA1801using System;diff --git a/Jellyfin.Api/Controllers/VideoAttachmentsController.cs b/Jellyfin.Api/Controllers/VideoAttachmentsController.csindex 86d9322fe4..268aecad8a 100644--- a/Jellyfin.Api/Controllers/VideoAttachmentsController.cs+++ b/Jellyfin.Api/Controllers/VideoAttachmentsController.cs@@ -1,5 +1,3 @@-#nullable enable-using System;using System.Net.Mime;using System.Threading;diff --git a/Jellyfin.Api/Models/ConfigurationDtos/MediaEncoderPathDto.cs b/Jellyfin.Api/Models/ConfigurationDtos/MediaEncoderPathDto.csindex 3706a11e3a..3b827ec12d 100644--- a/Jellyfin.Api/Models/ConfigurationDtos/MediaEncoderPathDto.cs+++ b/Jellyfin.Api/Models/ConfigurationDtos/MediaEncoderPathDto.cs@@ -1,5 +1,3 @@-#nullable enable-namespace Jellyfin.Api.Models.ConfigurationDtos{/// <summary>diff --git a/Jellyfin.Api/Models/NotificationDtos/NotificationDto.cs b/Jellyfin.Api/Models/NotificationDtos/NotificationDto.csindex 502b22623b..af5239ec2b 100644--- a/Jellyfin.Api/Models/NotificationDtos/NotificationDto.cs+++ b/Jellyfin.Api/Models/NotificationDtos/NotificationDto.cs@@ -1,5 +1,3 @@-#nullable enable-using System;using MediaBrowser.Model.Notifications;diff --git a/Jellyfin.Api/Models/NotificationDtos/NotificationResultDto.cs b/Jellyfin.Api/Models/NotificationDtos/NotificationResultDto.csindex e34e176cb9..64e92bd83a 100644--- a/Jellyfin.Api/Models/NotificationDtos/NotificationResultDto.cs+++ b/Jellyfin.Api/Models/NotificationDtos/NotificationResultDto.cs@@ -1,5 +1,3 @@-#nullable enable-using System;using System.Collections.Generic;diff --git a/Jellyfin.Api/Models/NotificationDtos/NotificationsSummaryDto.cs b/Jellyfin.Api/Models/NotificationDtos/NotificationsSummaryDto.csindex b3746ee2da..0568dea666 100644--- a/Jellyfin.Api/Models/NotificationDtos/NotificationsSummaryDto.cs+++ b/Jellyfin.Api/Models/NotificationDtos/NotificationsSummaryDto.cs@@ -1,5 +1,3 @@-#nullable enable-using MediaBrowser.Model.Notifications;namespace Jellyfin.Api.Models.NotificationDtosdiff --git a/Jellyfin.Api/Models/PluginDtos/MBRegistrationRecord.cs b/Jellyfin.Api/Models/PluginDtos/MBRegistrationRecord.csindex aaaf54267a..7f1255f4b6 100644--- a/Jellyfin.Api/Models/PluginDtos/MBRegistrationRecord.cs+++ b/Jellyfin.Api/Models/PluginDtos/MBRegistrationRecord.cs@@ -1,6 +1,4 @@-#nullable enable--using System;+using System;namespace Jellyfin.Api.Models.PluginDtos{diff --git a/Jellyfin.Api/Models/PluginDtos/PluginSecurityInfo.cs b/Jellyfin.Api/Models/PluginDtos/PluginSecurityInfo.csindex 793002a6cd..a90398425a 100644--- a/Jellyfin.Api/Models/PluginDtos/PluginSecurityInfo.cs+++ b/Jellyfin.Api/Models/PluginDtos/PluginSecurityInfo.cs@@ -1,6 +1,4 @@-#nullable enable--namespace Jellyfin.Api.Models.PluginDtos+namespace Jellyfin.Api.Models.PluginDtos{/// <summary>/// Plugin security info.diff --git a/Jellyfin.Api/Models/StartupDtos/StartupConfigurationDto.cs b/Jellyfin.Api/Models/StartupDtos/StartupConfigurationDto.csindex 5a83a030d2..a5f012245a 100644--- a/Jellyfin.Api/Models/StartupDtos/StartupConfigurationDto.cs+++ b/Jellyfin.Api/Models/StartupDtos/StartupConfigurationDto.cs@@ -1,5 +1,3 @@-#nullable disable-namespace Jellyfin.Api.Models.StartupDtos{/// <summary>@@ -10,16 +8,16 @@ namespace Jellyfin.Api.Models.StartupDtos/// <summary>/// Gets or sets UI language culture./// </summary>- public string UICulture { get; set; }+ public string? UICulture { get; set; }/// <summary>/// Gets or sets the metadata country code./// </summary>- public string MetadataCountryCode { get; set; }+ public string? MetadataCountryCode { get; set; }/// <summary>/// Gets or sets the preferred language for the metadata./// </summary>- public string PreferredMetadataLanguage { get; set; }+ public string? PreferredMetadataLanguage { get; set; }}}diff --git a/Jellyfin.Api/Models/StartupDtos/StartupUserDto.cs b/Jellyfin.Api/Models/StartupDtos/StartupUserDto.csindex 0dbb245ec6..e4c9735481 100644--- a/Jellyfin.Api/Models/StartupDtos/StartupUserDto.cs+++ b/Jellyfin.Api/Models/StartupDtos/StartupUserDto.cs@@ -1,5 +1,3 @@-#nullable disable-namespace Jellyfin.Api.Models.StartupDtos{/// <summary>@@ -10,11 +8,11 @@ namespace Jellyfin.Api.Models.StartupDtos/// <summary>/// Gets or sets the username./// </summary>- public string Name { get; set; }+ public string? Name { get; set; }/// <summary>/// Gets or sets the user's password./// </summary>- public string Password { get; set; }+ public string? Password { get; set; }}}