Kavita+ Comic Metadata Matching (#3740)
This commit is contained in:
parent
4521965315
commit
ed154e4768
46 changed files with 4207 additions and 98 deletions
3433
API/Data/Migrations/20250415194829_KavitaPlusCBR.Designer.cs
generated
Normal file
3433
API/Data/Migrations/20250415194829_KavitaPlusCBR.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
106
API/Data/Migrations/20250415194829_KavitaPlusCBR.cs
Normal file
106
API/Data/Migrations/20250415194829_KavitaPlusCBR.cs
Normal file
|
@ -0,0 +1,106 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace API.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class KavitaPlusCBR : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "EnableChapterCoverImage",
|
||||
table: "MetadataSettings",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "EnableChapterPublisher",
|
||||
table: "MetadataSettings",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "EnableChapterReleaseDate",
|
||||
table: "MetadataSettings",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "EnableChapterSummary",
|
||||
table: "MetadataSettings",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "EnableChapterTitle",
|
||||
table: "MetadataSettings",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "CbrId",
|
||||
table: "ExternalSeriesMetadata",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "KavitaPlusConnection",
|
||||
table: "ChapterPeople",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "OrderWeight",
|
||||
table: "ChapterPeople",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EnableChapterCoverImage",
|
||||
table: "MetadataSettings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EnableChapterPublisher",
|
||||
table: "MetadataSettings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EnableChapterReleaseDate",
|
||||
table: "MetadataSettings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EnableChapterSummary",
|
||||
table: "MetadataSettings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EnableChapterTitle",
|
||||
table: "MetadataSettings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CbrId",
|
||||
table: "ExternalSeriesMetadata");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "KavitaPlusConnection",
|
||||
table: "ChapterPeople");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OrderWeight",
|
||||
table: "ChapterPeople");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ namespace API.Data.Migrations
|
|||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.3");
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.4");
|
||||
|
||||
modelBuilder.Entity("API.Entities.AppRole", b =>
|
||||
{
|
||||
|
@ -1429,6 +1429,9 @@ namespace API.Data.Migrations
|
|||
b.Property<int>("AverageExternalRating")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("CbrId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("GoogleBooksId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
|
@ -1645,6 +1648,21 @@ namespace API.Data.Migrations
|
|||
b.Property<string>("Blacklist")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("EnableChapterCoverImage")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("EnableChapterPublisher")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("EnableChapterReleaseDate")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("EnableChapterSummary")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("EnableChapterTitle")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("EnableCoverImage")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER")
|
||||
|
@ -1707,6 +1725,12 @@ namespace API.Data.Migrations
|
|||
b.Property<int>("Role")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("KavitaPlusConnection")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("OrderWeight")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("ChapterId", "PersonId", "Role");
|
||||
|
||||
b.HasIndex("PersonId");
|
||||
|
|
|
@ -47,6 +47,7 @@ public interface IChapterRepository
|
|||
Task<IEnumerable<string>> GetCoverImagesForLockedChaptersAsync();
|
||||
Task<ChapterDto> AddChapterModifiers(int userId, ChapterDto chapter);
|
||||
IEnumerable<Chapter> GetChaptersForSeries(int seriesId);
|
||||
Task<IList<Chapter>> GetAllChaptersForSeries(int seriesId);
|
||||
}
|
||||
public class ChapterRepository : IChapterRepository
|
||||
{
|
||||
|
@ -298,4 +299,15 @@ public class ChapterRepository : IChapterRepository
|
|||
.Include(c => c.Volume)
|
||||
.AsEnumerable();
|
||||
}
|
||||
|
||||
public async Task<IList<Chapter>> GetAllChaptersForSeries(int seriesId)
|
||||
{
|
||||
return await _context.Chapter
|
||||
.Where(c => c.Volume.SeriesId == seriesId)
|
||||
.OrderBy(c => c.SortOrder)
|
||||
.Include(c => c.Volume)
|
||||
.Include(c => c.People)
|
||||
.ThenInclude(cp => cp.Person)
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,8 +157,8 @@ public class ExternalSeriesMetadataRepository : IExternalSeriesMetadataRepositor
|
|||
.OrderByDescending(r => r.Score);
|
||||
}
|
||||
|
||||
IEnumerable<RatingDto> ratings = new List<RatingDto>();
|
||||
if (seriesDetailDto.ExternalRatings != null && seriesDetailDto.ExternalRatings.Any())
|
||||
IEnumerable<RatingDto> ratings = [];
|
||||
if (seriesDetailDto.ExternalRatings != null && seriesDetailDto.ExternalRatings.Count != 0)
|
||||
{
|
||||
ratings = seriesDetailDto.ExternalRatings
|
||||
.Select(r => _mapper.Map<RatingDto>(r));
|
||||
|
|
|
@ -312,6 +312,11 @@ public static class Seed
|
|||
EnableLocalizedName = false,
|
||||
FirstLastPeopleNaming = true,
|
||||
EnableCoverImage = true,
|
||||
EnableChapterTitle = false,
|
||||
EnableChapterSummary = true,
|
||||
EnableChapterPublisher = true,
|
||||
EnableChapterCoverImage = false,
|
||||
EnableChapterReleaseDate = true,
|
||||
PersonRoles = [PersonRole.Writer, PersonRole.CoverArtist, PersonRole.Character]
|
||||
};
|
||||
await context.MetadataSettings.AddAsync(existing);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue