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

@@ -16,6 +16,7 @@ namespace Lumina.Contracts.Requests.MediaLibrary.Management;
/// <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="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>
[DebuggerDisplay("Title: {Title}")]
public record AddLibraryRequest(
string? Title,
@@ -26,5 +27,6 @@ public record AddLibraryRequest(
bool IsLocked,
bool CanDownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan
bool ShouldSkipUnchangedDirectoriesDuringScan,
LibraryPathTemplatePartRequest[]? PathTemplateParts
);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.MediaLibrary.Management;
/// <summary>
/// Represents a request to get 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
);
@@ -0,0 +1,18 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.MediaLibrary.Management;
/// <summary>
/// Represents one part of the path template of a media library.
/// </summary>
/// <param name="Kind">The kind of the path part. Required.</param>
/// <param name="Representation">The literal text or the value mask of the path part. Optional for separators, required otherwise.</param>
/// <param name="IsOptional">Whether the path part can be absent from the path. Optional.</param>
[DebuggerDisplay("Kind: {Kind}; Representation: {Representation}")]
public record LibraryPathTemplatePartRequest(
string? Kind,
string? Representation,
bool IsOptional
);
@@ -19,6 +19,7 @@ namespace Lumina.Contracts.Requests.MediaLibrary.Management;
/// <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="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>
[DebuggerDisplay("Title: {Title}")]
public record class UpdateLibraryRequest(
Guid Id,
@@ -31,5 +32,6 @@ public record class UpdateLibraryRequest(
bool IsLocked,
bool CanDownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan
bool ShouldSkipUnchangedDirectoriesDuringScan,
LibraryPathTemplatePartRequest[]? PathTemplateParts
);
@@ -0,0 +1,20 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.MediaLibrary.Management;
/// <summary>
/// Represents a path part definition response.
/// </summary>
/// <param name="Kind">The kind of the path part.</param>
/// <param name="ValueType">The value type captured by the path part.</param>
/// <param name="DefaultRepresentation">The default representation of the path part, pre-filled when it is added to a template.</param>
/// <param name="IsOptionalByDefault">Whether the path part is optional by default.</param>
[DebuggerDisplay("Kind: {Kind}; ValueType: {ValueType}")]
public record LibraryPathPartDefinitionResponse(
string Kind,
string ValueType,
string DefaultRepresentation,
bool IsOptionalByDefault
);
@@ -0,0 +1,17 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.MediaLibrary.Management;
/// <summary>
/// Represents a path template catalog response.
/// </summary>
/// <param name="Parts">The path parts that can be used in the path template of the library type.</param>
/// <param name="DefaultTemplateParts">The ordered parts of the default path template of the library type, describing the ideal structure the application expects.</param>
[DebuggerDisplay("Parts: {Parts.Count}; DefaultTemplateParts: {DefaultTemplateParts.Count}")]
public record LibraryPathTemplateCatalogResponse(
List<LibraryPathPartDefinitionResponse> Parts,
List<LibraryPathTemplatePartResponse> DefaultTemplateParts
);
@@ -0,0 +1,18 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.MediaLibrary.Management;
/// <summary>
/// Represents a path template part response.
/// </summary>
/// <param name="Kind">The kind of the path part.</param>
/// <param name="Representation">The literal text or the value mask of the path part.</param>
/// <param name="IsOptional">Whether the path part can be absent from the path.</param>
[DebuggerDisplay("Kind: {Kind}; Representation: {Representation}")]
public record LibraryPathTemplatePartResponse(
string Kind,
string Representation,
bool IsOptional
);
@@ -21,6 +21,7 @@ namespace Lumina.Contracts.Responses.MediaLibrary.Management;
/// <param name="CanDownloadMetadataFromWeb">Whether the media library should update the metadata of its elements from the web, or not.</param>
/// <param name="ShouldSaveMetadataInMediaDirectories">Whether the media library should copy the downloaded metadata into the media library content locations, or not.</param>
/// <param name="ShouldSkipUnchangedDirectoriesDuringScan">Whether the media library should skip the directories whose contents have not changed since the last scan, during the scan.</param>
/// <param name="PathTemplateParts">The ordered parts of the template describing the structure of the media library on disk.</param>
/// <param name="CreatedOnUtc">The date and time when the library was created.</param>
/// <param name="UpdatedOnUtc">The optional date and time when the library was updated.</param>
[DebuggerDisplay("Title: {Title}")]
@@ -36,6 +37,7 @@ public record LibraryResponse(
bool CanDownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan,
List<LibraryPathTemplatePartResponse> PathTemplateParts,
DateTime CreatedOnUtc,
DateTime? UpdatedOnUtc
);