mirror of
https://github.com/C9Glax/tranga.git
synced 2025-02-23 15:50:13 +01:00
Job: add Id
This commit is contained in:
parent
7614f9aad3
commit
4d1e43e7b3
@ -1,4 +1,5 @@
|
||||
using Tranga.MangaConnectors;
|
||||
using System.Text;
|
||||
using Tranga.MangaConnectors;
|
||||
|
||||
namespace Tranga.Jobs;
|
||||
|
||||
@ -10,6 +11,11 @@ public class DownloadChapter : Job
|
||||
{
|
||||
this.chapter = chapter;
|
||||
}
|
||||
|
||||
protected override string GetId()
|
||||
{
|
||||
return Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Concat(this.GetType().ToString(), chapter.parentPublication.internalId, chapter.chapterNumber)));
|
||||
}
|
||||
|
||||
protected override IEnumerable<Job> ExecuteReturnSubTasksInternal()
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Tranga.MangaConnectors;
|
||||
using System.Text;
|
||||
using Tranga.MangaConnectors;
|
||||
|
||||
namespace Tranga.Jobs;
|
||||
|
||||
@ -11,6 +12,11 @@ public class DownloadNewChapters : Job
|
||||
this.publication = publication;
|
||||
}
|
||||
|
||||
protected override string GetId()
|
||||
{
|
||||
return Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Concat(this.GetType().ToString(), publication.internalId)));
|
||||
}
|
||||
|
||||
protected override IEnumerable<Job> ExecuteReturnSubTasksInternal()
|
||||
{
|
||||
Chapter[] chapters = mangaConnector.GetNewChapters(publication);
|
||||
|
@ -10,6 +10,7 @@ public abstract class Job : GlobalBase
|
||||
public TimeSpan? recurrenceTime { get; set; }
|
||||
public DateTime? lastExecution { get; private set; }
|
||||
public DateTime nextExecution => NextExecution();
|
||||
public string id => GetId();
|
||||
|
||||
public Job(GlobalBase clone, MangaConnector connector, bool recurring = false, TimeSpan? recurrenceTime = null) : base(clone)
|
||||
{
|
||||
@ -21,6 +22,8 @@ public abstract class Job : GlobalBase
|
||||
this.recurrenceTime = recurrenceTime;
|
||||
}
|
||||
|
||||
protected abstract string GetId();
|
||||
|
||||
public Job(GlobalBase clone, MangaConnector connector, ProgressToken progressToken, bool recurring = false, TimeSpan? recurrenceTime = null) : base(clone)
|
||||
{
|
||||
this.mangaConnector = connector;
|
||||
|
Loading…
x
Reference in New Issue
Block a user