mirror of
https://github.com/C9Glax/tranga.git
synced 2025-06-12 06:27:54 +02:00
Job Run pass context to add new Data
This commit is contained in:
@ -18,7 +18,7 @@ public class DownloadSingleChapterJob(string chapterId, string? parentJobId = nu
|
||||
public string ChapterId { get; init; } = chapterId;
|
||||
public virtual Chapter Chapter { get; init; }
|
||||
|
||||
protected override IEnumerable<Job> RunInternal()
|
||||
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
||||
{
|
||||
MangaConnector connector = Chapter.ParentManga.MangaConnector;
|
||||
DownloadChapterImages(Chapter);
|
||||
@ -50,8 +50,6 @@ public class DownloadSingleChapterJob(string chapterId, string? parentJobId = nu
|
||||
//Download all Images to temporary Folder
|
||||
if (imageUrls.Length == 0)
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
File.SetUnixFileMode(saveArchiveFilePath, UserRead | UserWrite | UserExecute | GroupRead | GroupWrite | GroupExecute);
|
||||
Directory.Delete(tempFolder, true);
|
||||
return false;
|
||||
}
|
||||
|
@ -36,13 +36,13 @@ public abstract class Job
|
||||
NextExecution = LastExecution.AddMilliseconds(RecurrenceMs);
|
||||
}
|
||||
|
||||
public IEnumerable<Job> Run()
|
||||
public IEnumerable<Job> Run(PgsqlContext context)
|
||||
{
|
||||
this.state = JobState.Running;
|
||||
IEnumerable<Job> newJobs = RunInternal();
|
||||
IEnumerable<Job> newJobs = RunInternal(context);
|
||||
this.state = JobState.Completed;
|
||||
return newJobs;
|
||||
}
|
||||
|
||||
protected abstract IEnumerable<Job> RunInternal();
|
||||
protected abstract IEnumerable<Job> RunInternal(PgsqlContext context);
|
||||
}
|
@ -6,7 +6,7 @@ public class MoveFileOrFolderJob(string fromLocation, string toLocation, string?
|
||||
public string FromLocation { get; init; } = fromLocation;
|
||||
public string ToLocation { get; init; } = toLocation;
|
||||
|
||||
protected override IEnumerable<Job> RunInternal()
|
||||
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ public class UpdateMetadataJob(ulong recurrenceMs, string mangaId, string? paren
|
||||
public string MangaId { get; init; } = mangaId;
|
||||
public virtual Manga Manga { get; init; }
|
||||
|
||||
protected override IEnumerable<Job> RunInternal()
|
||||
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
Reference in New Issue
Block a user