Adds artwork provider system and Calibre plugin

This commit is contained in:
BinaryAlley committed 2026-08-24 14:18:14 -07:00
1 parent c82fadc7a2
commit 6693ff3f60
124 files changed
+9715 -74

No files matched your search

@@ -137,7 +137,7 @@ public class BookDto
/// <summary>
/// Gets the volume or book number in the series, if applicable.
/// </summary>
public int? VolumeNumber { get; init; }
public float? VolumeNumber { get; init; }
/// <summary>
/// Gets the series id, if the book is part of a series.
@@ -29,4 +29,9 @@ public enum BookRatingSource
/// Ratings from Google Books, a service that searches the full text of books and magazines that Google has scanned and converted to text.
/// </summary>
GoogleBooks,
/// <summary>
/// Ratings sourced from Calibre, an ebook management application.
/// </summary>
Calibre,
}
@@ -42,7 +42,7 @@ public class GetBooksLiteRequest
/// <summary>
/// Gets or sets whether the leading "The " prefix of a title is ignored when computing the alpha key, or not.
/// </summary>
public bool IgnoreThePrefixForAlphaPicker { get; set; }
public bool ShouldIgnoreThePrefixForAlphaPicker { get; set; }
/// <summary>
/// Gets or sets the name of the field by which to sort the results.
@@ -93,6 +93,33 @@ public static class ValidatorUtilities
return ruleBuilder.Must(value => !value.HasValue || value.Value > valueToCompare);
}
/// <summary>
/// Defines a validation rule that ensures the float property is greater than the specified value.
/// </summary>
/// <typeparam name="TRequest">The type of the request being validated.</typeparam>
/// <param name="ruleBuilder">The rule builder instance.</param>
/// <param name="valueToCompare">The value that the property must be greater than.</param>
/// <returns>The current <see cref="IRuleBuilder{TRequest, TProperty}"/> instance for method chaining.</returns>
public static IRuleBuilder<TRequest, float> GreaterThan<TRequest>(this IRuleBuilder<TRequest, float> ruleBuilder, float valueToCompare)
{
return ruleBuilder.Must(value => value > valueToCompare);
}
/// <summary>
/// Defines a validation rule that ensures the nullable float property is greater than the specified value.
/// </summary>
/// <remarks>
/// If the property is <see langword="null"/>, this rule passes (use <see cref="NotNull{TRequest, TProperty}(IRuleBuilder{TRequest, TProperty})"/> to check for missing values).
/// </remarks>
/// <typeparam name="TRequest">The type of the request being validated.</typeparam>
/// <param name="ruleBuilder">The rule builder instance.</param>
/// <param name="valueToCompare">The value that the property must be greater than.</param>
/// <returns>The current <see cref="IRuleBuilder{TRequest, TProperty}"/> instance for method chaining.</returns>
public static IRuleBuilder<TRequest, float?> GreaterThan<TRequest>(this IRuleBuilder<TRequest, float?> ruleBuilder, float valueToCompare)
{
return ruleBuilder.Must(value => !value.HasValue || value.Value > valueToCompare);
}
/// <summary>
/// Defines a validation rule that ensures the time span property is greater than the specified value.
/// </summary>
@@ -5,7 +5,6 @@ using Lumina.Presentation.Web.Common.DTO.Libraries;
using Lumina.Presentation.Web.Common.Requests.Libraries;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using System;
using System.Text;
@@ -71,7 +70,7 @@ public class GetLibraryItemsEndpoint : BaseEndpoint<GetBooksLiteRequest, IResult
endpoint.Append($"&searchTerm={Uri.EscapeDataString(query.SearchTerm)}");
if (!string.IsNullOrWhiteSpace(query.FilterAlphaKey))
endpoint.Append($"&filterAlphaKey={Uri.EscapeDataString(query.FilterAlphaKey)}");
endpoint.Append($"&ignoreThePrefixForAlphaPicker={query.IgnoreThePrefixForAlphaPicker}");
endpoint.Append($"&shouldIgnoreThePrefixForAlphaPicker={query.ShouldIgnoreThePrefixForAlphaPicker}");
if (!string.IsNullOrWhiteSpace(query.SortBy))
endpoint.Append($"&sortBy={Uri.EscapeDataString(query.SortBy)}");
if (query.SortOrder is not null)
@@ -3,7 +3,6 @@ using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.Common;
using Lumina.Presentation.Web.Common.DTO.Libraries;
using Lumina.Presentation.Web.Common.Requests.Libraries;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
@@ -28,7 +27,7 @@ public class GetLibraryItemsEndpointSummary : Summary<GetLibraryItemsEndpoint, G
RequestParam(r => r.PerPage, "Optional. The maximum number of books to retrieve per page.");
RequestParam(r => r.SearchTerm, "Optional. The search term used to filter results.");
RequestParam(r => r.FilterAlphaKey, "Optional. The alpha key used to filter the results by the first character of their title, for the alpha picker.");
RequestParam(r => r.IgnoreThePrefixForAlphaPicker, "Whether the leading The prefix of a title is ignored when computing the alpha key, or not.");
RequestParam(r => r.ShouldIgnoreThePrefixForAlphaPicker, "Whether the leading The prefix of a title is ignored when computing the alpha key, or not.");
RequestParam(r => r.SortBy, "Optional. The name of the field by which to sort the results.");
RequestParam(r => r.SortOrder, "Optional. The direction in which to sort the results.");
@@ -100,7 +100,7 @@
params.set('searchTerm', state.searchTerm);
if (state.alphaKey !== null)
params.set('filterAlphaKey', state.alphaKey);
params.set('ignoreThePrefixForAlphaPicker', state.ignoreThePrefix);
params.set('shouldIgnoreThePrefixForAlphaPicker', state.ignoreThePrefix);
params.set('sortOrder', state.sortOrder);
return `${url}?${params.toString()}`;
}
@@ -259,7 +259,7 @@
async function loadSettingsAsync() {
const data = await callApiGetAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Settings.GET_USER_SETTINGS)');
if (data) {
state.ignoreThePrefix = data.ignoreThePrefixForAlphaPicker === true;
state.ignoreThePrefix = data.shouldIgnoreThePrefixForAlphaPicker === true;
state.perPage = data.isPaginationEnabled === true ? data.itemsPerPage : null;
}
}