Adds book reading support with EPUB and PDF reader plugins

This commit is contained in:
BinaryAlley committed 2026-09-02 04:45:11 -07:00
1 parent 275fd83ff2
commit f7ccdf3d1c
271 files changed
+11501 -361

No files matched your search

@@ -0,0 +1,21 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Reading;
/// <summary>
/// Represents the reading availability of a book.
/// </summary>
/// <param name="BookId">The Id of the book whose reading availability is reported.</param>
/// <param name="LibraryId">The Id of the media library the book belongs to.</param>
/// <param name="IsAvailable">Whether the book can be opened for reading.</param>
/// <param name="ErrorCode">The code of the error preventing the book from being read, when it cannot be read. Can be <see langword="null"/> when the book is available.</param>
[DebuggerDisplay("BookId: {BookId}, IsAvailable: {IsAvailable}")]
public sealed record ReadingAvailabilityResponse(
Guid BookId,
Guid LibraryId,
bool IsAvailable,
string? ErrorCode
);
@@ -0,0 +1,27 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Reading;
/// <summary>
/// Represents the reading manifest of a book, containing everything the client needs to render the reader.
/// </summary>
/// <param name="Title">The title of the book.</param>
/// <param name="Author">The author of the book, if known.</param>
/// <param name="CoverResourceKey">The resource key of the cover image of the book, if applicable.</param>
/// <param name="TableOfContents">The hierarchical table of contents of the book.</param>
/// <param name="Spine">The ordered spine of the reading sections of the book.</param>
/// <param name="ResourceKeys">The resource keys of the resources of the book.</param>
/// <param name="HasTextContent">Whether the book has extractable text content. A scanned book, whose pages are only images, has no text content.</param>
[DebuggerDisplay("Title: {Title}")]
public sealed record ReadingManifestResponse(
string Title,
string? Author,
string? CoverResourceKey,
IReadOnlyList<ReadingTocEntryResponse> TableOfContents,
IReadOnlyList<ReadingSpineItemResponse> Spine,
IReadOnlyList<string> ResourceKeys,
bool HasTextContent
);
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Reading;
/// <summary>
/// Represents an item of the spine of the reading manifest of a book.
/// </summary>
/// <param name="LocationRef">The opaque location reference of the reading section.</param>
/// <param name="Title">The title of the reading section, if known.</param>
[DebuggerDisplay("LocationRef: {LocationRef}")]
public sealed record ReadingSpineItemResponse(
string LocationRef,
string? Title
);
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.MediaLibrary.WrittenContentLibrary.BookLibrary.Books.Reading;
/// <summary>
/// Represents an entry of the table of contents of the reading manifest of a book.
/// </summary>
/// <param name="Label">The label of the table of contents entry.</param>
/// <param name="LocationRef">The opaque location reference of the reading section the entry points to.</param>
/// <param name="Children">The child entries of the table of contents entry.</param>
[DebuggerDisplay("Label: {Label}")]
public sealed record ReadingTocEntryResponse(
string Label,
string LocationRef,
IReadOnlyList<ReadingTocEntryResponse> Children
);
@@ -0,0 +1,22 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.Plugins;
/// <summary>
/// Represents a book reader configured for a media library.
/// </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>
[DebuggerDisplay("Name: {Name}")]
public sealed record LibraryBookReaderResponse(
Guid PluginId,
string Name,
IReadOnlyList<string> SupportedExtensions,
bool IsEnabled
);
@@ -14,6 +14,8 @@ namespace Lumina.Contracts.Responses.UsersManagement.Settings;
/// <param name="ShouldIgnoreThePrefixForAlphaPicker">Whether the "The" prefix of library item titles is ignored by the alpha picker, or not.</param>
/// <param name="IsThemeCachingEnabled">Whether the theme data served to this user is cached, or not.</param>
/// <param name="ShouldAggregateMetadataWhenMissing">Whether the metadata of the media library items is aggregated from multiple providers, when fields are missing, or not.</param>
/// <param name="ShouldRenderPdfAsImages">Whether PDF books are rendered as page images for the user, or not.</param>
/// <param name="ShouldPreserveBookStyles">Whether the styles of the book content are preserved when it is rendered for the user, or not.</param>
[DebuggerDisplay("UserId: {UserId}")]
public sealed record UserSettingsResponse(
Guid UserId,
@@ -21,5 +23,7 @@ public sealed record UserSettingsResponse(
int ItemsPerPage,
bool ShouldIgnoreThePrefixForAlphaPicker,
bool IsThemeCachingEnabled,
bool ShouldAggregateMetadataWhenMissing
bool ShouldAggregateMetadataWhenMissing,
bool ShouldRenderPdfAsImages,
bool ShouldPreserveBookStyles
);