Adds dynamic path templates for media libraries, so that the scanner can derive the meaning of each path part

This commit is contained in:
BinaryAlley committed 2026-10-05 18:42:00 +03:00
1 parent 62b0e9297a
commit ca4f308b0a
86 files changed
+7406 -151

No files matched your search

@@ -67,4 +67,9 @@ public class LibraryDto
/// which does not change when the contents of an existing file are edited, and such edits could be missed while this setting is enabled.
/// </summary>
public bool ShouldSkipUnchangedDirectoriesDuringScan { get; set; } = false;
/// <summary>
/// Gets or sets the ordered parts of the template describing the structure of the media library on disk.
/// </summary>
public List<LibraryPathTemplatePartDto> PathTemplateParts { get; set; } = [];
}
@@ -0,0 +1,32 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Libraries;
/// <summary>
/// Data transfer object for a path part available for a media library type.
/// </summary>
[DebuggerDisplay("Kind: {Kind}")]
public class LibraryPathPartDefinitionDto
{
/// <summary>
/// Gets or sets the kind of the path part.
/// </summary>
public string Kind { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the value type captured by the path part.
/// </summary>
public string ValueType { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the default representation of the path part.
/// </summary>
public string DefaultRepresentation { get; set; } = string.Empty;
/// <summary>
/// Gets or sets whether the path part is optional by default.
/// </summary>
public bool IsOptionalByDefault { get; set; }
}
@@ -0,0 +1,23 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Libraries;
/// <summary>
/// Data transfer object for the path template catalog of a media library type.
/// </summary>
[DebuggerDisplay("Parts: {Parts.Count}; DefaultTemplateParts: {DefaultTemplateParts.Count}")]
public class LibraryPathTemplateCatalogDto
{
/// <summary>
/// Gets or sets the path parts that can be used in the path template of the library type.
/// </summary>
public List<LibraryPathPartDefinitionDto> Parts { get; set; } = [];
/// <summary>
/// Gets or sets the ordered parts of the default path template of the library type.
/// </summary>
public List<LibraryPathTemplatePartDto> DefaultTemplateParts { get; set; } = [];
}
@@ -0,0 +1,27 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Libraries;
/// <summary>
/// Data transfer object for one part of the path template of a media library.
/// </summary>
[DebuggerDisplay("Kind: {Kind}; Representation: {Representation}")]
public class LibraryPathTemplatePartDto
{
/// <summary>
/// Gets or sets the kind of the path part.
/// </summary>
public string Kind { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the literal text or the value mask of the path part.
/// </summary>
public string Representation { get; set; } = string.Empty;
/// <summary>
/// Gets or sets whether the path part can be absent from the path.
/// </summary>
public bool IsOptional { get; set; }
}
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.Management;
/// <summary>
/// Represents the request for retrieving the path parts available for a media library type.
/// </summary>
/// <param name="LibraryType">The media library type whose available path parts are retrieved. Required.</param>
[DebuggerDisplay("LibraryType: {LibraryType}")]
public record GetLibraryPathTemplatePartsRequest(
string LibraryType
);
@@ -21,6 +21,7 @@ public static partial class ApiRoutes
public const string GET_RUNNING_LIBRARIES_SCAN = "libraries/scans/running";
public const string CANCEL_LIBRARIES_SCAN = "libraries/scans/cancel";
public const string CANCEL_LIBRARY_SCAN = "libraries/{libraryId}/scans/{scanId}/cancel";
public const string GET_LIBRARY_PATH_TEMPLATE_PARTS = "libraries/path-template-parts/{libraryType}";
public const string GET_LIBRARY_METADATA_PROVIDERS = "libraries/{libraryId}/metadata-providers";
public const string SET_LIBRARY_METADATA_PROVIDER_ENABLED = "libraries/{libraryId}/metadata-providers/{pluginId}/enabled";
public const string REORDER_LIBRARY_METADATA_PROVIDERS = "libraries/{libraryId}/metadata-providers/reorder";
@@ -22,6 +22,7 @@ public static partial class WebRoutes
public const string SCAN_LIBRARY = "{culture}/libraries/manage/api-scan-library/{id}";
public const string CANCEL_LIBRARIES_SCAN = "{culture}/libraries/manage/api-cancel-libraries-scan";
public const string CANCEL_LIBRARY_SCAN = "{culture}/libraries/manage/{libraryId}/api-cancel-library-scan/{scanId}";
public const string GET_LIBRARY_PATH_TEMPLATE_PARTS = "{culture}/libraries/manage/api-get-path-template-parts/{libraryType}";
public const string GET_METADATA_PROVIDERS = "{culture}/libraries/manage/api-get-metadata-providers/{libraryId}";
public const string SET_METADATA_PROVIDER_ENABLED = "{culture}/libraries/manage/api-set-metadata-provider-enabled";
public const string REORDER_METADATA_PROVIDERS = "{culture}/libraries/manage/api-reorder-metadata-providers";