Finished MangaDexMetadataProvider logic.

This commit is contained in:
2025-05-27 23:49:38 -04:00
parent df1e8a2360
commit 4e5be6c910
15 changed files with 563 additions and 93 deletions

View File

@@ -11,7 +11,7 @@ public partial class MangaPipeline(MangaContext context) : IMangaPipeline
{
Manga manga = await GetOrAddMangaAsync(sourceManga);
foreach (string alternateTitle in sourceManga.AlternateTitles)
foreach (SourceMangaTitle alternateTitle in sourceManga.AlternateTitles)
{
await AddTitleAsync(manga, alternateTitle);
}
@@ -62,9 +62,10 @@ public partial class MangaPipeline(MangaContext context) : IMangaPipeline
[GeneratedRegex(@"\s+")]
private static partial Regex RemoveSpacesWithDashRegex();
private async Task AddTitleAsync(Manga manga, string title)
private async Task AddTitleAsync(Manga manga, SourceMangaTitle sourceMangaTitle)
{
MangaTitle? mangaTitle = await context.MangaTitles.FirstOrDefaultAsync(mt => mt.Manga == manga && mt.TitleEntry == title);
MangaTitle? mangaTitle = await context.MangaTitles.FirstOrDefaultAsync(mt =>
mt.Manga == manga && mt.TitleEntry == sourceMangaTitle.Title);
if (mangaTitle != null)
return;
@@ -72,7 +73,7 @@ public partial class MangaPipeline(MangaContext context) : IMangaPipeline
mangaTitle = new()
{
Manga = manga,
TitleEntry = title,
TitleEntry = sourceMangaTitle.Title,
};
context.MangaTitles.Add(mangaTitle);
@@ -123,9 +124,9 @@ public partial class MangaPipeline(MangaContext context) : IMangaPipeline
mangaChapter.VolumeNumber = sourceeMangaChapter.Volume;
}
if (mangaChapter.Title is null && sourceeMangaChapter.Name is not null)
if (mangaChapter.Title is null && sourceeMangaChapter.Title is not null)
{
mangaChapter.Title = sourceeMangaChapter.Name;
mangaChapter.Title = sourceeMangaChapter.Title;
}
}