Adds provider configuration to media library saves

Moves metadata provider, artwork provider, and book reader choices into the add and update library requests, adds the library type lookups, removes the per-provider enable and reorder endpoints, and reconciles the stored configurations in one provider store call. Tightens library update and delete authorization to require ownership and the manage permission, and cleans up enum validation, comments, resource diacritics, and Razor imports.
This commit is contained in:
BinaryAlley committed 2026-11-02 10:00:00 +02:00
1 parent 2e7563199a
commit 48ad8692af
148 files changed
+6305 -2936

No files matched your search

@@ -11,15 +11,18 @@ namespace Lumina.Contracts.Requests.MediaLibrary.Management;
/// <param name="LibraryType">The type of the media library. Required.</param>
/// <param name="ContentLocations">The file system paths of the directories where the media library elements are located. Required.</param>
/// <param name="CoverImage">The path of the image file used as the cover for the library. Optional.</param>
/// <param name="IsEnabled">Whether this media library is enabled or not. A disabled media library is never shown or changed. Optional.</param>
/// <param name="IsLocked">Whether this media library is locked or not. A locked media library is displayed, but is never changed or updated. Optional.</param>
/// <param name="CanDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not. Optional.</param>
/// <param name="ShouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not. Optional.</param>
/// <param name="ShouldSkipUnchangedDirectoriesDuringScan">Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not. Optional.</param>
/// <param name="IsContentOnSsd">Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. Optional.</param>
/// <param name="IsEnabled">Whether this media library is enabled or not. A disabled media library is never shown or changed. Required.</param>
/// <param name="IsLocked">Whether this media library is locked or not. A locked media library is displayed, but is never changed or updated. Required.</param>
/// <param name="CanDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not. Required.</param>
/// <param name="ShouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not. Required.</param>
/// <param name="ShouldSkipUnchangedDirectoriesDuringScan">Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not. Required.</param>
/// <param name="IsContentOnSsd">Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. Required.</param>
/// <param name="ShouldTrackConsumptionProgress">Whether the consumption progress of the media library items should be tracked, or not. Optional, the default of the library type is used when absent.</param>
/// <param name="CompletionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed. Optional, the default of the library type is used when absent.</param>
/// <param name="PathTemplateParts">The ordered parts of the template describing the structure of the media library on disk. Optional, the ideal structure of the library type is used when absent.</param>
/// <param name="MetadataProviders">The metadata providers of the media library, in the order in which they are tried, and whether each one is enabled. Optional, every provider supported by the library type is added disabled.</param>
/// <param name="ArtworkProviders">The artwork providers of the media library, in the order in which they are tried, and whether each one is enabled. Optional, every provider supported by the library type is added disabled.</param>
/// <param name="BookReaders">The book readers of the media library, and whether each one is enabled. Optional, every reader supported by the library type is added disabled.</param>
[DebuggerDisplay("Title: {Title}")]
public record AddLibraryRequest(
string? Title,
@@ -34,5 +37,8 @@ public record AddLibraryRequest(
bool IsContentOnSsd,
bool? ShouldTrackConsumptionProgress,
int? CompletionThresholdPercentage,
LibraryPathTemplatePartRequest[]? PathTemplateParts
LibraryPathTemplatePartRequest?[]? PathTemplateParts,
LibraryProviderSelectionRequest?[]? MetadataProviders,
LibraryProviderSelectionRequest?[]? ArtworkProviders,
LibraryProviderSelectionRequest?[]? BookReaders
);
@@ -0,0 +1,17 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.MediaLibrary.Management;
/// <summary>
/// Represents the choice made for one metadata provider, artwork provider or book reader of a media library.
/// </summary>
/// <param name="PluginId">The Id of the plugin providing the metadata provider, artwork provider or book reader. Required.</param>
/// <param name="IsEnabled">Whether the provider or reader is enabled for the media library. Optional, the stored state is kept when absent, and a provider or reader without a stored state starts disabled.</param>
[DebuggerDisplay("PluginId: {PluginId}; IsEnabled: {IsEnabled}")]
public record LibraryProviderSelectionRequest(
Guid PluginId,
bool? IsEnabled
);
@@ -9,24 +9,25 @@ namespace Lumina.Contracts.Requests.MediaLibrary.Management;
/// Represents a request to update a media library.
/// </summary>
/// <param name="Id">The unique identifier of the media library. Required.</param>
/// <param name="UserId">The unique identifier of the user owning the media library. Required.</param>
/// <param name="Title">The title of the media library. Required.</param>
/// <param name="LibraryType">The type of the media library. Required.</param>
/// <param name="ContentLocations">The file system paths of the directories where the media library elements are located. Required.</param>
/// <param name="CoverImage">The path of the image file used as the cover for the library. Optional.</param>
/// <param name="IsEnabled">Whether this media library is enabled or not. A disabled media library is never shown or changed. Optional.</param>
/// <param name="IsLocked">Whether this media library is locked or not. A locked media library is displayed, but is never changed or updated. Optional.</param>
/// <param name="CanDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not. Optional.</param>
/// <param name="ShouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not.
/// <param name="ShouldSkipUnchangedDirectoriesDuringScan">Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not. Optional.</param>
/// <param name="IsContentOnSsd">Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. Optional.</param>
/// <param name="IsEnabled">Whether this media library is enabled or not. A disabled media library is never shown or changed. Required.</param>
/// <param name="IsLocked">Whether this media library is locked or not. A locked media library is displayed, but is never changed or updated. Required.</param>
/// <param name="CanDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not. Required.</param>
/// <param name="ShouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not. Required.</param>
/// <param name="ShouldSkipUnchangedDirectoriesDuringScan">Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not. Required.</param>
/// <param name="IsContentOnSsd">Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. Required.</param>
/// <param name="ShouldTrackConsumptionProgress">Whether the consumption progress of the media library items should be tracked, or not. Optional, the stored value is kept when absent.</param>
/// <param name="CompletionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed. Optional, the stored value is kept when absent.</param>
/// <param name="PathTemplateParts">The ordered parts of the template describing the structure of the media library on disk. Optional, the ideal structure of the library type is used when absent.</param>
/// <param name="MetadataProviders">The metadata providers of the media library, in the order in which they are tried, and whether each one is enabled. Optional, the stored configurations are kept, or reconciled with the library type when it changes.</param>
/// <param name="ArtworkProviders">The artwork providers of the media library, in the order in which they are tried, and whether each one is enabled. Optional, the stored configurations are kept, or reconciled with the library type when it changes.</param>
/// <param name="BookReaders">The book readers of the media library, and whether each one is enabled. Optional, the stored configurations are kept, or reconciled with the library type when it changes.</param>
[DebuggerDisplay("Title: {Title}")]
public record class UpdateLibraryRequest(
Guid Id,
Guid UserId,
string? Title,
string? LibraryType,
string[]? ContentLocations,
@@ -39,5 +40,8 @@ public record class UpdateLibraryRequest(
bool IsContentOnSsd,
bool? ShouldTrackConsumptionProgress,
int? CompletionThresholdPercentage,
LibraryPathTemplatePartRequest[]? PathTemplateParts
LibraryPathTemplatePartRequest?[]? PathTemplateParts,
LibraryProviderSelectionRequest?[]? MetadataProviders,
LibraryProviderSelectionRequest?[]? ArtworkProviders,
LibraryProviderSelectionRequest?[]? BookReaders
);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Plugins;
/// <summary>
/// Represents a request to get the artwork providers available for a media library type.
/// </summary>
/// <param name="LibraryType">The media library type whose available artwork providers are retrieved. Required.</param>
[DebuggerDisplay("LibraryType: {LibraryType}")]
public sealed record GetLibraryTypeArtworkProvidersRequest(
string? LibraryType
);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Plugins;
/// <summary>
/// Represents a request to get the book readers available for a media library type.
/// </summary>
/// <param name="LibraryType">The media library type whose available book readers are retrieved. Required.</param>
[DebuggerDisplay("LibraryType: {LibraryType}")]
public sealed record GetLibraryTypeBookReadersRequest(
string? LibraryType
);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Plugins;
/// <summary>
/// Represents a request to get the metadata providers available for a media library type.
/// </summary>
/// <param name="LibraryType">The media library type whose available metadata providers are retrieved. Required.</param>
[DebuggerDisplay("LibraryType: {LibraryType}")]
public sealed record GetLibraryTypeMetadataProvidersRequest(
string? LibraryType
);
@@ -1,18 +0,0 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Plugins;
/// <summary>
/// Represents a request to reorder the artwork providers of a media library.
/// </summary>
/// <param name="LibraryId">The unique identifier of the media library whose artwork providers are reordered. Required.</param>
/// <param name="PluginIds">The plugin Ids in the new order, from highest to lowest rank. Required.</param>
[DebuggerDisplay("LibraryId: {LibraryId}")]
public sealed record ReorderLibraryArtworkProvidersRequest(
Guid LibraryId,
IReadOnlyList<Guid> PluginIds
);
@@ -1,18 +0,0 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Plugins;
/// <summary>
/// Represents a request to reorder the metadata providers of a media library.
/// </summary>
/// <param name="LibraryId">The Id of the media library whose metadata providers are reordered. Required.</param>
/// <param name="PluginIds">The plugin Ids in the new order, from highest to lowest rank. Required.</param>
[DebuggerDisplay("LibraryId: {LibraryId}")]
public sealed record ReorderLibraryMetadataProvidersRequest(
Guid LibraryId,
IReadOnlyList<Guid> PluginIds
);
@@ -1,19 +0,0 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Plugins;
/// <summary>
/// Represents a request to enable or disable an artwork provider for a media library.
/// </summary>
/// <param name="LibraryId">The unique identifier of the media library whose artwork provider is enabled or disabled. Required.</param>
/// <param name="PluginId">The unique identifier of the plugin providing the artwork. Required.</param>
/// <param name="IsEnabled">Whether the artwork provider should be enabled for the media library. Required.</param>
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
public sealed record SetLibraryArtworkProviderEnabledRequest(
Guid LibraryId,
Guid PluginId,
bool IsEnabled
);
@@ -1,19 +0,0 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Plugins;
/// <summary>
/// Represents a request to enable or disable a book reader for a media library.
/// </summary>
/// <param name="LibraryId">The Id of the media library whose book reader is enabled or disabled. Required.</param>
/// <param name="PluginId">The unique identifier of the plugin providing the book reader. Required.</param>
/// <param name="IsEnabled">Whether the book reader should be enabled for the media library. Required.</param>
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
public sealed record SetLibraryBookReaderEnabledRequest(
Guid LibraryId,
Guid PluginId,
bool IsEnabled
);
@@ -1,19 +0,0 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Plugins;
/// <summary>
/// Represents a request to enable or disable a metadata provider for a media library.
/// </summary>
/// <param name="LibraryId">The Id of the media library whose metadata provider is enabled or disabled. Required.</param>
/// <param name="PluginId">The unique identifier of the plugin providing the metadata. Required.</param>
/// <param name="IsEnabled">Whether the metadata provider should be enabled for the media library. Required.</param>
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
public sealed record SetLibraryMetadataProviderEnabledRequest(
Guid LibraryId,
Guid PluginId,
bool IsEnabled
);
@@ -5,12 +5,12 @@ using System;
namespace Lumina.Contracts.Responses.Plugins;
/// <summary>
/// Represents an artwork provider configured for a media library.
/// Represents an artwork provider, either as configured for a media library, or as available for a library type, the way a new library of that type starts.
/// </summary>
/// <param name="PluginId">The unique identifier of the plugin providing the artwork.</param>
/// <param name="Name">The display name of the artwork provider.</param>
/// <param name="IsEnabled">Whether the artwork provider is enabled for the media library.</param>
/// <param name="Rank">The rank of the artwork provider, determining the order in which providers are tried.</param>
/// <param name="IsEnabled">Whether the artwork provider is enabled for the media library. Always <see langword="false"/> for a provider available for a library type, since a new provider starts disabled.</param>
/// <param name="Rank">The rank of the artwork provider, determining the order in which providers are tried. For a provider available for a library type, it is the rank a new library starts with, in alphabetical order of the plugin names.</param>
public sealed record LibraryArtworkProviderResponse(
Guid PluginId,
string Name,
@@ -7,12 +7,12 @@ using System.Diagnostics;
namespace Lumina.Contracts.Responses.Plugins;
/// <summary>
/// Represents a book reader configured for a media library.
/// Represents a book reader, either as configured for a media library, or as available for a library type, the way a new library of that type starts.
/// </summary>
/// <param name="PluginId">The unique identifier of the plugin providing the book reader.</param>
/// <param name="Name">The display name of the book reader.</param>
/// <param name="SupportedExtensions">The file extensions supported by the book reader.</param>
/// <param name="IsEnabled">Whether the book reader is enabled for the media library.</param>
/// <param name="IsEnabled">Whether the book reader is enabled for the media library. Always <see langword="false"/> for a reader available for a library type, since a new reader starts disabled.</param>
[DebuggerDisplay("Name: {Name}")]
public sealed record LibraryBookReaderResponse(
Guid PluginId,
@@ -5,12 +5,12 @@ using System;
namespace Lumina.Contracts.Responses.Plugins;
/// <summary>
/// Represents a metadata provider configured for a media library.
/// Represents a metadata provider, either as configured for a media library, or as available for a library type, the way a new library of that type starts.
/// </summary>
/// <param name="PluginId">The unique identifier of the plugin providing the metadata.</param>
/// <param name="Name">The display name of the metadata provider.</param>
/// <param name="IsEnabled">Whether the metadata provider is enabled for the media library.</param>
/// <param name="Rank">The rank of the metadata provider, determining the order in which providers are tried.</param>
/// <param name="IsEnabled">Whether the metadata provider is enabled for the media library. Always <see langword="false"/> for a provider available for a library type, since a new provider starts disabled.</param>
/// <param name="Rank">The rank of the metadata provider, determining the order in which providers are tried. For a provider available for a library type, it is the rank a new library starts with, in alphabetical order of the plugin names.</param>
public sealed record LibraryMetadataProviderResponse(
Guid PluginId,
string Name,