mirror of
https://github.com/C9Glax/tranga.git
synced 2025-05-09 00:22:08 +02:00
Compare commits
5 Commits
235183cd7f
...
1d2ca4d76a
Author | SHA1 | Date | |
---|---|---|---|
1d2ca4d76a | |||
e2ff2c76ed | |||
8a0829ef69 | |||
d257095885 | |||
68cc23e158 |
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
|
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
|
||||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.71" />
|
<PackageReference Include="HtmlAgilityPack" Version="1.11.74" />
|
||||||
<PackageReference Include="log4net" Version="3.0.3" />
|
<PackageReference Include="log4net" Version="3.0.3" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
|
||||||
@ -20,13 +20,13 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Npgsql" Version="9.0.2" />
|
<PackageReference Include="Npgsql" Version="9.0.3" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.2" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" />
|
||||||
<PackageReference Include="PuppeteerSharp" Version="20.0.5" />
|
<PackageReference Include="PuppeteerSharp" Version="20.1.3" />
|
||||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
|
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.6" />
|
||||||
<PackageReference Include="Soenneker.Utils.String.NeedlemanWunsch" Version="3.0.697" />
|
<PackageReference Include="Soenneker.Utils.String.NeedlemanWunsch" Version="3.0.919" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.3.1" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
|
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ public class JobController(PgsqlContext context) : Controller
|
|||||||
{
|
{
|
||||||
context.Jobs.Add(job);
|
context.Jobs.Add(job);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return Created();
|
return new CreatedResult(job.JobId, job);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -193,11 +193,15 @@ public class JobController(PgsqlContext context) : Controller
|
|||||||
/// Starts the Job with the requested ID
|
/// Starts the Job with the requested ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">Job-ID</param>
|
/// <param name="id">Job-ID</param>
|
||||||
/// <returns>Nothing</returns>
|
/// <response code="202">Job started</response>
|
||||||
|
/// <response code="404">Job with ID not found</response>
|
||||||
|
/// <response code="409">Job was already running</response>
|
||||||
|
/// <response code="500">Internal Error</response>
|
||||||
[HttpPost("{id}/Start")]
|
[HttpPost("{id}/Start")]
|
||||||
[ProducesResponseType(Status202Accepted)]
|
[ProducesResponseType<AcceptedResult>(Status202Accepted)]
|
||||||
[ProducesResponseType(Status404NotFound)]
|
[ProducesResponseType<NotFoundResult>(Status404NotFound)]
|
||||||
[ProducesResponseType(Status500InternalServerError)]
|
[ProducesResponseType<ConflictResult>(Status409Conflict)]
|
||||||
|
[ProducesResponseType<ObjectResult>(Status500InternalServerError)]
|
||||||
public IActionResult StartJob(string id)
|
public IActionResult StartJob(string id)
|
||||||
{
|
{
|
||||||
Job? ret = context.Jobs.Find(id);
|
Job? ret = context.Jobs.Find(id);
|
||||||
@ -205,7 +209,9 @@ public class JobController(PgsqlContext context) : Controller
|
|||||||
return NotFound();
|
return NotFound();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
context.Update(ret);
|
if (ret.state >= JobState.Running && ret.state < JobState.Completed)
|
||||||
|
return new ConflictResult();
|
||||||
|
ret.LastExecution = DateTime.UnixEpoch;
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return Accepted();
|
return Accepted();
|
||||||
}
|
}
|
||||||
@ -215,6 +221,19 @@ public class JobController(PgsqlContext context) : Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// NOT IMPLEMENTED. Stops the Job with the requested ID
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">Job-ID</param>
|
||||||
|
/// <response code="202">Job started</response>
|
||||||
|
/// <response code="404">Job with ID not found</response>
|
||||||
|
/// <response code="409">Job was not running</response>
|
||||||
|
/// <response code="500">Internal Error</response>
|
||||||
|
/// <remarks>NOT IMPLEMENTED</remarks>
|
||||||
|
[ProducesResponseType<AcceptedResult>(Status202Accepted)]
|
||||||
|
[ProducesResponseType<NotFoundResult>(Status404NotFound)]
|
||||||
|
[ProducesResponseType<ConflictResult>(Status409Conflict)]
|
||||||
|
[ProducesResponseType<ObjectResult>(Status500InternalServerError)]
|
||||||
[HttpPost("{id}/Stop")]
|
[HttpPost("{id}/Stop")]
|
||||||
public IActionResult StopJob(string id)
|
public IActionResult StopJob(string id)
|
||||||
{
|
{
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace API.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class ChapterNumber : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "VolumeNumber",
|
|
||||||
table: "Chapters",
|
|
||||||
type: "integer",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(float),
|
|
||||||
oldType: "real",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<string>(
|
|
||||||
name: "ChapterNumber",
|
|
||||||
table: "Chapters",
|
|
||||||
type: "character varying(10)",
|
|
||||||
maxLength: 10,
|
|
||||||
nullable: false,
|
|
||||||
oldClrType: typeof(float),
|
|
||||||
oldType: "real");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AlterColumn<float>(
|
|
||||||
name: "VolumeNumber",
|
|
||||||
table: "Chapters",
|
|
||||||
type: "real",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "integer",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<float>(
|
|
||||||
name: "ChapterNumber",
|
|
||||||
table: "Chapters",
|
|
||||||
type: "real",
|
|
||||||
nullable: false,
|
|
||||||
oldClrType: typeof(string),
|
|
||||||
oldType: "character varying(10)",
|
|
||||||
oldMaxLength: 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
namespace API.Migrations
|
namespace API.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(PgsqlContext))]
|
[DbContext(typeof(PgsqlContext))]
|
||||||
[Migration("20250111180034_ChapterNumber")]
|
[Migration("20250303141044_dev-030325-1")]
|
||||||
partial class ChapterNumber
|
partial class dev0303251
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -471,27 +471,6 @@ namespace API.Migrations
|
|||||||
b.HasDiscriminator().HasValue("MangaKatana");
|
b.HasDiscriminator().HasValue("MangaKatana");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.MangaConnectors.MangaLife", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("Manga4Life");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.MangaConnectors.Manganato", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("Manganato");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.MangaConnectors.Mangasee", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("Mangasee");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.MangaConnectors.Mangaworld", b =>
|
modelBuilder.Entity("API.Schema.MangaConnectors.Mangaworld", b =>
|
||||||
{
|
{
|
||||||
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
namespace API.Migrations
|
namespace API.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class Initial : Migration
|
public partial class dev0303251 : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
@ -68,6 +68,21 @@ namespace API.Migrations
|
|||||||
table.PrimaryKey("PK_NotificationConnectors", x => x.NotificationConnectorId);
|
table.PrimaryKey("PK_NotificationConnectors", x => x.NotificationConnectorId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Notifications",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
NotificationId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
|
Urgency = table.Column<byte>(type: "smallint", nullable: false),
|
||||||
|
Title = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Message = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Notifications", x => x.NotificationId);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Tags",
|
name: "Tags",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -79,40 +94,6 @@ namespace API.Migrations
|
|||||||
table.PrimaryKey("PK_Tags", x => x.Tag);
|
table.PrimaryKey("PK_Tags", x => x.Tag);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "AltTitles",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
AltTitleId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
|
||||||
Language = table.Column<string>(type: "character varying(8)", maxLength: 8, nullable: false),
|
|
||||||
Title = table.Column<string>(type: "text", nullable: false),
|
|
||||||
MangaId = table.Column<string>(type: "character varying(64)", nullable: false),
|
|
||||||
AltTitleIds = table.Column<string>(type: "text", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_AltTitles", x => x.AltTitleId);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Chapters",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
ChapterId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
|
||||||
VolumeNumber = table.Column<float>(type: "real", nullable: true),
|
|
||||||
ChapterNumber = table.Column<float>(type: "real", nullable: false),
|
|
||||||
Url = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Title = table.Column<string>(type: "text", nullable: true),
|
|
||||||
ArchiveFileName = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Downloaded = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
ParentMangaId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
|
||||||
ChapterIds = table.Column<string>(type: "text", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Chapters", x => x.ChapterId);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Manga",
|
name: "Manga",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -121,70 +102,153 @@ namespace API.Migrations
|
|||||||
ConnectorId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
ConnectorId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
Name = table.Column<string>(type: "text", nullable: false),
|
Name = table.Column<string>(type: "text", nullable: false),
|
||||||
Description = table.Column<string>(type: "text", nullable: false),
|
Description = table.Column<string>(type: "text", nullable: false),
|
||||||
|
WebsiteUrl = table.Column<string>(type: "text", nullable: false),
|
||||||
CoverUrl = table.Column<string>(type: "text", nullable: false),
|
CoverUrl = table.Column<string>(type: "text", nullable: false),
|
||||||
CoverFileNameInCache = table.Column<string>(type: "text", nullable: true),
|
CoverFileNameInCache = table.Column<string>(type: "text", nullable: true),
|
||||||
year = table.Column<long>(type: "bigint", nullable: false),
|
Year = table.Column<long>(type: "bigint", nullable: false),
|
||||||
OriginalLanguage = table.Column<string>(type: "text", nullable: true),
|
OriginalLanguage = table.Column<string>(type: "text", nullable: true),
|
||||||
ReleaseStatus = table.Column<byte>(type: "smallint", nullable: false),
|
ReleaseStatus = table.Column<byte>(type: "smallint", nullable: false),
|
||||||
FolderName = table.Column<string>(type: "text", nullable: false),
|
FolderName = table.Column<string>(type: "text", nullable: false),
|
||||||
IgnoreChapterBefore = table.Column<float>(type: "real", nullable: false),
|
IgnoreChapterBefore = table.Column<float>(type: "real", nullable: false),
|
||||||
LatestChapterDownloadedId = table.Column<string>(type: "character varying(64)", nullable: true),
|
MangaConnectorId = table.Column<string>(type: "character varying(32)", nullable: false)
|
||||||
LatestChapterAvailableId = table.Column<string>(type: "character varying(64)", nullable: true),
|
|
||||||
MangaConnectorName = table.Column<string>(type: "character varying(32)", nullable: false),
|
|
||||||
AuthorIds = table.Column<string[]>(type: "text[]", nullable: false),
|
|
||||||
TagIds = table.Column<string[]>(type: "text[]", nullable: false),
|
|
||||||
LinkIds = table.Column<string[]>(type: "text[]", nullable: false),
|
|
||||||
AltTitleIds = table.Column<string[]>(type: "text[]", nullable: false),
|
|
||||||
MangaIds = table.Column<string>(type: "text", nullable: false)
|
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Manga", x => x.MangaId);
|
table.PrimaryKey("PK_Manga", x => x.MangaId);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Manga_Chapters_LatestChapterAvailableId",
|
name: "FK_Manga_MangaConnectors_MangaConnectorId",
|
||||||
column: x => x.LatestChapterAvailableId,
|
column: x => x.MangaConnectorId,
|
||||||
principalTable: "Chapters",
|
|
||||||
principalColumn: "ChapterId");
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Manga_Chapters_LatestChapterDownloadedId",
|
|
||||||
column: x => x.LatestChapterDownloadedId,
|
|
||||||
principalTable: "Chapters",
|
|
||||||
principalColumn: "ChapterId");
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Manga_MangaConnectors_MangaConnectorName",
|
|
||||||
column: x => x.MangaConnectorName,
|
|
||||||
principalTable: "MangaConnectors",
|
principalTable: "MangaConnectors",
|
||||||
principalColumn: "Name",
|
principalColumn: "Name",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AltTitles",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
AltTitleId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
|
Language = table.Column<string>(type: "character varying(8)", maxLength: 8, nullable: false),
|
||||||
|
Title = table.Column<string>(type: "text", nullable: false),
|
||||||
|
MangaId = table.Column<string>(type: "character varying(64)", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AltTitles", x => x.AltTitleId);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AltTitles_Manga_MangaId",
|
||||||
|
column: x => x.MangaId,
|
||||||
|
principalTable: "Manga",
|
||||||
|
principalColumn: "MangaId");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AuthorManga",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
AuthorsAuthorId = table.Column<string>(type: "character varying(64)", nullable: false),
|
||||||
|
MangaId = table.Column<string>(type: "character varying(64)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AuthorManga", x => new { x.AuthorsAuthorId, x.MangaId });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AuthorManga_Authors_AuthorsAuthorId",
|
||||||
|
column: x => x.AuthorsAuthorId,
|
||||||
|
principalTable: "Authors",
|
||||||
|
principalColumn: "AuthorId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AuthorManga_Manga_MangaId",
|
||||||
|
column: x => x.MangaId,
|
||||||
|
principalTable: "Manga",
|
||||||
|
principalColumn: "MangaId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Chapters",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ChapterId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
|
VolumeNumber = table.Column<int>(type: "integer", nullable: true),
|
||||||
|
ChapterNumber = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
|
||||||
|
Url = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Title = table.Column<string>(type: "text", nullable: true),
|
||||||
|
ArchiveFileName = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Downloaded = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
|
ParentMangaId = table.Column<string>(type: "character varying(64)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Chapters", x => x.ChapterId);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Chapters_Manga_ParentMangaId",
|
||||||
|
column: x => x.ParentMangaId,
|
||||||
|
principalTable: "Manga",
|
||||||
|
principalColumn: "MangaId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Link",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
LinkId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
|
LinkProvider = table.Column<string>(type: "text", nullable: false),
|
||||||
|
LinkUrl = table.Column<string>(type: "text", nullable: false),
|
||||||
|
MangaId = table.Column<string>(type: "character varying(64)", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Link", x => x.LinkId);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Link_Manga_MangaId",
|
||||||
|
column: x => x.MangaId,
|
||||||
|
principalTable: "Manga",
|
||||||
|
principalColumn: "MangaId");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "MangaMangaTag",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
MangaId = table.Column<string>(type: "character varying(64)", nullable: false),
|
||||||
|
TagsTag = table.Column<string>(type: "text", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_MangaMangaTag", x => new { x.MangaId, x.TagsTag });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MangaMangaTag_Manga_MangaId",
|
||||||
|
column: x => x.MangaId,
|
||||||
|
principalTable: "Manga",
|
||||||
|
principalColumn: "MangaId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MangaMangaTag_Tags_TagsTag",
|
||||||
|
column: x => x.TagsTag,
|
||||||
|
principalTable: "Tags",
|
||||||
|
principalColumn: "Tag",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Jobs",
|
name: "Jobs",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
JobId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
JobId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
ParentJobId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
ParentJobId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
||||||
DependsOnJobIds = table.Column<string[]>(type: "text[]", maxLength: 64, nullable: true),
|
DependsOnJobsIds = table.Column<string[]>(type: "text[]", maxLength: 64, nullable: true),
|
||||||
JobType = table.Column<byte>(type: "smallint", nullable: false),
|
JobType = table.Column<byte>(type: "smallint", nullable: false),
|
||||||
RecurrenceMs = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
RecurrenceMs = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
||||||
LastExecution = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
LastExecution = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
NextExecution = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
||||||
state = table.Column<int>(type: "integer", nullable: false),
|
state = table.Column<int>(type: "integer", nullable: false),
|
||||||
JobId1 = table.Column<string>(type: "character varying(64)", nullable: true),
|
JobId1 = table.Column<string>(type: "character varying(64)", nullable: true),
|
||||||
ImagesLocation = table.Column<string>(type: "text", nullable: true),
|
|
||||||
ComicInfoLocation = table.Column<string>(type: "text", nullable: true),
|
|
||||||
CreateArchiveJob_ChapterId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
|
||||||
Path = table.Column<string>(type: "text", nullable: true),
|
|
||||||
CreateComicInfoXmlJob_ChapterId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
|
||||||
MangaId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
MangaId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
||||||
ChapterId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
ChapterId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
||||||
FromLocation = table.Column<string>(type: "text", nullable: true),
|
FromLocation = table.Column<string>(type: "text", nullable: true),
|
||||||
ToLocation = table.Column<string>(type: "text", nullable: true),
|
ToLocation = table.Column<string>(type: "text", nullable: true),
|
||||||
ProcessImagesJob_Path = table.Column<string>(type: "text", nullable: true),
|
|
||||||
Bw = table.Column<bool>(type: "boolean", nullable: true),
|
|
||||||
Compression = table.Column<int>(type: "integer", nullable: true),
|
|
||||||
SearchString = table.Column<string>(type: "text", nullable: true),
|
|
||||||
MangaConnectorName = table.Column<string>(type: "text", nullable: true),
|
|
||||||
UpdateMetadataJob_MangaId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true)
|
UpdateMetadataJob_MangaId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
@ -196,23 +260,16 @@ namespace API.Migrations
|
|||||||
principalTable: "Chapters",
|
principalTable: "Chapters",
|
||||||
principalColumn: "ChapterId",
|
principalColumn: "ChapterId",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Jobs_Chapters_CreateArchiveJob_ChapterId",
|
|
||||||
column: x => x.CreateArchiveJob_ChapterId,
|
|
||||||
principalTable: "Chapters",
|
|
||||||
principalColumn: "ChapterId",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Jobs_Chapters_CreateComicInfoXmlJob_ChapterId",
|
|
||||||
column: x => x.CreateComicInfoXmlJob_ChapterId,
|
|
||||||
principalTable: "Chapters",
|
|
||||||
principalColumn: "ChapterId",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Jobs_Jobs_JobId1",
|
name: "FK_Jobs_Jobs_JobId1",
|
||||||
column: x => x.JobId1,
|
column: x => x.JobId1,
|
||||||
principalTable: "Jobs",
|
principalTable: "Jobs",
|
||||||
principalColumn: "JobId");
|
principalColumn: "JobId");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Jobs_Jobs_ParentJobId",
|
||||||
|
column: x => x.ParentJobId,
|
||||||
|
principalTable: "Jobs",
|
||||||
|
principalColumn: "JobId");
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Jobs_Manga_MangaId",
|
name: "FK_Jobs_Manga_MangaId",
|
||||||
column: x => x.MangaId,
|
column: x => x.MangaId,
|
||||||
@ -227,90 +284,16 @@ namespace API.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Link",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
LinkId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
|
||||||
LinkProvider = table.Column<string>(type: "text", nullable: false),
|
|
||||||
LinkUrl = table.Column<string>(type: "text", nullable: false),
|
|
||||||
MangaId = table.Column<string>(type: "character varying(64)", nullable: false),
|
|
||||||
LinkIds = table.Column<string>(type: "text", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Link", x => x.LinkId);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Link_Manga_MangaId",
|
|
||||||
column: x => x.MangaId,
|
|
||||||
principalTable: "Manga",
|
|
||||||
principalColumn: "MangaId",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "MangaAuthor",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
MangaId = table.Column<string>(type: "character varying(64)", nullable: false),
|
|
||||||
AuthorId = table.Column<string>(type: "character varying(64)", nullable: false),
|
|
||||||
AuthorIds = table.Column<string>(type: "text", nullable: true),
|
|
||||||
MangaIds = table.Column<string>(type: "text", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_MangaAuthor", x => new { x.MangaId, x.AuthorId });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MangaAuthor_Authors_AuthorId",
|
|
||||||
column: x => x.AuthorId,
|
|
||||||
principalTable: "Authors",
|
|
||||||
principalColumn: "AuthorId",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MangaAuthor_Manga_MangaId",
|
|
||||||
column: x => x.MangaId,
|
|
||||||
principalTable: "Manga",
|
|
||||||
principalColumn: "MangaId",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "MangaTag",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
MangaId = table.Column<string>(type: "character varying(64)", nullable: false),
|
|
||||||
Tag = table.Column<string>(type: "text", nullable: false),
|
|
||||||
MangaIds = table.Column<string>(type: "text", nullable: false),
|
|
||||||
TagIds = table.Column<string>(type: "text", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_MangaTag", x => new { x.MangaId, x.Tag });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MangaTag_Manga_MangaId",
|
|
||||||
column: x => x.MangaId,
|
|
||||||
principalTable: "Manga",
|
|
||||||
principalColumn: "MangaId",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MangaTag_Tags_MangaIds",
|
|
||||||
column: x => x.MangaIds,
|
|
||||||
principalTable: "Tags",
|
|
||||||
principalColumn: "Tag",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_MangaTag_Tags_Tag",
|
|
||||||
column: x => x.Tag,
|
|
||||||
principalTable: "Tags",
|
|
||||||
principalColumn: "Tag",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_AltTitles_MangaId",
|
name: "IX_AltTitles_MangaId",
|
||||||
table: "AltTitles",
|
table: "AltTitles",
|
||||||
column: "MangaId");
|
column: "MangaId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AuthorManga_MangaId",
|
||||||
|
table: "AuthorManga",
|
||||||
|
column: "MangaId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Chapters_ParentMangaId",
|
name: "IX_Chapters_ParentMangaId",
|
||||||
table: "Chapters",
|
table: "Chapters",
|
||||||
@ -321,16 +304,6 @@ namespace API.Migrations
|
|||||||
table: "Jobs",
|
table: "Jobs",
|
||||||
column: "ChapterId");
|
column: "ChapterId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Jobs_CreateArchiveJob_ChapterId",
|
|
||||||
table: "Jobs",
|
|
||||||
column: "CreateArchiveJob_ChapterId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Jobs_CreateComicInfoXmlJob_ChapterId",
|
|
||||||
table: "Jobs",
|
|
||||||
column: "CreateComicInfoXmlJob_ChapterId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Jobs_JobId1",
|
name: "IX_Jobs_JobId1",
|
||||||
table: "Jobs",
|
table: "Jobs",
|
||||||
@ -341,6 +314,11 @@ namespace API.Migrations
|
|||||||
table: "Jobs",
|
table: "Jobs",
|
||||||
column: "MangaId");
|
column: "MangaId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Jobs_ParentJobId",
|
||||||
|
table: "Jobs",
|
||||||
|
column: "ParentJobId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Jobs_UpdateMetadataJob_MangaId",
|
name: "IX_Jobs_UpdateMetadataJob_MangaId",
|
||||||
table: "Jobs",
|
table: "Jobs",
|
||||||
@ -352,64 +330,25 @@ namespace API.Migrations
|
|||||||
column: "MangaId");
|
column: "MangaId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Manga_LatestChapterAvailableId",
|
name: "IX_Manga_MangaConnectorId",
|
||||||
table: "Manga",
|
table: "Manga",
|
||||||
column: "LatestChapterAvailableId",
|
column: "MangaConnectorId");
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Manga_LatestChapterDownloadedId",
|
name: "IX_MangaMangaTag_TagsTag",
|
||||||
table: "Manga",
|
table: "MangaMangaTag",
|
||||||
column: "LatestChapterDownloadedId",
|
column: "TagsTag");
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Manga_MangaConnectorName",
|
|
||||||
table: "Manga",
|
|
||||||
column: "MangaConnectorName");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MangaAuthor_AuthorId",
|
|
||||||
table: "MangaAuthor",
|
|
||||||
column: "AuthorId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MangaTag_MangaIds",
|
|
||||||
table: "MangaTag",
|
|
||||||
column: "MangaIds");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_MangaTag_Tag",
|
|
||||||
table: "MangaTag",
|
|
||||||
column: "Tag");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_AltTitles_Manga_MangaId",
|
|
||||||
table: "AltTitles",
|
|
||||||
column: "MangaId",
|
|
||||||
principalTable: "Manga",
|
|
||||||
principalColumn: "MangaId",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Chapters_Manga_ParentMangaId",
|
|
||||||
table: "Chapters",
|
|
||||||
column: "ParentMangaId",
|
|
||||||
principalTable: "Manga",
|
|
||||||
principalColumn: "MangaId",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Chapters_Manga_ParentMangaId",
|
|
||||||
table: "Chapters");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "AltTitles");
|
name: "AltTitles");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AuthorManga");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Jobs");
|
name: "Jobs");
|
||||||
|
|
||||||
@ -420,26 +359,26 @@ namespace API.Migrations
|
|||||||
name: "Link");
|
name: "Link");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "MangaAuthor");
|
name: "MangaMangaTag");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "MangaTag");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "NotificationConnectors");
|
name: "NotificationConnectors");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Notifications");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Authors");
|
name: "Authors");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Chapters");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Tags");
|
name: "Tags");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Manga");
|
name: "Manga");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Chapters");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "MangaConnectors");
|
name: "MangaConnectors");
|
||||||
}
|
}
|
@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
namespace API.Migrations
|
namespace API.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(PgsqlContext))]
|
[DbContext(typeof(PgsqlContext))]
|
||||||
[Migration("20241201235443_Initial")]
|
[Migration("20250303145324_dev-030325-2")]
|
||||||
partial class Initial
|
partial class dev0303252
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -50,19 +50,16 @@ namespace API.Migrations
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("ChapterIds")
|
b.Property<string>("ChapterNumber")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasMaxLength(10)
|
||||||
|
.HasColumnType("character varying(10)");
|
||||||
b.Property<float>("ChapterNumber")
|
|
||||||
.HasColumnType("real");
|
|
||||||
|
|
||||||
b.Property<bool>("Downloaded")
|
b.Property<bool>("Downloaded")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
b.Property<string>("ParentMangaId")
|
b.Property<string>("ParentMangaId")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(64)
|
|
||||||
.HasColumnType("character varying(64)");
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
b.Property<string>("Title")
|
b.Property<string>("Title")
|
||||||
@ -72,8 +69,8 @@ namespace API.Migrations
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<float?>("VolumeNumber")
|
b.Property<int?>("VolumeNumber")
|
||||||
.HasColumnType("real");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.HasKey("ChapterId");
|
b.HasKey("ChapterId");
|
||||||
|
|
||||||
@ -88,7 +85,7 @@ namespace API.Migrations
|
|||||||
.HasMaxLength(64)
|
.HasMaxLength(64)
|
||||||
.HasColumnType("character varying(64)");
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
b.PrimitiveCollection<string[]>("DependsOnJobIds")
|
b.PrimitiveCollection<string[]>("DependsOnJobsIds")
|
||||||
.HasMaxLength(64)
|
.HasMaxLength(64)
|
||||||
.HasColumnType("text[]");
|
.HasColumnType("text[]");
|
||||||
|
|
||||||
@ -101,9 +98,6 @@ namespace API.Migrations
|
|||||||
b.Property<DateTime>("LastExecution")
|
b.Property<DateTime>("LastExecution")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<DateTime>("NextExecution")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("ParentJobId")
|
b.Property<string>("ParentJobId")
|
||||||
.HasMaxLength(64)
|
.HasMaxLength(64)
|
||||||
.HasColumnType("character varying(64)");
|
.HasColumnType("character varying(64)");
|
||||||
@ -111,13 +105,15 @@ namespace API.Migrations
|
|||||||
b.Property<decimal>("RecurrenceMs")
|
b.Property<decimal>("RecurrenceMs")
|
||||||
.HasColumnType("numeric(20,0)");
|
.HasColumnType("numeric(20,0)");
|
||||||
|
|
||||||
b.Property<int>("state")
|
b.Property<byte>("state")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
b.HasKey("JobId");
|
b.HasKey("JobId");
|
||||||
|
|
||||||
b.HasIndex("JobId1");
|
b.HasIndex("JobId1");
|
||||||
|
|
||||||
|
b.HasIndex("ParentJobId");
|
||||||
|
|
||||||
b.ToTable("Jobs");
|
b.ToTable("Jobs");
|
||||||
|
|
||||||
b.HasDiscriminator<byte>("JobType");
|
b.HasDiscriminator<byte>("JobType");
|
||||||
@ -157,9 +153,6 @@ namespace API.Migrations
|
|||||||
.HasMaxLength(64)
|
.HasMaxLength(64)
|
||||||
.HasColumnType("character varying(64)");
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
b.Property<string>("LinkIds")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("LinkProvider")
|
b.Property<string>("LinkProvider")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
@ -169,7 +162,6 @@ namespace API.Migrations
|
|||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("MangaId")
|
b.Property<string>("MangaId")
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("character varying(64)");
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
b.HasKey("LinkId");
|
b.HasKey("LinkId");
|
||||||
@ -185,14 +177,6 @@ namespace API.Migrations
|
|||||||
.HasMaxLength(64)
|
.HasMaxLength(64)
|
||||||
.HasColumnType("character varying(64)");
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
b.PrimitiveCollection<string[]>("AltTitleIds")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text[]");
|
|
||||||
|
|
||||||
b.PrimitiveCollection<string[]>("AuthorIds")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text[]");
|
|
||||||
|
|
||||||
b.Property<string>("ConnectorId")
|
b.Property<string>("ConnectorId")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(64)
|
.HasMaxLength(64)
|
||||||
@ -216,24 +200,10 @@ namespace API.Migrations
|
|||||||
b.Property<float>("IgnoreChapterBefore")
|
b.Property<float>("IgnoreChapterBefore")
|
||||||
.HasColumnType("real");
|
.HasColumnType("real");
|
||||||
|
|
||||||
b.Property<string>("LatestChapterAvailableId")
|
b.Property<string>("MangaConnectorId")
|
||||||
.HasColumnType("character varying(64)");
|
|
||||||
|
|
||||||
b.Property<string>("LatestChapterDownloadedId")
|
|
||||||
.HasColumnType("character varying(64)");
|
|
||||||
|
|
||||||
b.PrimitiveCollection<string[]>("LinkIds")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text[]");
|
|
||||||
|
|
||||||
b.Property<string>("MangaConnectorName")
|
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("character varying(32)");
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
b.Property<string>("MangaIds")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
@ -244,22 +214,16 @@ namespace API.Migrations
|
|||||||
b.Property<byte>("ReleaseStatus")
|
b.Property<byte>("ReleaseStatus")
|
||||||
.HasColumnType("smallint");
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
b.PrimitiveCollection<string[]>("TagIds")
|
b.Property<string>("WebsiteUrl")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text[]");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<long>("year")
|
b.Property<long>("Year")
|
||||||
.HasColumnType("bigint");
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.HasKey("MangaId");
|
b.HasKey("MangaId");
|
||||||
|
|
||||||
b.HasIndex("LatestChapterAvailableId")
|
b.HasIndex("MangaConnectorId");
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.HasIndex("LatestChapterDownloadedId")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.HasIndex("MangaConnectorName");
|
|
||||||
|
|
||||||
b.ToTable("Manga");
|
b.ToTable("Manga");
|
||||||
});
|
});
|
||||||
@ -270,16 +234,12 @@ namespace API.Migrations
|
|||||||
.HasMaxLength(64)
|
.HasMaxLength(64)
|
||||||
.HasColumnType("character varying(64)");
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
b.Property<string>("AltTitleIds")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Language")
|
b.Property<string>("Language")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(8)
|
.HasMaxLength(8)
|
||||||
.HasColumnType("character varying(8)");
|
.HasColumnType("character varying(8)");
|
||||||
|
|
||||||
b.Property<string>("MangaId")
|
b.Property<string>("MangaId")
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("character varying(64)");
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
b.Property<string>("Title")
|
b.Property<string>("Title")
|
||||||
@ -293,7 +253,7 @@ namespace API.Migrations
|
|||||||
b.ToTable("AltTitles");
|
b.ToTable("AltTitles");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.MangaConnector", b =>
|
modelBuilder.Entity("API.Schema.MangaConnectors.MangaConnector", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.HasMaxLength(32)
|
.HasMaxLength(32)
|
||||||
@ -310,6 +270,10 @@ namespace API.Migrations
|
|||||||
b.HasKey("Name");
|
b.HasKey("Name");
|
||||||
|
|
||||||
b.ToTable("MangaConnectors");
|
b.ToTable("MangaConnectors");
|
||||||
|
|
||||||
|
b.HasDiscriminator<string>("Name").HasValue("MangaConnector");
|
||||||
|
|
||||||
|
b.UseTphMappingStrategy();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.MangaTag", b =>
|
modelBuilder.Entity("API.Schema.MangaTag", b =>
|
||||||
@ -322,6 +286,31 @@ namespace API.Migrations
|
|||||||
b.ToTable("Tags");
|
b.ToTable("Tags");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Notification", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("NotificationId")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Date")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Message")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<byte>("Urgency")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("NotificationId");
|
||||||
|
|
||||||
|
b.ToTable("Notifications");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.NotificationConnectors.NotificationConnector", b =>
|
modelBuilder.Entity("API.Schema.NotificationConnectors.NotificationConnector", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("NotificationConnectorId")
|
b.Property<string>("NotificationConnectorId")
|
||||||
@ -340,101 +329,34 @@ namespace API.Migrations
|
|||||||
b.UseTphMappingStrategy();
|
b.UseTphMappingStrategy();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("MangaAuthor", b =>
|
modelBuilder.Entity("AuthorManga", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("AuthorsAuthorId")
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("MangaId")
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.HasKey("AuthorsAuthorId", "MangaId");
|
||||||
|
|
||||||
|
b.HasIndex("MangaId");
|
||||||
|
|
||||||
|
b.ToTable("AuthorManga");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("MangaMangaTag", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("MangaId")
|
b.Property<string>("MangaId")
|
||||||
.HasColumnType("character varying(64)");
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
b.Property<string>("AuthorId")
|
b.Property<string>("TagsTag")
|
||||||
.HasColumnType("character varying(64)");
|
|
||||||
|
|
||||||
b.Property<string>("AuthorIds")
|
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("MangaIds")
|
b.HasKey("MangaId", "TagsTag");
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("MangaId", "AuthorId");
|
b.HasIndex("TagsTag");
|
||||||
|
|
||||||
b.HasIndex("AuthorId");
|
b.ToTable("MangaMangaTag");
|
||||||
|
|
||||||
b.ToTable("MangaAuthor");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("MangaTag", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("MangaId")
|
|
||||||
.HasColumnType("character varying(64)");
|
|
||||||
|
|
||||||
b.Property<string>("Tag")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("MangaIds")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("TagIds")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("MangaId", "Tag");
|
|
||||||
|
|
||||||
b.HasIndex("MangaIds");
|
|
||||||
|
|
||||||
b.HasIndex("Tag");
|
|
||||||
|
|
||||||
b.ToTable("MangaTag");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.Jobs.CreateArchiveJob", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("API.Schema.Jobs.Job");
|
|
||||||
|
|
||||||
b.Property<string>("ChapterId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(64)
|
|
||||||
.HasColumnType("character varying(64)");
|
|
||||||
|
|
||||||
b.Property<string>("ComicInfoLocation")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ImagesLocation")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasIndex("ChapterId");
|
|
||||||
|
|
||||||
b.ToTable("Jobs", t =>
|
|
||||||
{
|
|
||||||
t.Property("ChapterId")
|
|
||||||
.HasColumnName("CreateArchiveJob_ChapterId");
|
|
||||||
});
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue((byte)4);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.Jobs.CreateComicInfoXmlJob", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("API.Schema.Jobs.Job");
|
|
||||||
|
|
||||||
b.Property<string>("ChapterId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(64)
|
|
||||||
.HasColumnType("character varying(64)");
|
|
||||||
|
|
||||||
b.Property<string>("Path")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasIndex("ChapterId");
|
|
||||||
|
|
||||||
b.ToTable("Jobs", t =>
|
|
||||||
{
|
|
||||||
t.Property("ChapterId")
|
|
||||||
.HasColumnName("CreateComicInfoXmlJob_ChapterId");
|
|
||||||
});
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue((byte)6);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.Jobs.DownloadNewChaptersJob", b =>
|
modelBuilder.Entity("API.Schema.Jobs.DownloadNewChaptersJob", b =>
|
||||||
@ -480,44 +402,6 @@ namespace API.Migrations
|
|||||||
b.HasDiscriminator().HasValue((byte)3);
|
b.HasDiscriminator().HasValue((byte)3);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.Jobs.ProcessImagesJob", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("API.Schema.Jobs.Job");
|
|
||||||
|
|
||||||
b.Property<bool>("Bw")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<int>("Compression")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Path")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.ToTable("Jobs", t =>
|
|
||||||
{
|
|
||||||
t.Property("Path")
|
|
||||||
.HasColumnName("ProcessImagesJob_Path");
|
|
||||||
});
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue((byte)5);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.Jobs.SearchMangaJob", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("API.Schema.Jobs.Job");
|
|
||||||
|
|
||||||
b.Property<string>("MangaConnectorName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("SearchString")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue((byte)7);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.Jobs.UpdateMetadataJob", b =>
|
modelBuilder.Entity("API.Schema.Jobs.UpdateMetadataJob", b =>
|
||||||
{
|
{
|
||||||
b.HasBaseType("API.Schema.Jobs.Job");
|
b.HasBaseType("API.Schema.Jobs.Job");
|
||||||
@ -552,6 +436,62 @@ namespace API.Migrations
|
|||||||
b.HasDiscriminator().HasValue((byte)0);
|
b.HasDiscriminator().HasValue((byte)0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.AsuraToon", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("AsuraToon");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.Bato", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Bato");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.MangaDex", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("MangaDex");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.MangaHere", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("MangaHere");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.MangaKatana", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("MangaKatana");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.Mangaworld", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Mangaworld");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.ManhuaPlus", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("ManhuaPlus");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.Weebcentral", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Weebcentral");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.NotificationConnectors.Gotify", b =>
|
modelBuilder.Entity("API.Schema.NotificationConnectors.Gotify", b =>
|
||||||
{
|
{
|
||||||
b.HasBaseType("API.Schema.NotificationConnectors.NotificationConnector");
|
b.HasBaseType("API.Schema.NotificationConnectors.NotificationConnector");
|
||||||
@ -606,7 +546,7 @@ namespace API.Migrations
|
|||||||
modelBuilder.Entity("API.Schema.Chapter", b =>
|
modelBuilder.Entity("API.Schema.Chapter", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("API.Schema.Manga", "ParentManga")
|
b.HasOne("API.Schema.Manga", "ParentManga")
|
||||||
.WithMany("Chapters")
|
.WithMany()
|
||||||
.HasForeignKey("ParentMangaId")
|
.HasForeignKey("ParentMangaId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
@ -619,58 +559,44 @@ namespace API.Migrations
|
|||||||
b.HasOne("API.Schema.Jobs.Job", null)
|
b.HasOne("API.Schema.Jobs.Job", null)
|
||||||
.WithMany("DependsOnJobs")
|
.WithMany("DependsOnJobs")
|
||||||
.HasForeignKey("JobId1");
|
.HasForeignKey("JobId1");
|
||||||
|
|
||||||
|
b.HasOne("API.Schema.Jobs.Job", "ParentJob")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ParentJobId");
|
||||||
|
|
||||||
|
b.Navigation("ParentJob");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.Link", b =>
|
modelBuilder.Entity("API.Schema.Link", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("API.Schema.Manga", "Manga")
|
b.HasOne("API.Schema.Manga", null)
|
||||||
.WithMany("Links")
|
.WithMany("Links")
|
||||||
.HasForeignKey("MangaId")
|
.HasForeignKey("MangaId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Manga");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.Manga", b =>
|
modelBuilder.Entity("API.Schema.Manga", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("API.Schema.Chapter", "LatestChapterAvailable")
|
b.HasOne("API.Schema.MangaConnectors.MangaConnector", "MangaConnector")
|
||||||
.WithOne()
|
.WithMany()
|
||||||
.HasForeignKey("API.Schema.Manga", "LatestChapterAvailableId");
|
.HasForeignKey("MangaConnectorId")
|
||||||
|
|
||||||
b.HasOne("API.Schema.Chapter", "LatestChapterDownloaded")
|
|
||||||
.WithOne()
|
|
||||||
.HasForeignKey("API.Schema.Manga", "LatestChapterDownloadedId");
|
|
||||||
|
|
||||||
b.HasOne("API.Schema.MangaConnector", "MangaConnector")
|
|
||||||
.WithMany("Mangas")
|
|
||||||
.HasForeignKey("MangaConnectorName")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("LatestChapterAvailable");
|
|
||||||
|
|
||||||
b.Navigation("LatestChapterDownloaded");
|
|
||||||
|
|
||||||
b.Navigation("MangaConnector");
|
b.Navigation("MangaConnector");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.MangaAltTitle", b =>
|
modelBuilder.Entity("API.Schema.MangaAltTitle", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("API.Schema.Manga", "Manga")
|
b.HasOne("API.Schema.Manga", null)
|
||||||
.WithMany("AltTitles")
|
.WithMany("AltTitles")
|
||||||
.HasForeignKey("MangaId")
|
.HasForeignKey("MangaId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Manga");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("MangaAuthor", b =>
|
modelBuilder.Entity("AuthorManga", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("API.Schema.Author", null)
|
b.HasOne("API.Schema.Author", null)
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("AuthorId")
|
.HasForeignKey("AuthorsAuthorId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
@ -681,7 +607,7 @@ namespace API.Migrations
|
|||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("MangaTag", b =>
|
modelBuilder.Entity("MangaMangaTag", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("API.Schema.Manga", null)
|
b.HasOne("API.Schema.Manga", null)
|
||||||
.WithMany()
|
.WithMany()
|
||||||
@ -691,37 +617,9 @@ namespace API.Migrations
|
|||||||
|
|
||||||
b.HasOne("API.Schema.MangaTag", null)
|
b.HasOne("API.Schema.MangaTag", null)
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("MangaIds")
|
.HasForeignKey("TagsTag")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("API.Schema.MangaTag", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("Tag")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.Jobs.CreateArchiveJob", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("API.Schema.Chapter", "Chapter")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ChapterId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Chapter");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.Jobs.CreateComicInfoXmlJob", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("API.Schema.Chapter", "Chapter")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ChapterId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Chapter");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.Jobs.DownloadNewChaptersJob", b =>
|
modelBuilder.Entity("API.Schema.Jobs.DownloadNewChaptersJob", b =>
|
||||||
@ -766,15 +664,8 @@ namespace API.Migrations
|
|||||||
{
|
{
|
||||||
b.Navigation("AltTitles");
|
b.Navigation("AltTitles");
|
||||||
|
|
||||||
b.Navigation("Chapters");
|
|
||||||
|
|
||||||
b.Navigation("Links");
|
b.Navigation("Links");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.MangaConnector", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Mangas");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
34
API/Migrations/20250303145324_dev-030325-2.cs
Normal file
34
API/Migrations/20250303145324_dev-030325-2.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace API.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class dev0303252 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<byte>(
|
||||||
|
name: "state",
|
||||||
|
table: "Jobs",
|
||||||
|
type: "smallint",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "integer");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "state",
|
||||||
|
table: "Jobs",
|
||||||
|
type: "integer",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(byte),
|
||||||
|
oldType: "smallint");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
672
API/Migrations/20250303152212_dev-030325-3.Designer.cs
generated
Normal file
672
API/Migrations/20250303152212_dev-030325-3.Designer.cs
generated
Normal file
@ -0,0 +1,672 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using API.Schema;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace API.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(PgsqlContext))]
|
||||||
|
[Migration("20250303152212_dev-030325-3")]
|
||||||
|
partial class dev0303253
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "9.0.0")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Author", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("AuthorId")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("AuthorName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("AuthorId");
|
||||||
|
|
||||||
|
b.ToTable("Authors");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Chapter", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("ChapterId")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("ArchiveFileName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ChapterNumber")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(10)
|
||||||
|
.HasColumnType("character varying(10)");
|
||||||
|
|
||||||
|
b.Property<bool>("Downloaded")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<string>("ParentMangaId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Url")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("VolumeNumber")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("ChapterId");
|
||||||
|
|
||||||
|
b.HasIndex("ParentMangaId");
|
||||||
|
|
||||||
|
b.ToTable("Chapters");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Jobs.Job", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("JobId")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.PrimitiveCollection<string[]>("DependsOnJobsIds")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("text[]");
|
||||||
|
|
||||||
|
b.Property<string>("JobId1")
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<byte>("JobType")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastExecution")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("ParentJobId")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<decimal>("RecurrenceMs")
|
||||||
|
.HasColumnType("numeric(20,0)");
|
||||||
|
|
||||||
|
b.Property<byte>("state")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("JobId");
|
||||||
|
|
||||||
|
b.HasIndex("JobId1");
|
||||||
|
|
||||||
|
b.HasIndex("ParentJobId");
|
||||||
|
|
||||||
|
b.ToTable("Jobs");
|
||||||
|
|
||||||
|
b.HasDiscriminator<byte>("JobType");
|
||||||
|
|
||||||
|
b.UseTphMappingStrategy();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.LibraryConnectors.LibraryConnector", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("LibraryConnectorId")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Auth")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("BaseUrl")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<byte>("LibraryType")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("LibraryConnectorId");
|
||||||
|
|
||||||
|
b.ToTable("LibraryConnectors");
|
||||||
|
|
||||||
|
b.HasDiscriminator<byte>("LibraryType");
|
||||||
|
|
||||||
|
b.UseTphMappingStrategy();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Link", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("LinkId")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("LinkProvider")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("LinkUrl")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("MangaId")
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.HasKey("LinkId");
|
||||||
|
|
||||||
|
b.HasIndex("MangaId");
|
||||||
|
|
||||||
|
b.ToTable("Link");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Manga", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("MangaId")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("ConnectorId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("CoverFileNameInCache")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("CoverUrl")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("FolderName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<float>("IgnoreChapterBefore")
|
||||||
|
.HasColumnType("real");
|
||||||
|
|
||||||
|
b.Property<string>("MangaConnectorId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("OriginalLanguage")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<byte>("ReleaseStatus")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.Property<string>("WebsiteUrl")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<long>("Year")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.HasKey("MangaId");
|
||||||
|
|
||||||
|
b.HasIndex("MangaConnectorId");
|
||||||
|
|
||||||
|
b.ToTable("Manga");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaAltTitle", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("AltTitleId")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Language")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(8)
|
||||||
|
.HasColumnType("character varying(8)");
|
||||||
|
|
||||||
|
b.Property<string>("MangaId")
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("AltTitleId");
|
||||||
|
|
||||||
|
b.HasIndex("MangaId");
|
||||||
|
|
||||||
|
b.ToTable("AltTitles");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.MangaConnector", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.PrimitiveCollection<string[]>("BaseUris")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text[]");
|
||||||
|
|
||||||
|
b.PrimitiveCollection<string[]>("SupportedLanguages")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text[]");
|
||||||
|
|
||||||
|
b.HasKey("Name");
|
||||||
|
|
||||||
|
b.ToTable("MangaConnectors");
|
||||||
|
|
||||||
|
b.HasDiscriminator<string>("Name").HasValue("MangaConnector");
|
||||||
|
|
||||||
|
b.UseTphMappingStrategy();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaTag", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Tag")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Tag");
|
||||||
|
|
||||||
|
b.ToTable("Tags");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Notification", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("NotificationId")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Date")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Message")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<byte>("Urgency")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("NotificationId");
|
||||||
|
|
||||||
|
b.ToTable("Notifications");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.NotificationConnectors.NotificationConnector", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("NotificationConnectorId")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<byte>("NotificationConnectorType")
|
||||||
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
|
b.HasKey("NotificationConnectorId");
|
||||||
|
|
||||||
|
b.ToTable("NotificationConnectors");
|
||||||
|
|
||||||
|
b.HasDiscriminator<byte>("NotificationConnectorType");
|
||||||
|
|
||||||
|
b.UseTphMappingStrategy();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("AuthorManga", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("AuthorsAuthorId")
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("MangaId")
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.HasKey("AuthorsAuthorId", "MangaId");
|
||||||
|
|
||||||
|
b.HasIndex("MangaId");
|
||||||
|
|
||||||
|
b.ToTable("AuthorManga");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("MangaMangaTag", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("MangaId")
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("TagsTag")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("MangaId", "TagsTag");
|
||||||
|
|
||||||
|
b.HasIndex("TagsTag");
|
||||||
|
|
||||||
|
b.ToTable("MangaMangaTag");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Jobs.DownloadNewChaptersJob", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.Jobs.Job");
|
||||||
|
|
||||||
|
b.Property<string>("MangaId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.HasIndex("MangaId");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue((byte)1);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Jobs.DownloadSingleChapterJob", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.Jobs.Job");
|
||||||
|
|
||||||
|
b.Property<string>("ChapterId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.HasIndex("ChapterId");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue((byte)0);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Jobs.MoveFileOrFolderJob", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.Jobs.Job");
|
||||||
|
|
||||||
|
b.Property<string>("FromLocation")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ToLocation")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue((byte)3);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Jobs.UpdateMetadataJob", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.Jobs.Job");
|
||||||
|
|
||||||
|
b.Property<string>("MangaId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.HasIndex("MangaId");
|
||||||
|
|
||||||
|
b.ToTable("Jobs", t =>
|
||||||
|
{
|
||||||
|
t.Property("MangaId")
|
||||||
|
.HasColumnName("UpdateMetadataJob_MangaId");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue((byte)2);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.LibraryConnectors.Kavita", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.LibraryConnectors.LibraryConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue((byte)1);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.LibraryConnectors.Komga", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.LibraryConnectors.LibraryConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue((byte)0);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.AsuraToon", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("AsuraToon");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.Bato", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Bato");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.MangaDex", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("MangaDex");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.MangaHere", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("MangaHere");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.MangaKatana", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("MangaKatana");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.Mangaworld", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Mangaworld");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.ManhuaPlus", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("ManhuaPlus");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaConnectors.Weebcentral", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Weebcentral");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.NotificationConnectors.Gotify", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.NotificationConnectors.NotificationConnector");
|
||||||
|
|
||||||
|
b.Property<string>("AppToken")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Endpoint")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue((byte)0);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.NotificationConnectors.Lunasea", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.NotificationConnectors.NotificationConnector");
|
||||||
|
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue((byte)1);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.NotificationConnectors.Ntfy", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("API.Schema.NotificationConnectors.NotificationConnector");
|
||||||
|
|
||||||
|
b.Property<string>("Auth")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Endpoint")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Topic")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.ToTable("NotificationConnectors", t =>
|
||||||
|
{
|
||||||
|
t.Property("Endpoint")
|
||||||
|
.HasColumnName("Ntfy_Endpoint");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue((byte)2);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Chapter", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("API.Schema.Manga", "ParentManga")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ParentMangaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("ParentManga");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Jobs.Job", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("API.Schema.Jobs.Job", null)
|
||||||
|
.WithMany("DependsOnJobs")
|
||||||
|
.HasForeignKey("JobId1");
|
||||||
|
|
||||||
|
b.HasOne("API.Schema.Jobs.Job", "ParentJob")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ParentJobId");
|
||||||
|
|
||||||
|
b.Navigation("ParentJob");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Link", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("API.Schema.Manga", null)
|
||||||
|
.WithMany("Links")
|
||||||
|
.HasForeignKey("MangaId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Manga", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("API.Schema.MangaConnectors.MangaConnector", "MangaConnector")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("MangaConnectorId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("MangaConnector");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.MangaAltTitle", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("API.Schema.Manga", null)
|
||||||
|
.WithMany("AltTitles")
|
||||||
|
.HasForeignKey("MangaId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("AuthorManga", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("API.Schema.Author", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("AuthorsAuthorId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("API.Schema.Manga", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("MangaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("MangaMangaTag", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("API.Schema.Manga", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("MangaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("API.Schema.MangaTag", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("TagsTag")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Jobs.DownloadNewChaptersJob", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("API.Schema.Manga", "Manga")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("MangaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Manga");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Jobs.DownloadSingleChapterJob", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("API.Schema.Chapter", "Chapter")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ChapterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Chapter");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Jobs.UpdateMetadataJob", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("API.Schema.Manga", "Manga")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("MangaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Manga");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Jobs.Job", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("DependsOnJobs");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("API.Schema.Manga", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("AltTitles");
|
||||||
|
|
||||||
|
b.Navigation("Links");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
API/Migrations/20250303152212_dev-030325-3.cs
Normal file
22
API/Migrations/20250303152212_dev-030325-3.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace API.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class dev0303253 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -102,8 +102,8 @@ namespace API.Migrations
|
|||||||
b.Property<decimal>("RecurrenceMs")
|
b.Property<decimal>("RecurrenceMs")
|
||||||
.HasColumnType("numeric(20,0)");
|
.HasColumnType("numeric(20,0)");
|
||||||
|
|
||||||
b.Property<int>("state")
|
b.Property<byte>("state")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("smallint");
|
||||||
|
|
||||||
b.HasKey("JobId");
|
b.HasKey("JobId");
|
||||||
|
|
||||||
@ -468,27 +468,6 @@ namespace API.Migrations
|
|||||||
b.HasDiscriminator().HasValue("MangaKatana");
|
b.HasDiscriminator().HasValue("MangaKatana");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.MangaConnectors.MangaLife", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("Manga4Life");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.MangaConnectors.Manganato", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("Manganato");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.MangaConnectors.Mangasee", b =>
|
|
||||||
{
|
|
||||||
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("Mangasee");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("API.Schema.MangaConnectors.Mangaworld", b =>
|
modelBuilder.Entity("API.Schema.MangaConnectors.Mangaworld", b =>
|
||||||
{
|
{
|
||||||
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
b.HasBaseType("API.Schema.MangaConnectors.MangaConnector");
|
||||||
|
@ -104,7 +104,6 @@ using (var scope = app.Services.CreateScope())
|
|||||||
new MangaDex(),
|
new MangaDex(),
|
||||||
new MangaHere(),
|
new MangaHere(),
|
||||||
new MangaKatana(),
|
new MangaKatana(),
|
||||||
new Manganato(),
|
|
||||||
new Mangaworld(),
|
new Mangaworld(),
|
||||||
new ManhuaPlus(),
|
new ManhuaPlus(),
|
||||||
new Weebcentral()
|
new Weebcentral()
|
||||||
|
@ -49,8 +49,10 @@ public abstract class Job
|
|||||||
PgsqlContext context = scope.ServiceProvider.GetRequiredService<PgsqlContext>();
|
PgsqlContext context = scope.ServiceProvider.GetRequiredService<PgsqlContext>();
|
||||||
|
|
||||||
this.state = JobState.Running;
|
this.state = JobState.Running;
|
||||||
|
context.SaveChanges();
|
||||||
IEnumerable<Job> newJobs = RunInternal(context);
|
IEnumerable<Job> newJobs = RunInternal(context);
|
||||||
this.state = JobState.Completed;
|
this.state = JobState.Completed;
|
||||||
|
context.SaveChanges();
|
||||||
return newJobs;
|
return newJobs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
namespace API.Schema.Jobs;
|
namespace API.Schema.Jobs;
|
||||||
|
|
||||||
public enum JobState
|
public enum JobState : byte
|
||||||
{
|
{
|
||||||
Waiting,
|
//Values 0-63 Preparation Stages
|
||||||
Running,
|
Waiting = 0,
|
||||||
Completed
|
//64-127 Running Stages
|
||||||
|
Running = 64,
|
||||||
|
//128-191 Completion Stages
|
||||||
|
Completed = 128,
|
||||||
|
//192-255 Error stages
|
||||||
|
Failed = 192
|
||||||
}
|
}
|
@ -256,8 +256,11 @@ public class MangaDex : MangaConnector
|
|||||||
|
|
||||||
internal override string[] GetChapterImageUrls(Chapter chapter)
|
internal override string[] GetChapterImageUrls(Chapter chapter)
|
||||||
{//Request URLs for Chapter-Images
|
{//Request URLs for Chapter-Images
|
||||||
|
Match m = Regex.Match(chapter.Url, @"https?:\/\/mangadex.org\/chapter\/([0-9\-a-z]+)");
|
||||||
|
if (!m.Success)
|
||||||
|
return [];
|
||||||
RequestResult requestResult =
|
RequestResult requestResult =
|
||||||
downloadClient.MakeRequest($"https://api.mangadex.org/at-home/server/{chapter.ChapterId}?forcePort443=false", RequestType.MangaDexImage);
|
downloadClient.MakeRequest($"https://api.mangadex.org/at-home/server/{m.Groups[1].Value}?forcePort443=false", RequestType.MangaDexImage);
|
||||||
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300)
|
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300)
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
|
@ -1,224 +0,0 @@
|
|||||||
using System.Globalization;
|
|
||||||
using System.Net;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using API.MangaDownloadClients;
|
|
||||||
using HtmlAgilityPack;
|
|
||||||
|
|
||||||
namespace API.Schema.MangaConnectors;
|
|
||||||
|
|
||||||
public class Manganato : MangaConnector
|
|
||||||
{
|
|
||||||
public Manganato() : base("Manganato", ["en"], ["manganato.com"])
|
|
||||||
{
|
|
||||||
this.downloadClient = new HttpDownloadClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)[] GetManga(string publicationTitle = "")
|
|
||||||
{
|
|
||||||
string sanitizedTitle = string.Join('_', Regex.Matches(publicationTitle, "[A-z]*").Where(str => str.Length > 0)).ToLower();
|
|
||||||
string requestUrl = $"https://manganato.com/search/story/{sanitizedTitle}";
|
|
||||||
RequestResult requestResult =
|
|
||||||
downloadClient.MakeRequest(requestUrl, RequestType.Default);
|
|
||||||
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300 ||requestResult.htmlDocument is null)
|
|
||||||
return [];
|
|
||||||
(Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)[] publications = ParsePublicationsFromHtml(requestResult.htmlDocument);
|
|
||||||
return publications;
|
|
||||||
}
|
|
||||||
|
|
||||||
private (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)[] ParsePublicationsFromHtml(HtmlDocument document)
|
|
||||||
{
|
|
||||||
List<HtmlNode> searchResults = document.DocumentNode.Descendants("div").Where(n => n.HasClass("search-story-item")).ToList();
|
|
||||||
List<string> urls = new();
|
|
||||||
foreach (HtmlNode mangaResult in searchResults)
|
|
||||||
{
|
|
||||||
urls.Add(mangaResult.Descendants("a").First(n => n.HasClass("item-title")).GetAttributes()
|
|
||||||
.First(a => a.Name == "href").Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<(Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)> ret = new();
|
|
||||||
foreach (string url in urls)
|
|
||||||
{
|
|
||||||
(Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)? manga = GetMangaFromUrl(url);
|
|
||||||
if (manga is { } x)
|
|
||||||
ret.Add(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)? GetMangaFromId(string publicationId)
|
|
||||||
{
|
|
||||||
return GetMangaFromUrl($"https://chapmanganato.com/{publicationId}");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)? GetMangaFromUrl(string url)
|
|
||||||
{
|
|
||||||
RequestResult requestResult =
|
|
||||||
downloadClient.MakeRequest(url, RequestType.MangaInfo);
|
|
||||||
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (requestResult.htmlDocument is null)
|
|
||||||
return null;
|
|
||||||
return ParseSinglePublicationFromHtml(requestResult.htmlDocument, url.Split('/')[^1], url);
|
|
||||||
}
|
|
||||||
|
|
||||||
private (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?) ParseSinglePublicationFromHtml(HtmlDocument document, string publicationId, string websiteUrl)
|
|
||||||
{
|
|
||||||
Dictionary<string, string> altTitlesDict = new();
|
|
||||||
Dictionary<string, string>? links = null;
|
|
||||||
HashSet<string> tags = new();
|
|
||||||
string[] authorNames = [];
|
|
||||||
string originalLanguage = "";
|
|
||||||
MangaReleaseStatus releaseStatus = MangaReleaseStatus.Unreleased;
|
|
||||||
|
|
||||||
HtmlNode infoNode = document.DocumentNode.Descendants("div").First(d => d.HasClass("story-info-right"));
|
|
||||||
|
|
||||||
string sortName = infoNode.Descendants("h1").First().InnerText;
|
|
||||||
|
|
||||||
HtmlNode infoTable = infoNode.Descendants().First(d => d.Name == "table");
|
|
||||||
|
|
||||||
foreach (HtmlNode row in infoTable.Descendants("tr"))
|
|
||||||
{
|
|
||||||
string key = row.SelectNodes("td").First().InnerText.ToLower();
|
|
||||||
string value = row.SelectNodes("td").Last().InnerText;
|
|
||||||
string keySanitized = string.Concat(Regex.Matches(key, "[a-z]"));
|
|
||||||
|
|
||||||
switch (keySanitized)
|
|
||||||
{
|
|
||||||
case "alternative":
|
|
||||||
string[] alts = value.Split(" ; ");
|
|
||||||
for(int i = 0; i < alts.Length; i++)
|
|
||||||
altTitlesDict.Add(i.ToString(), alts[i]);
|
|
||||||
break;
|
|
||||||
case "authors":
|
|
||||||
authorNames = value.Split('-');
|
|
||||||
for (int i = 0; i < authorNames.Length; i++)
|
|
||||||
authorNames[i] = authorNames[i].Replace("\r\n", "");
|
|
||||||
break;
|
|
||||||
case "status":
|
|
||||||
switch (value.ToLower())
|
|
||||||
{
|
|
||||||
case "ongoing": releaseStatus = MangaReleaseStatus.Continuing; break;
|
|
||||||
case "completed": releaseStatus = MangaReleaseStatus.Completed; break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "genres":
|
|
||||||
string[] genres = value.Split(" - ");
|
|
||||||
for (int i = 0; i < genres.Length; i++)
|
|
||||||
genres[i] = genres[i].Replace("\r\n", "");
|
|
||||||
tags = genres.ToHashSet();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
List<Author> authors = authorNames.Select(n => new Author(n)).ToList();
|
|
||||||
List<MangaTag> mangaTags = tags.Select(n => new MangaTag(n)).ToList();
|
|
||||||
List<MangaAltTitle> mangaAltTitles = altTitlesDict.Select(a => new MangaAltTitle(a.Key, a.Value)).ToList();
|
|
||||||
|
|
||||||
string coverUrl = document.DocumentNode.Descendants("span").First(s => s.HasClass("info-image")).Descendants("img").First()
|
|
||||||
.GetAttributes().First(a => a.Name == "src").Value;
|
|
||||||
|
|
||||||
string description = document.DocumentNode.Descendants("div").First(d => d.HasClass("panel-story-info-description"))
|
|
||||||
.InnerText.Replace("Description :", "");
|
|
||||||
while (description.StartsWith('\n'))
|
|
||||||
description = description.Substring(1);
|
|
||||||
|
|
||||||
string pattern = "MMM dd,yyyy HH:mm";
|
|
||||||
|
|
||||||
HtmlNode? oldestChapter = document.DocumentNode
|
|
||||||
.SelectNodes("//span[contains(concat(' ',normalize-space(@class),' '),' chapter-time ')]").MaxBy(
|
|
||||||
node => DateTime.ParseExact(node.GetAttributeValue("title", "Dec 31 2400, 23:59"), pattern,
|
|
||||||
CultureInfo.InvariantCulture).Millisecond);
|
|
||||||
|
|
||||||
|
|
||||||
uint year = (uint)DateTime.ParseExact(oldestChapter?.GetAttributeValue("title", "Dec 31 2400, 23:59")??"Dec 31 2400, 23:59", pattern,
|
|
||||||
CultureInfo.InvariantCulture).Year;
|
|
||||||
|
|
||||||
Manga manga = new (publicationId, sortName, description, websiteUrl, coverUrl, null, year,
|
|
||||||
originalLanguage, releaseStatus, -1,
|
|
||||||
this,
|
|
||||||
authors,
|
|
||||||
mangaTags,
|
|
||||||
[],
|
|
||||||
mangaAltTitles);
|
|
||||||
|
|
||||||
return (manga, authors, mangaTags, [], mangaAltTitles);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Chapter[] GetChapters(Manga manga, string language="en")
|
|
||||||
{
|
|
||||||
string requestUrl = $"https://chapmanganato.com/{manga.MangaId}";
|
|
||||||
RequestResult requestResult =
|
|
||||||
downloadClient.MakeRequest(requestUrl, RequestType.Default);
|
|
||||||
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300)
|
|
||||||
return [];
|
|
||||||
|
|
||||||
//Return Chapters ordered by Chapter-Number
|
|
||||||
if (requestResult.htmlDocument is null)
|
|
||||||
return [];
|
|
||||||
List<Chapter> chapters = ParseChaptersFromHtml(manga, requestResult.htmlDocument);
|
|
||||||
return chapters.Order().ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<Chapter> ParseChaptersFromHtml(Manga manga, HtmlDocument document)
|
|
||||||
{
|
|
||||||
List<Chapter> ret = new();
|
|
||||||
|
|
||||||
HtmlNode chapterList = document.DocumentNode.Descendants("ul").First(l => l.HasClass("row-content-chapter"));
|
|
||||||
|
|
||||||
Regex volRex = new(@"Vol\.([0-9]+).*");
|
|
||||||
Regex chapterRex = new(@"https:\/\/chapmanganato.[A-z]+\/manga-[A-z0-9]+\/chapter-([0-9\.]+)");
|
|
||||||
Regex nameRex = new(@"Chapter ([0-9]+(\.[0-9]+)*){1}:? (.*)");
|
|
||||||
|
|
||||||
foreach (HtmlNode chapterInfo in chapterList.Descendants("li"))
|
|
||||||
{
|
|
||||||
string fullString = chapterInfo.Descendants("a").First(d => d.HasClass("chapter-name")).InnerText;
|
|
||||||
|
|
||||||
string url = chapterInfo.Descendants("a").First(d => d.HasClass("chapter-name"))
|
|
||||||
.GetAttributeValue("href", "");
|
|
||||||
|
|
||||||
int? volumeNumber = volRex.IsMatch(fullString)
|
|
||||||
? int.Parse(volRex.Match(fullString).Groups[1].Value)
|
|
||||||
: null;
|
|
||||||
string chapterNumber = new(chapterRex.Match(url).Groups[1].Value);
|
|
||||||
string chapterName = nameRex.Match(fullString).Groups[3].Value;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ret.Add(new Chapter(manga, url, chapterNumber, volumeNumber, chapterName));
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret.Reverse();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override string[] GetChapterImageUrls(Chapter chapter)
|
|
||||||
{
|
|
||||||
string requestUrl = chapter.Url;
|
|
||||||
RequestResult requestResult =
|
|
||||||
downloadClient.MakeRequest(requestUrl, RequestType.Default);
|
|
||||||
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300 ||
|
|
||||||
requestResult.htmlDocument is null)
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
string[] imageUrls = ParseImageUrlsFromHtml(requestResult.htmlDocument);
|
|
||||||
return imageUrls;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string[] ParseImageUrlsFromHtml(HtmlDocument document)
|
|
||||||
{
|
|
||||||
List<string> ret = new();
|
|
||||||
|
|
||||||
HtmlNode imageContainer =
|
|
||||||
document.DocumentNode.Descendants("div").First(i => i.HasClass("container-chapter-reader"));
|
|
||||||
foreach(HtmlNode imageNode in imageContainer.Descendants("img"))
|
|
||||||
ret.Add(imageNode.GetAttributeValue("src", ""));
|
|
||||||
|
|
||||||
return ret.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +1,12 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Net;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using API.MangaDownloadClients;
|
using API.MangaDownloadClients;
|
||||||
using HtmlAgilityPack;
|
using HtmlAgilityPack;
|
||||||
using Soenneker.Utils.String.NeedlemanWunsch;
|
|
||||||
|
|
||||||
namespace API.Schema.MangaConnectors;
|
namespace API.Schema.MangaConnectors;
|
||||||
|
|
||||||
public class Weebcentral : MangaConnector
|
public class Weebcentral : MangaConnector
|
||||||
{
|
{
|
||||||
private readonly string _baseUrl = "https://weebcentral.com";
|
|
||||||
|
|
||||||
private readonly string[] _filterWords =
|
private readonly string[] _filterWords =
|
||||||
{ "a", "the", "of", "as", "to", "no", "for", "on", "with", "be", "and", "in", "wa", "at", "be", "ni" };
|
{ "a", "the", "of", "as", "to", "no", "for", "on", "with", "be", "and", "in", "wa", "at", "be", "ni" };
|
||||||
|
|
||||||
@ -17,152 +15,108 @@ public class Weebcentral : MangaConnector
|
|||||||
downloadClient = new ChromiumDownloadClient();
|
downloadClient = new ChromiumDownloadClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)[] GetManga(
|
public override (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)[] GetManga(string publicationTitle = "")
|
||||||
string publicationTitle = "")
|
|
||||||
{
|
{
|
||||||
const int limit = 32; //How many values we want returned at once
|
const int limit = 32; //How many values we want returned at once
|
||||||
int offset = 0; //"Page"
|
var offset = 0; //"Page"
|
||||||
string requestUrl =
|
var requestUrl =
|
||||||
$"{_baseUrl}/search/data?limit={limit}&offset={offset}&text={publicationTitle}&sort=Best+Match&order=Ascending&official=Any&display_mode=Minimal%20Display";
|
$"{BaseUris[0]}/search/data?limit={limit}&offset={offset}&text={publicationTitle}&sort=Best+Match&order=Ascending&official=Any&display_mode=Minimal%20Display";
|
||||||
RequestResult requestResult =
|
var requestResult =
|
||||||
downloadClient.MakeRequest(requestUrl, RequestType.Default);
|
downloadClient.MakeRequest(requestUrl, RequestType.Default);
|
||||||
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300 ||
|
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300 ||
|
||||||
requestResult.htmlDocument == null)
|
requestResult.htmlDocument == null)
|
||||||
|
{
|
||||||
return [];
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
(Manga, List<Author>, List<MangaTag>, List<Link>, List<MangaAltTitle>)[] publications =
|
var publications = ParsePublicationsFromHtml(requestResult.htmlDocument);
|
||||||
ParsePublicationsFromHtml(requestResult.htmlDocument);
|
|
||||||
|
|
||||||
return publications;
|
return publications;
|
||||||
}
|
}
|
||||||
|
|
||||||
private (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)[] ParsePublicationsFromHtml(
|
private (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)[] ParsePublicationsFromHtml(HtmlDocument document)
|
||||||
HtmlDocument document)
|
|
||||||
{
|
{
|
||||||
if (document.DocumentNode.SelectNodes("//article") == null)
|
if (document.DocumentNode.SelectNodes("//article") == null)
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
List<string> urls = document.DocumentNode.SelectNodes("/html/body/article/a[@class='link link-hover']")
|
var urls = document.DocumentNode.SelectNodes("/html/body/article/a[@class='link link-hover']")
|
||||||
.Select(elem => elem.GetAttributeValue("href", "")).ToList();
|
.Select(elem => elem.GetAttributeValue("href", "")).ToList();
|
||||||
|
|
||||||
List<(Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)> ret = new();
|
List<(Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)> ret = new();
|
||||||
foreach (string url in urls)
|
foreach (var url in urls)
|
||||||
{
|
{
|
||||||
(Manga, List<Author>, List<MangaTag>, List<Link>, List<MangaAltTitle>)? manga = GetMangaFromUrl(url);
|
(Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)? manga = GetMangaFromUrl(url);
|
||||||
if (manga is { } x)
|
if (manga is { })
|
||||||
ret.Add(x);
|
ret.Add(((Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?))manga);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret.ToArray();
|
return ret.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)?
|
public override (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)? GetMangaFromUrl(string url)
|
||||||
GetMangaFromUrl(string url)
|
|
||||||
{
|
{
|
||||||
Regex publicationIdRex = new(@"https:\/\/weebcentral\.com\/series\/(\w*)\/(.*)");
|
Regex publicationIdRex = new(@"https:\/\/weebcentral\.com\/series\/(\w*)\/(.*)");
|
||||||
string publicationId = publicationIdRex.Match(url).Groups[1].Value;
|
var publicationId = publicationIdRex.Match(url).Groups[1].Value;
|
||||||
|
|
||||||
RequestResult requestResult = downloadClient.MakeRequest(url, RequestType.MangaInfo);
|
var requestResult = downloadClient.MakeRequest(url, RequestType.MangaInfo);
|
||||||
if ((int)requestResult.statusCode < 300 && (int)requestResult.statusCode >= 200 &&
|
if ((int)requestResult.statusCode < 300 && (int)requestResult.statusCode >= 200 &&
|
||||||
requestResult.htmlDocument is not null)
|
requestResult.htmlDocument is not null)
|
||||||
return ParseSinglePublicationFromHtml(requestResult.htmlDocument, publicationId, url);
|
return ParseSinglePublicationFromHtml(requestResult.htmlDocument, publicationId, url);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?) ParseSinglePublicationFromHtml(
|
private (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?) ParseSinglePublicationFromHtml(HtmlDocument document, string publicationId, string websiteUrl)
|
||||||
HtmlDocument document, string publicationId, string websiteUrl)
|
|
||||||
{
|
{
|
||||||
HtmlNode? posterNode =
|
HtmlNode posterNode =
|
||||||
document.DocumentNode.SelectSingleNode("//section[@class='flex items-center justify-center']/picture/img");
|
document.DocumentNode.SelectSingleNode("//section[@class='flex items-center justify-center']/picture/img");
|
||||||
string coverUrl = posterNode?.GetAttributeValue("src", "") ?? "";
|
string posterUrl = posterNode?.GetAttributeValue("src", "") ?? "";
|
||||||
|
|
||||||
HtmlNode? titleNode = document.DocumentNode.SelectSingleNode("//section/h1");
|
HtmlNode titleNode = document.DocumentNode.SelectSingleNode("//section/h1");
|
||||||
string sortName = titleNode?.InnerText ?? "Undefined";
|
string sortName = titleNode?.InnerText ?? "Undefined";
|
||||||
|
|
||||||
HtmlNode[] authorsNodes =
|
HtmlNode[] authorsNodes =
|
||||||
document.DocumentNode.SelectNodes("//ul/li[strong/text() = 'Author(s): ']/span")?.ToArray() ?? [];
|
document.DocumentNode.SelectNodes("//ul/li[strong/text() = 'Author(s): ']/span")?.ToArray() ?? [];
|
||||||
List<string> authorNames = authorsNodes.Select(n => n.InnerText).ToList();
|
List<Author> authors = authorsNodes.Select(n => new Author(n.InnerText)).ToList();
|
||||||
List<Author> authors = authorNames.Select(n => new Author(n)).ToList();
|
|
||||||
|
|
||||||
HtmlNode[] genreNodes =
|
HtmlNode[] genreNodes =
|
||||||
document.DocumentNode.SelectNodes("//ul/li[strong/text() = 'Tags(s): ']/span")?.ToArray() ?? [];
|
document.DocumentNode.SelectNodes("//ul/li[strong/text() = 'Tags(s): ']/span")?.ToArray() ?? [];
|
||||||
HashSet<string> tags = genreNodes.Select(n => n.InnerText).ToHashSet();
|
List<MangaTag> tags = genreNodes.Select(n => new MangaTag(n.InnerText)).ToList();
|
||||||
List<MangaTag> mangaTags = tags.Select(t => new MangaTag(t)).ToList();
|
|
||||||
|
|
||||||
HtmlNode? statusNode = document.DocumentNode.SelectSingleNode("//ul/li[strong/text() = 'Status: ']/a");
|
HtmlNode statusNode = document.DocumentNode.SelectSingleNode("//ul/li[strong/text() = 'Status: ']/a");
|
||||||
string status = statusNode?.InnerText ?? "";
|
string statusText = statusNode?.InnerText ?? "";
|
||||||
MangaReleaseStatus releaseStatus = MangaReleaseStatus.Unreleased;
|
MangaReleaseStatus releaseStatus = statusText.ToLower() switch
|
||||||
switch (status.ToLower())
|
|
||||||
{
|
{
|
||||||
case "cancelled": releaseStatus = MangaReleaseStatus.Cancelled; break;
|
"cancelled" => MangaReleaseStatus.Cancelled,
|
||||||
case "hiatus": releaseStatus = MangaReleaseStatus.OnHiatus; break;
|
"hiatus" => MangaReleaseStatus.OnHiatus,
|
||||||
case "complete": releaseStatus = MangaReleaseStatus.Completed; break;
|
"complete" => MangaReleaseStatus.Completed,
|
||||||
case "ongoing": releaseStatus = MangaReleaseStatus.Continuing; break;
|
"ongoing" => MangaReleaseStatus.Continuing,
|
||||||
}
|
_ => MangaReleaseStatus.Unreleased
|
||||||
|
};
|
||||||
|
|
||||||
HtmlNode? yearNode = document.DocumentNode.SelectSingleNode("//ul/li[strong/text() = 'Released: ']/span");
|
HtmlNode yearNode = document.DocumentNode.SelectSingleNode("//ul/li[strong/text() = 'Released: ']/span");
|
||||||
uint year = uint.Parse(yearNode?.InnerText ?? "0");
|
uint year = Convert.ToUInt32(yearNode?.InnerText ?? "0");
|
||||||
|
|
||||||
HtmlNode? descriptionNode = document.DocumentNode.SelectSingleNode("//ul/li[strong/text() = 'Description']/p");
|
HtmlNode descriptionNode = document.DocumentNode.SelectSingleNode("//ul/li[strong/text() = 'Description']/p");
|
||||||
string description = descriptionNode?.InnerText ?? "Undefined";
|
string description = descriptionNode?.InnerText ?? "Undefined";
|
||||||
|
|
||||||
HtmlNode[] altTitleNodes = document.DocumentNode
|
HtmlNode[] altTitleNodes = document.DocumentNode
|
||||||
.SelectNodes("//ul/li[strong/text() = 'Associated Name(s)']/ul/li")?.ToArray() ?? [];
|
.SelectNodes("//ul/li[strong/text() = 'Associated Name(s)']/ul/li")?.ToArray() ?? [];
|
||||||
Dictionary<string, string> altTitlesDict = new(), links = new();
|
List<MangaAltTitle> altTitles = altTitleNodes.Select(n => new MangaAltTitle("", n.InnerText)).ToList();
|
||||||
for (int i = 0; i < altTitleNodes.Length; i++)
|
|
||||||
altTitlesDict.Add(i.ToString(), altTitleNodes[i].InnerText);
|
|
||||||
List<MangaAltTitle> altTitles = altTitlesDict.Select(a => new MangaAltTitle(a.Key, a.Value)).ToList();
|
|
||||||
|
|
||||||
string originalLanguage = "";
|
Manga m = new(publicationId, sortName, description, websiteUrl, posterUrl, null, year, null, releaseStatus, -1,
|
||||||
|
this, authors, tags, [], altTitles);
|
||||||
Manga manga = new(publicationId, sortName, description, websiteUrl, coverUrl, null, year,
|
return (m, authors, tags, [], altTitles);
|
||||||
originalLanguage, releaseStatus, -1,
|
|
||||||
this,
|
|
||||||
authors,
|
|
||||||
mangaTags,
|
|
||||||
[],
|
|
||||||
altTitles);
|
|
||||||
|
|
||||||
return (manga, authors, mangaTags, [], altTitles);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)? GetMangaFromId(
|
public override (Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)? GetMangaFromId(string publicationId)
|
||||||
string publicationId)
|
|
||||||
{
|
{
|
||||||
return GetMangaFromUrl($"https://weebcentral.com/series/{publicationId}");
|
return GetMangaFromUrl($"https://weebcentral.com/series/{publicationId}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ToFilteredString(string input)
|
|
||||||
{
|
|
||||||
return string.Join(' ', input.ToLower().Split(' ').Where(word => _filterWords.Contains(word) == false));
|
|
||||||
}
|
|
||||||
|
|
||||||
private SearchResult[] FilteredResults(string publicationTitle, SearchResult[] unfilteredSearchResults)
|
|
||||||
{
|
|
||||||
Dictionary<SearchResult, int> similarity = new();
|
|
||||||
foreach (SearchResult sr in unfilteredSearchResults)
|
|
||||||
{
|
|
||||||
List<int> scores = new();
|
|
||||||
string filteredPublicationString = ToFilteredString(publicationTitle);
|
|
||||||
string filteredSString = ToFilteredString(sr.s);
|
|
||||||
scores.Add(NeedlemanWunschStringUtil.CalculateSimilarity(filteredSString, filteredPublicationString));
|
|
||||||
foreach (string srA in sr.a)
|
|
||||||
{
|
|
||||||
string filteredAString = ToFilteredString(srA);
|
|
||||||
scores.Add(NeedlemanWunschStringUtil.CalculateSimilarity(filteredAString, filteredPublicationString));
|
|
||||||
}
|
|
||||||
|
|
||||||
similarity.Add(sr, scores.Sum() / scores.Count);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<SearchResult> ret = similarity.OrderBy(s => s.Value).Take(10).Select(s => s.Key).ToList();
|
|
||||||
return ret.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Chapter[] GetChapters(Manga manga, string language = "en")
|
public override Chapter[] GetChapters(Manga manga, string language = "en")
|
||||||
{
|
{
|
||||||
string requestUrl = $"{_baseUrl}/series/{manga.ConnectorId}/full-chapter-list";
|
var requestUrl = $"{BaseUris[0]}/series/{manga.MangaConnectorId}/full-chapter-list";
|
||||||
RequestResult requestResult =
|
var requestResult =
|
||||||
downloadClient.MakeRequest(requestUrl, RequestType.Default);
|
downloadClient.MakeRequest(requestUrl, RequestType.Default);
|
||||||
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300)
|
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300)
|
||||||
return [];
|
return [];
|
||||||
@ -170,61 +124,52 @@ public class Weebcentral : MangaConnector
|
|||||||
//Return Chapters ordered by Chapter-Number
|
//Return Chapters ordered by Chapter-Number
|
||||||
if (requestResult.htmlDocument is null)
|
if (requestResult.htmlDocument is null)
|
||||||
return [];
|
return [];
|
||||||
List<Chapter> chapters = ParseChaptersFromHtml(manga, requestResult.htmlDocument);
|
var chapters = ParseChaptersFromHtml(manga, requestResult.htmlDocument);
|
||||||
return chapters.Order().ToArray();
|
return chapters.Order().ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Chapter> ParseChaptersFromHtml(Manga manga, HtmlDocument document)
|
|
||||||
{
|
|
||||||
HtmlNode? chaptersWrapper = document.DocumentNode.SelectSingleNode("/html/body");
|
|
||||||
|
|
||||||
Regex chapterRex = new(@"(\d+(?:\.\d+)*)");
|
|
||||||
Regex idRex = new(@"https:\/\/weebcentral\.com\/chapters\/(\w*)");
|
|
||||||
|
|
||||||
List<Chapter> ret = chaptersWrapper.Descendants("a").Select(elem =>
|
|
||||||
{
|
|
||||||
string url = elem.GetAttributeValue("href", "") ?? "Undefined";
|
|
||||||
|
|
||||||
if (!url.StartsWith("https://") && !url.StartsWith("http://"))
|
|
||||||
return new Chapter(manga, "undefined", "-1");
|
|
||||||
|
|
||||||
Match idMatch = idRex.Match(url);
|
|
||||||
string? id = idMatch.Success ? idMatch.Groups[1].Value : null;
|
|
||||||
|
|
||||||
string chapterNode = elem.SelectSingleNode("span[@class='grow flex items-center gap-2']/span")?.InnerText ??
|
|
||||||
"Undefined";
|
|
||||||
|
|
||||||
Match chapterNumberMatch = chapterRex.Match(chapterNode);
|
|
||||||
|
|
||||||
if (!chapterNumberMatch.Success)
|
|
||||||
return new Chapter(manga, "undefined", "-1");
|
|
||||||
|
|
||||||
string chapterNumber = chapterNumberMatch.Groups[1].Value;
|
|
||||||
return new Chapter(manga, url, chapterNumber);
|
|
||||||
}).Where(elem => elem.ChapterNumber.CompareTo("-1") != 0 && elem.Url != "undefined").ToList();
|
|
||||||
|
|
||||||
ret.Reverse();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override string[] GetChapterImageUrls(Chapter chapter)
|
internal override string[] GetChapterImageUrls(Chapter chapter)
|
||||||
{
|
{
|
||||||
RequestResult requestResult = downloadClient.MakeRequest(chapter.Url, RequestType.Default);
|
var requestResult = downloadClient.MakeRequest(chapter.Url, RequestType.Default);
|
||||||
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300 ||
|
if (requestResult.htmlDocument is null)
|
||||||
requestResult.htmlDocument is null) return [];
|
return [];
|
||||||
|
|
||||||
HtmlDocument? document = requestResult.htmlDocument;
|
var document = requestResult.htmlDocument;
|
||||||
|
|
||||||
HtmlNode[] imageNodes =
|
var imageNodes =
|
||||||
document.DocumentNode.SelectNodes($"//section[@hx-get='{chapter.Url}/images']/img")?.ToArray() ?? [];
|
document.DocumentNode.SelectNodes($"//section[@hx-get='{chapter.Url}/images']/img")?.ToArray() ?? [];
|
||||||
string[] urls = imageNodes.Select(imgNode => imgNode.GetAttributeValue("src", "")).ToArray();
|
var urls = imageNodes.Select(imgNode => imgNode.GetAttributeValue("src", "")).ToArray();
|
||||||
|
|
||||||
return urls;
|
return urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
private struct SearchResult
|
private List<Chapter> ParseChaptersFromHtml(Manga manga, HtmlDocument document)
|
||||||
{
|
{
|
||||||
public string i { get; set; }
|
var chaptersWrapper = document.DocumentNode.SelectSingleNode("/html/body");
|
||||||
public string s { get; set; }
|
|
||||||
public string[] a { get; set; }
|
Regex chapterRex = new(@"(\d+(?:\.\d+)*)");
|
||||||
|
Regex idRex = new(@"https:\/\/weebcentral\.com\/chapters\/(\w*)");
|
||||||
|
|
||||||
|
var ret = chaptersWrapper.Descendants("a").Select(elem =>
|
||||||
|
{
|
||||||
|
var url = elem.GetAttributeValue("href", "") ?? "Undefined";
|
||||||
|
|
||||||
|
if (!url.StartsWith("https://") && !url.StartsWith("http://"))
|
||||||
|
return new Chapter(manga, "", "");
|
||||||
|
|
||||||
|
var idMatch = idRex.Match(url);
|
||||||
|
var id = idMatch.Success ? idMatch.Groups[1].Value : null;
|
||||||
|
|
||||||
|
var chapterNode = elem.SelectSingleNode("span[@class='grow flex items-center gap-2']/span")?.InnerText ??
|
||||||
|
"Undefined";
|
||||||
|
|
||||||
|
var chapterNumberMatch = chapterRex.Match(chapterNode);
|
||||||
|
var chapterNumber = chapterNumberMatch.Success ? chapterNumberMatch.Groups[1].Value : "-1";
|
||||||
|
|
||||||
|
return new Chapter(manga, url, chapterNumber);
|
||||||
|
}).Where(elem => elem.ChapterNumber != String.Empty && elem.Url != string.Empty).ToList();
|
||||||
|
|
||||||
|
ret.Reverse();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -28,7 +28,6 @@ public class PgsqlContext(DbContextOptions<PgsqlContext> options) : DbContext(op
|
|||||||
.HasValue<Bato>("Bato")
|
.HasValue<Bato>("Bato")
|
||||||
.HasValue<MangaHere>("MangaHere")
|
.HasValue<MangaHere>("MangaHere")
|
||||||
.HasValue<MangaKatana>("MangaKatana")
|
.HasValue<MangaKatana>("MangaKatana")
|
||||||
.HasValue<Manganato>("Manganato")
|
|
||||||
.HasValue<Mangaworld>("Mangaworld")
|
.HasValue<Mangaworld>("Mangaworld")
|
||||||
.HasValue<ManhuaPlus>("ManhuaPlus")
|
.HasValue<ManhuaPlus>("ManhuaPlus")
|
||||||
.HasValue<Weebcentral>("Weebcentral")
|
.HasValue<Weebcentral>("Weebcentral")
|
||||||
|
@ -69,7 +69,7 @@ public static class Tranga
|
|||||||
Log.Info(TRANGA);
|
Log.Info(TRANGA);
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
List<Job> completedJobs = context.Jobs.Where(j => j.state == JobState.Completed).ToList();
|
List<Job> completedJobs = context.Jobs.Where(j => j.state >= JobState.Completed && j.state < JobState.Failed).ToList();
|
||||||
foreach (Job job in completedJobs)
|
foreach (Job job in completedJobs)
|
||||||
if (job.RecurrenceMs <= 0)
|
if (job.RecurrenceMs <= 0)
|
||||||
context.Jobs.Remove(job);
|
context.Jobs.Remove(job);
|
||||||
@ -87,6 +87,25 @@ public static class Tranga
|
|||||||
// If the job is already running, skip it
|
// If the job is already running, skip it
|
||||||
if (RunningJobs.Values.Any(j => j.JobId == job.JobId)) continue;
|
if (RunningJobs.Values.Any(j => j.JobId == job.JobId)) continue;
|
||||||
|
|
||||||
|
if (job is DownloadNewChaptersJob dncj)
|
||||||
|
{
|
||||||
|
if (RunningJobs.Values.Any(j =>
|
||||||
|
j is DownloadNewChaptersJob rdncj &&
|
||||||
|
rdncj.Manga?.MangaConnector == dncj.Manga?.MangaConnector))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (job is DownloadSingleChapterJob dscj)
|
||||||
|
{
|
||||||
|
if (RunningJobs.Values.Any(j =>
|
||||||
|
j is DownloadSingleChapterJob rdscj && rdscj.Chapter?.ParentManga?.MangaConnector ==
|
||||||
|
dscj.Chapter?.ParentManga?.MangaConnector))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Thread t = new(() =>
|
Thread t = new(() =>
|
||||||
{
|
{
|
||||||
IEnumerable<Job> newJobs = job.Run(serviceProvider);
|
IEnumerable<Job> newJobs = job.Run(serviceProvider);
|
||||||
|
@ -1,209 +0,0 @@
|
|||||||
using System.Net;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using HtmlAgilityPack;
|
|
||||||
using Soenneker.Utils.String.NeedlemanWunsch;
|
|
||||||
using Tranga.Jobs;
|
|
||||||
|
|
||||||
namespace Tranga.MangaConnectors;
|
|
||||||
|
|
||||||
public class Weebcentral : MangaConnector
|
|
||||||
{
|
|
||||||
private readonly string _baseUrl = "https://weebcentral.com";
|
|
||||||
|
|
||||||
private readonly string[] _filterWords =
|
|
||||||
{ "a", "the", "of", "as", "to", "no", "for", "on", "with", "be", "and", "in", "wa", "at", "be", "ni" };
|
|
||||||
|
|
||||||
public Weebcentral(GlobalBase clone) : base(clone, "Weebcentral", ["en"])
|
|
||||||
{
|
|
||||||
downloadClient = new ChromiumDownloadClient(clone);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Manga[] GetManga(string publicationTitle = "")
|
|
||||||
{
|
|
||||||
Log($"Searching Publications. Term=\"{publicationTitle}\"");
|
|
||||||
const int limit = 32; //How many values we want returned at once
|
|
||||||
var offset = 0; //"Page"
|
|
||||||
var requestUrl =
|
|
||||||
$"{_baseUrl}/search/data?limit={limit}&offset={offset}&text={publicationTitle}&sort=Best+Match&order=Ascending&official=Any&display_mode=Minimal%20Display";
|
|
||||||
var requestResult =
|
|
||||||
downloadClient.MakeRequest(requestUrl, RequestType.Default);
|
|
||||||
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300 ||
|
|
||||||
requestResult.htmlDocument == null)
|
|
||||||
{
|
|
||||||
Log($"Failed to retrieve search: {requestResult.statusCode}");
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
var publications = ParsePublicationsFromHtml(requestResult.htmlDocument);
|
|
||||||
Log($"Retrieved {publications.Length} publications. Term=\"{publicationTitle}\"");
|
|
||||||
|
|
||||||
return publications;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Manga[] ParsePublicationsFromHtml(HtmlDocument document)
|
|
||||||
{
|
|
||||||
if (document.DocumentNode.SelectNodes("//article") == null)
|
|
||||||
return [];
|
|
||||||
|
|
||||||
var urls = document.DocumentNode.SelectNodes("/html/body/article/a[@class='link link-hover']")
|
|
||||||
.Select(elem => elem.GetAttributeValue("href", "")).ToList();
|
|
||||||
|
|
||||||
HashSet<Manga> ret = new();
|
|
||||||
foreach (var url in urls)
|
|
||||||
{
|
|
||||||
var manga = GetMangaFromUrl(url);
|
|
||||||
if (manga is not null)
|
|
||||||
ret.Add((Manga)manga);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Manga? GetMangaFromUrl(string url)
|
|
||||||
{
|
|
||||||
Regex publicationIdRex = new(@"https:\/\/weebcentral\.com\/series\/(\w*)\/(.*)");
|
|
||||||
var publicationId = publicationIdRex.Match(url).Groups[1].Value;
|
|
||||||
|
|
||||||
var requestResult = downloadClient.MakeRequest(url, RequestType.MangaInfo);
|
|
||||||
if ((int)requestResult.statusCode < 300 && (int)requestResult.statusCode >= 200 &&
|
|
||||||
requestResult.htmlDocument is not null)
|
|
||||||
return ParseSinglePublicationFromHtml(requestResult.htmlDocument, publicationId, url);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Manga ParseSinglePublicationFromHtml(HtmlDocument document, string publicationId, string websiteUrl)
|
|
||||||
{
|
|
||||||
var posterNode =
|
|
||||||
document.DocumentNode.SelectSingleNode("//section[@class='flex items-center justify-center']/picture/img");
|
|
||||||
var posterUrl = posterNode?.GetAttributeValue("src", "") ?? "";
|
|
||||||
var coverFileNameInCache = SaveCoverImageToCache(posterUrl, publicationId, RequestType.MangaCover);
|
|
||||||
|
|
||||||
var titleNode = document.DocumentNode.SelectSingleNode("//section/h1");
|
|
||||||
var sortName = titleNode?.InnerText ?? "Undefined";
|
|
||||||
|
|
||||||
HtmlNode[] authorsNodes =
|
|
||||||
document.DocumentNode.SelectNodes("//ul/li[strong/text() = 'Author(s): ']/span")?.ToArray() ?? [];
|
|
||||||
var authors = authorsNodes.Select(n => n.InnerText).ToList();
|
|
||||||
|
|
||||||
HtmlNode[] genreNodes =
|
|
||||||
document.DocumentNode.SelectNodes("//ul/li[strong/text() = 'Tags(s): ']/span")?.ToArray() ?? [];
|
|
||||||
HashSet<string> tags = genreNodes.Select(n => n.InnerText).ToHashSet();
|
|
||||||
|
|
||||||
var statusNode = document.DocumentNode.SelectSingleNode("//ul/li[strong/text() = 'Status: ']/a");
|
|
||||||
var status = statusNode?.InnerText ?? "";
|
|
||||||
Log("unable to parse status");
|
|
||||||
var releaseStatus = Manga.ReleaseStatusByte.Unreleased;
|
|
||||||
switch (status.ToLower())
|
|
||||||
{
|
|
||||||
case "cancelled": releaseStatus = Manga.ReleaseStatusByte.Cancelled; break;
|
|
||||||
case "hiatus": releaseStatus = Manga.ReleaseStatusByte.OnHiatus; break;
|
|
||||||
case "complete": releaseStatus = Manga.ReleaseStatusByte.Completed; break;
|
|
||||||
case "ongoing": releaseStatus = Manga.ReleaseStatusByte.Continuing; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
var yearNode = document.DocumentNode.SelectSingleNode("//ul/li[strong/text() = 'Released: ']/span");
|
|
||||||
var year = Convert.ToInt32(yearNode?.InnerText ?? "0");
|
|
||||||
|
|
||||||
var descriptionNode = document.DocumentNode.SelectSingleNode("//ul/li[strong/text() = 'Description']/p");
|
|
||||||
var description = descriptionNode?.InnerText ?? "Undefined";
|
|
||||||
|
|
||||||
HtmlNode[] altTitleNodes = document.DocumentNode
|
|
||||||
.SelectNodes("//ul/li[strong/text() = 'Associated Name(s)']/ul/li")?.ToArray() ?? [];
|
|
||||||
Dictionary<string, string> altTitles = new(), links = new();
|
|
||||||
for (var i = 0; i < altTitleNodes.Length; i++)
|
|
||||||
altTitles.Add(i.ToString(), altTitleNodes[i].InnerText);
|
|
||||||
|
|
||||||
var originalLanguage = "";
|
|
||||||
|
|
||||||
Manga manga = new(sortName, authors.ToList(), description, altTitles, tags.ToArray(), posterUrl,
|
|
||||||
coverFileNameInCache, links,
|
|
||||||
year, originalLanguage, publicationId, releaseStatus, websiteUrl);
|
|
||||||
AddMangaToCache(manga);
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Manga? GetMangaFromId(string publicationId)
|
|
||||||
{
|
|
||||||
return GetMangaFromUrl($"https://weebcentral.com/series/{publicationId}");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Chapter[] GetChapters(Manga manga, string language = "en")
|
|
||||||
{
|
|
||||||
Log($"Getting chapters {manga}");
|
|
||||||
var requestUrl = $"{_baseUrl}/series/{manga.publicationId}/full-chapter-list";
|
|
||||||
var requestResult =
|
|
||||||
downloadClient.MakeRequest(requestUrl, RequestType.Default);
|
|
||||||
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300)
|
|
||||||
return [];
|
|
||||||
|
|
||||||
//Return Chapters ordered by Chapter-Number
|
|
||||||
if (requestResult.htmlDocument is null)
|
|
||||||
return [];
|
|
||||||
var chapters = ParseChaptersFromHtml(manga, requestResult.htmlDocument);
|
|
||||||
Log($"Got {chapters.Count} chapters. {manga}");
|
|
||||||
return chapters.Order().ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Chapter> ParseChaptersFromHtml(Manga manga, HtmlDocument document)
|
|
||||||
{
|
|
||||||
var chaptersWrapper = document.DocumentNode.SelectSingleNode("/html/body");
|
|
||||||
|
|
||||||
Regex chapterRex = new(@"(\d+(?:\.\d+)*)");
|
|
||||||
Regex idRex = new(@"https:\/\/weebcentral\.com\/chapters\/(\w*)");
|
|
||||||
|
|
||||||
var ret = chaptersWrapper.Descendants("a").Select(elem =>
|
|
||||||
{
|
|
||||||
var url = elem.GetAttributeValue("href", "") ?? "Undefined";
|
|
||||||
|
|
||||||
if (!url.StartsWith("https://") && !url.StartsWith("http://"))
|
|
||||||
return new Chapter(manga, null, null, "-1", "undefined");
|
|
||||||
|
|
||||||
var idMatch = idRex.Match(url);
|
|
||||||
var id = idMatch.Success ? idMatch.Groups[1].Value : null;
|
|
||||||
|
|
||||||
var chapterNode = elem.SelectSingleNode("span[@class='grow flex items-center gap-2']/span")?.InnerText ??
|
|
||||||
"Undefined";
|
|
||||||
|
|
||||||
var chapterNumberMatch = chapterRex.Match(chapterNode);
|
|
||||||
var chapterNumber = chapterNumberMatch.Success ? chapterNumberMatch.Groups[1].Value : "-1";
|
|
||||||
|
|
||||||
return new Chapter(manga, null, null, chapterNumber, url, id);
|
|
||||||
}).Where(elem => elem.chapterNumber != -1 && elem.url != "undefined").ToList();
|
|
||||||
|
|
||||||
ret.Reverse();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override HttpStatusCode DownloadChapter(Chapter chapter, ProgressToken? progressToken = null)
|
|
||||||
{
|
|
||||||
if (progressToken?.cancellationRequested ?? false)
|
|
||||||
{
|
|
||||||
progressToken.Cancel();
|
|
||||||
return HttpStatusCode.RequestTimeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
var chapterParentManga = chapter.parentManga;
|
|
||||||
if (progressToken?.cancellationRequested ?? false)
|
|
||||||
{
|
|
||||||
progressToken.Cancel();
|
|
||||||
return HttpStatusCode.RequestTimeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log($"Retrieving chapter-info {chapter} {chapterParentManga}");
|
|
||||||
|
|
||||||
var requestResult = downloadClient.MakeRequest(chapter.url, RequestType.Default);
|
|
||||||
if (requestResult.htmlDocument is null)
|
|
||||||
{
|
|
||||||
progressToken?.Cancel();
|
|
||||||
return HttpStatusCode.RequestTimeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
var document = requestResult.htmlDocument;
|
|
||||||
|
|
||||||
var imageNodes =
|
|
||||||
document.DocumentNode.SelectNodes($"//section[@hx-get='{chapter.url}/images']/img")?.ToArray() ?? [];
|
|
||||||
var urls = imageNodes.Select(imgNode => imgNode.GetAttributeValue("src", "")).ToArray();
|
|
||||||
|
|
||||||
return DownloadChapterImages(urls, chapter, RequestType.MangaImage, progressToken: progressToken);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user