Finished MangaDexMetadataProvider logic.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user