This commit is contained in:
2025-07-02 02:26:02 +02:00
parent 07880fedb5
commit 57bb87120a
96 changed files with 814 additions and 13216 deletions

View File

@ -0,0 +1,26 @@
using API.Schema.MangaContext;
using API.Schema.MangaContext.MangaConnectors;
using Microsoft.EntityFrameworkCore;
namespace API.Workers;
public class DownloadCoverFromMangaconnectorWorker(MangaConnectorId<Manga> mcId, IServiceScope scope, IEnumerable<BaseWorker>? dependsOn = null)
: BaseWorkerWithContext<MangaContext>(scope, dependsOn)
{
public MangaConnectorId<Manga> MangaConnectorId { get; init; } = mcId;
protected override BaseWorker[] DoWorkInternal()
{
MangaConnector mangaConnector = MangaConnectorId.MangaConnector;
Manga manga = MangaConnectorId.Obj;
try
{
manga.CoverFileNameInCache = mangaConnector.SaveCoverImageToCache(MangaConnectorId);
DbContext.SaveChanges();
}
catch (DbUpdateException e)
{
Log.Error(e);
}
return [];
}
}