Merge pull request #3369 from crobibero/api-cleanup
Remove #nullable, make Task.Run async
This commit is contained in:
commit
1da044e0eb
|
@ -1,4 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
#pragma warning disable CA1801
|
#pragma warning disable CA1801
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Jellyfin.Api.Constants;
|
using Jellyfin.Api.Constants;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Jellyfin.Api.Constants;
|
using Jellyfin.Api.Constants;
|
||||||
using MediaBrowser.Controller.Devices;
|
using MediaBrowser.Controller.Devices;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#nullable enable
|
#pragma warning disable CA1801
|
||||||
#pragma warning disable CA1801
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
#pragma warning disable CA1801
|
#pragma warning disable CA1801
|
||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
#pragma warning disable CA1801
|
#pragma warning disable CA1801
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
@ -175,20 +174,18 @@ namespace Jellyfin.Api.Controllers
|
||||||
{
|
{
|
||||||
CollectionFolder.OnCollectionFolderChange();
|
CollectionFolder.OnCollectionFolderChange();
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
// No need to start if scanning the library because it will handle it
|
// No need to start if scanning the library because it will handle it
|
||||||
if (refreshLibrary)
|
if (refreshLibrary)
|
||||||
{
|
{
|
||||||
_libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);
|
await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Need to add a delay here or directory watchers may still pick up the changes
|
// 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
|
// Have to block here to allow exceptions to bubble
|
||||||
Task.WaitAll(task);
|
await Task.Delay(1000).ConfigureAwait(false);
|
||||||
|
|
||||||
_libraryMonitor.Start();
|
_libraryMonitor.Start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -230,20 +227,18 @@ namespace Jellyfin.Api.Controllers
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
// No need to start if scanning the library because it will handle it
|
// No need to start if scanning the library because it will handle it
|
||||||
if (refreshLibrary)
|
if (refreshLibrary)
|
||||||
{
|
{
|
||||||
_libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);
|
await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Need to add a delay here or directory watchers may still pick up the changes
|
// 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
|
// Have to block here to allow exceptions to bubble
|
||||||
Task.WaitAll(task);
|
await Task.Delay(1000).ConfigureAwait(false);
|
||||||
|
|
||||||
_libraryMonitor.Start();
|
_libraryMonitor.Start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -304,20 +299,18 @@ namespace Jellyfin.Api.Controllers
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
// No need to start if scanning the library because it will handle it
|
// No need to start if scanning the library because it will handle it
|
||||||
if (refreshLibrary)
|
if (refreshLibrary)
|
||||||
{
|
{
|
||||||
_libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);
|
await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Need to add a delay here or directory watchers may still pick up the changes
|
// 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
|
// Have to block here to allow exceptions to bubble
|
||||||
Task.WaitAll(task);
|
await Task.Delay(1000).ConfigureAwait(false);
|
||||||
|
|
||||||
_libraryMonitor.Start();
|
_libraryMonitor.Start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
#pragma warning disable CA1801
|
#pragma warning disable CA1801
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#nullable enable
|
#pragma warning disable CA1801
|
||||||
#pragma warning disable CA1801
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -21,7 +19,7 @@ using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
|
|
||||||
namespace Jellyfin.Api.Controllers.Images
|
namespace Jellyfin.Api.Controllers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remote Images Controller.
|
/// Remote Images Controller.
|
|
@ -1,4 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
#pragma warning disable CA1801
|
#pragma warning disable CA1801
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace Jellyfin.Api.Models.ConfigurationDtos
|
namespace Jellyfin.Api.Models.ConfigurationDtos
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using MediaBrowser.Model.Notifications;
|
using MediaBrowser.Model.Notifications;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
using MediaBrowser.Model.Notifications;
|
using MediaBrowser.Model.Notifications;
|
||||||
|
|
||||||
namespace Jellyfin.Api.Models.NotificationDtos
|
namespace Jellyfin.Api.Models.NotificationDtos
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
#nullable enable
|
using System;
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Jellyfin.Api.Models.PluginDtos
|
namespace Jellyfin.Api.Models.PluginDtos
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
#nullable enable
|
namespace Jellyfin.Api.Models.PluginDtos
|
||||||
|
|
||||||
namespace Jellyfin.Api.Models.PluginDtos
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Plugin security info.
|
/// Plugin security info.
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Jellyfin.Api.Models.StartupDtos
|
namespace Jellyfin.Api.Models.StartupDtos
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -10,16 +8,16 @@ namespace Jellyfin.Api.Models.StartupDtos
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets UI language culture.
|
/// Gets or sets UI language culture.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string UICulture { get; set; }
|
public string? UICulture { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the metadata country code.
|
/// Gets or sets the metadata country code.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MetadataCountryCode { get; set; }
|
public string? MetadataCountryCode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the preferred language for the metadata.
|
/// Gets or sets the preferred language for the metadata.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PreferredMetadataLanguage { get; set; }
|
public string? PreferredMetadataLanguage { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Jellyfin.Api.Models.StartupDtos
|
namespace Jellyfin.Api.Models.StartupDtos
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -10,11 +8,11 @@ namespace Jellyfin.Api.Models.StartupDtos
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the username.
|
/// Gets or sets the username.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the user's password.
|
/// Gets or sets the user's password.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Password { get; set; }
|
public string? Password { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user