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

@@ -0,0 +1,57 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Plugins;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
#endregion
namespace Lumina.DataAccess.Common.Configuration;
/// <summary>
/// Configures the entity mapping for the <see cref="LibraryArtworkProviderConfigurationEntity"/> entity.
/// </summary>
public class LibraryArtworkProviderConfigurationConfiguration : IEntityTypeConfiguration<LibraryArtworkProviderConfigurationEntity>
{
/// <summary>
/// Configures the <see cref="LibraryArtworkProviderConfigurationEntity"/> entity.
/// </summary>
/// <param name="builder">The builder to be used to configure the entity.</param>
public void Configure(EntityTypeBuilder<LibraryArtworkProviderConfigurationEntity> builder)
{
builder.ToTable("LibraryArtworkProviderConfigurations");
builder.HasKey(configuration => configuration.Id);
builder.Property(configuration => configuration.Id)
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
.HasColumnOrder(0);
builder.Property(configuration => configuration.LibraryId)
.IsRequired()
.HasColumnOrder(1);
builder.Property(configuration => configuration.PluginId)
.IsRequired()
.HasColumnOrder(2);
builder.Property(configuration => configuration.IsEnabled)
.IsRequired()
.HasColumnOrder(3);
builder.Property(configuration => configuration.Rank)
.IsRequired()
.HasColumnOrder(4);
// audit
builder.Property(configuration => configuration.CreatedOnUtc)
.IsRequired()
.HasColumnOrder(5);
builder.Property(configuration => configuration.CreatedBy)
.IsRequired()
.HasColumnOrder(6);
builder.Property(configuration => configuration.UpdatedOnUtc)
.HasDefaultValue(null)
.HasColumnOrder(7);
builder.Property(configuration => configuration.UpdatedBy)
.HasDefaultValue(null)
.HasColumnOrder(8);
builder.HasIndex(configuration => new { configuration.LibraryId, configuration.PluginId });
}
}
@@ -0,0 +1,106 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Lumina.DataAccess.Common.Migrations
{
/// <inheritdoc />
public partial class AddsArtworkProvidersAndBookCoverAndMetadataAggregation : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "IgnoreThePrefixForAlphaPicker",
table: "UserSettings",
newName: "ShouldIgnoreThePrefixForAlphaPicker");
migrationBuilder.RenameColumn(
name: "DownloadMetadataFromWeb",
table: "Libraries",
newName: "CanDownloadMetadataFromWeb");
migrationBuilder.AddColumn<bool>(
name: "ShouldAggregateMetadataWhenMissing",
table: "UserSettings",
type: "INTEGER",
nullable: false,
defaultValue: false)
.Annotation("Relational:ColumnOrder", 10);
migrationBuilder.AlterColumn<float>(
name: "VolumeNumber",
table: "Books",
type: "REAL",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
migrationBuilder.AddColumn<string>(
name: "CoverImagePath",
table: "Books",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "LibraryArtworkProviderConfigurations",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
LibraryId = table.Column<Guid>(type: "TEXT", nullable: false),
PluginId = table.Column<Guid>(type: "TEXT", nullable: false),
IsEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
Rank = table.Column<int>(type: "INTEGER", nullable: false),
CreatedOnUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
CreatedBy = table.Column<Guid>(type: "TEXT", nullable: false),
UpdatedOnUtc = table.Column<DateTime>(type: "TEXT", nullable: true),
UpdatedBy = table.Column<Guid>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_LibraryArtworkProviderConfigurations", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_LibraryArtworkProviderConfigurations_LibraryId_PluginId",
table: "LibraryArtworkProviderConfigurations",
columns: new[] { "LibraryId", "PluginId" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "LibraryArtworkProviderConfigurations");
migrationBuilder.DropColumn(
name: "ShouldAggregateMetadataWhenMissing",
table: "UserSettings");
migrationBuilder.DropColumn(
name: "CoverImagePath",
table: "Books");
migrationBuilder.RenameColumn(
name: "ShouldIgnoreThePrefixForAlphaPicker",
table: "UserSettings",
newName: "IgnoreThePrefixForAlphaPicker");
migrationBuilder.RenameColumn(
name: "CanDownloadMetadataFromWeb",
table: "Libraries",
newName: "DownloadMetadataFromWeb");
migrationBuilder.AlterColumn<int>(
name: "VolumeNumber",
table: "Books",
type: "INTEGER",
nullable: true,
oldClrType: typeof(float),
oldType: "REAL",
oldNullable: true);
}
}
}
@@ -270,6 +270,12 @@ namespace Lumina.DataAccess.Common.Migrations
.HasColumnType("TEXT")
.HasColumnOrder(0);
b.Property<bool>("CanDownloadMetadataFromWeb")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(true)
.HasColumnOrder(6);
b.Property<string>("CoverImage")
.HasMaxLength(255)
.HasColumnType("TEXT")
@@ -283,12 +289,6 @@ namespace Lumina.DataAccess.Common.Migrations
.HasColumnType("TEXT")
.HasColumnOrder(9);
b.Property<bool>("DownloadMetadataFromWeb")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(true)
.HasColumnOrder(6);
b.Property<bool>("IsEnabled")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
@@ -535,6 +535,9 @@ namespace Lumina.DataAccess.Common.Migrations
.HasColumnType("TEXT")
.HasColumnOrder(28);
b.Property<string>("CoverImagePath")
.HasColumnType("TEXT");
b.Property<Guid>("CreatedBy")
.HasColumnType("TEXT")
.HasColumnOrder(33);
@@ -685,8 +688,8 @@ namespace Lumina.DataAccess.Common.Migrations
.HasColumnType("TEXT")
.HasColumnOrder(34);
b.Property<int?>("VolumeNumber")
.HasColumnType("INTEGER")
b.Property<float?>("VolumeNumber")
.HasColumnType("REAL")
.HasColumnOrder(20);
b.HasKey("Id");
@@ -698,6 +701,51 @@ namespace Lumina.DataAccess.Common.Migrations
b.ToTable("Books", (string)null);
});
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Plugins.LibraryArtworkProviderConfigurationEntity", b =>
{
b.Property<Guid>("Id")
.HasColumnType("TEXT")
.HasColumnOrder(0);
b.Property<Guid>("CreatedBy")
.HasColumnType("TEXT")
.HasColumnOrder(6);
b.Property<DateTime>("CreatedOnUtc")
.HasColumnType("TEXT")
.HasColumnOrder(5);
b.Property<bool>("IsEnabled")
.HasColumnType("INTEGER")
.HasColumnOrder(3);
b.Property<Guid>("LibraryId")
.HasColumnType("TEXT")
.HasColumnOrder(1);
b.Property<Guid>("PluginId")
.HasColumnType("TEXT")
.HasColumnOrder(2);
b.Property<int>("Rank")
.HasColumnType("INTEGER")
.HasColumnOrder(4);
b.Property<Guid?>("UpdatedBy")
.HasColumnType("TEXT")
.HasColumnOrder(8);
b.Property<DateTime?>("UpdatedOnUtc")
.HasColumnType("TEXT")
.HasColumnOrder(7);
b.HasKey("Id");
b.HasIndex("LibraryId", "PluginId");
b.ToTable("LibraryArtworkProviderConfigurations", (string)null);
});
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Plugins.LibraryMetadataProviderConfigurationEntity", b =>
{
b.Property<Guid>("Id")
@@ -964,10 +1012,6 @@ namespace Lumina.DataAccess.Common.Migrations
.HasColumnType("TEXT")
.HasColumnOrder(5);
b.Property<bool>("IgnoreThePrefixForAlphaPicker")
.HasColumnType("INTEGER")
.HasColumnOrder(4);
b.Property<bool>("IsPaginationEnabled")
.HasColumnType("INTEGER")
.HasColumnOrder(2);
@@ -980,6 +1024,14 @@ namespace Lumina.DataAccess.Common.Migrations
.HasColumnType("INTEGER")
.HasColumnOrder(3);
b.Property<bool>("ShouldAggregateMetadataWhenMissing")
.HasColumnType("INTEGER")
.HasColumnOrder(10);
b.Property<bool>("ShouldIgnoreThePrefixForAlphaPicker")
.HasColumnType("INTEGER")
.HasColumnOrder(4);
b.Property<Guid?>("UpdatedBy")
.HasColumnType("TEXT")
.HasColumnOrder(8);