mirror of
https://github.com/C9Glax/tranga.git
synced 2025-02-24 00:00:13 +01:00
21 lines
874 B
C#
21 lines
874 B
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using API.Schema.MangaConnectors;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace API.Schema.Jobs;
|
|
|
|
public class DownloadNewChaptersJob(ulong recurrenceMs, string mangaId, string? parentJobId = null, string[]? dependsOnJobIds = null)
|
|
: Job(TokenGen.CreateToken(typeof(DownloadNewChaptersJob), 64), JobType.DownloadNewChaptersJob, recurrenceMs, parentJobId, dependsOnJobIds)
|
|
{
|
|
[MaxLength(64)]
|
|
public string MangaId { get; init; } = mangaId;
|
|
public virtual Manga Manga { get; init; }
|
|
|
|
public override IEnumerable<Job> Run()
|
|
{
|
|
MangaConnector connector = Manga.MangaConnector;
|
|
Chapter[] newChapters = connector.GetNewChapters(Manga);
|
|
return newChapters.Select(chapter => new DownloadSingleChapterJob(chapter.ChapterId, this.JobId));
|
|
}
|
|
} |