mirror of
https://github.com/C9Glax/tranga.git
synced 2025-07-06 19:04:18 +02:00
Renamed Publication.cs to Manga.cs
Renamed Request-Paths "Tasks" to "Jobs"
This commit is contained in:
@ -14,7 +14,7 @@ public class DownloadChapter : Job
|
||||
|
||||
protected override string GetId()
|
||||
{
|
||||
return Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Concat(this.GetType().ToString(), chapter.parentPublication.internalId, chapter.chapterNumber)));
|
||||
return Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Concat(this.GetType().ToString(), chapter.parentManga.internalId, chapter.chapterNumber)));
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -28,7 +28,7 @@ public class DownloadChapter : Job
|
||||
{
|
||||
mangaConnector.DownloadChapter(chapter, this.progressToken);
|
||||
UpdateLibraries();
|
||||
SendNotifications("Chapter downloaded", $"{chapter.parentPublication.sortName} - {chapter.chapterNumber}");
|
||||
SendNotifications("Chapter downloaded", $"{chapter.parentManga.sortName} - {chapter.chapterNumber}");
|
||||
});
|
||||
downloadTask.Start();
|
||||
return Array.Empty<Job>();
|
||||
|
@ -5,26 +5,26 @@ namespace Tranga.Jobs;
|
||||
|
||||
public class DownloadNewChapters : Job
|
||||
{
|
||||
public Publication publication { get; init; }
|
||||
public Manga manga { get; init; }
|
||||
|
||||
public DownloadNewChapters(GlobalBase clone, MangaConnector connector, Publication publication, bool recurring = false, TimeSpan? recurrence = null) : base (clone, connector, recurring, recurrence)
|
||||
public DownloadNewChapters(GlobalBase clone, MangaConnector connector, Manga manga, bool recurring = false, TimeSpan? recurrence = null) : base (clone, connector, recurring, recurrence)
|
||||
{
|
||||
this.publication = publication;
|
||||
this.manga = manga;
|
||||
}
|
||||
|
||||
protected override string GetId()
|
||||
{
|
||||
return Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Concat(this.GetType().ToString(), publication.internalId)));
|
||||
return Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Concat(this.GetType().ToString(), manga.internalId)));
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"DownloadChapter {id} {publication}";
|
||||
return $"DownloadChapter {id} {manga}";
|
||||
}
|
||||
|
||||
protected override IEnumerable<Job> ExecuteReturnSubTasksInternal()
|
||||
{
|
||||
Chapter[] chapters = mangaConnector.GetNewChapters(publication);
|
||||
Chapter[] chapters = mangaConnector.GetNewChapters(manga);
|
||||
this.progressToken.increments = chapters.Length;
|
||||
List<Job> subJobs = new();
|
||||
foreach (Chapter chapter in chapters)
|
||||
|
@ -44,7 +44,7 @@ public class JobBoss : GlobalBase
|
||||
{
|
||||
if (jjob is not DownloadChapter job)
|
||||
return false;
|
||||
return job.chapter.parentPublication.internalId == internalId &&
|
||||
return job.chapter.parentManga.internalId == internalId &&
|
||||
job.chapter.chapterNumber == chapterNumber;
|
||||
});
|
||||
else if (internalId is not null)
|
||||
@ -52,12 +52,12 @@ public class JobBoss : GlobalBase
|
||||
{
|
||||
if (jjob is not DownloadNewChapters job)
|
||||
return false;
|
||||
return job.publication.internalId == internalId;
|
||||
return job.manga.internalId == internalId;
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
public IEnumerable<Job> GetJobsLike(MangaConnector? mangaConnector = null, Publication? publication = null,
|
||||
public IEnumerable<Job> GetJobsLike(MangaConnector? mangaConnector = null, Manga? publication = null,
|
||||
Chapter? chapter = null)
|
||||
{
|
||||
return GetJobsLike(mangaConnector?.name, publication?.internalId, chapter?.chapterNumber);
|
||||
|
Reference in New Issue
Block a user