Connector DownloadChapter, DownloadImage, DownloadChapterImages returns successState.

RequestResult replace HttpStatusCode with success-status boolean.
DownloadChapterTask: Only send Notification when Chapter download successful
This commit is contained in:
2023-06-19 22:45:33 +02:00
parent edc24fff5b
commit 23dfdc0933
5 changed files with 52 additions and 47 deletions

View File

@ -26,11 +26,11 @@ public class DownloadChapterTask : TrangaTask
this.parentTask.state = ExecutionState.Running;
Connector connector = taskManager.GetConnector(this.connectorName);
connector.CopyCoverFromCacheToDownloadLocation(this.publication, taskManager.settings);
connector.DownloadChapter(this.publication, this.chapter, this, cancellationToken);
bool downloadSuccess = connector.DownloadChapter(this.publication, this.chapter, this, cancellationToken);
if(this.parentTask is not null)
this.parentTask.state = ExecutionState.Waiting;
taskManager.DeleteTask(this);
if(parentTask is not null)
if(downloadSuccess && parentTask is not null)
foreach(NotificationManager nm in taskManager.settings.notificationManagers)
nm.SendNotification("New Chapter downloaded", $"{this.publication.sortName} {this.chapter.chapterNumber} {this.chapter.name}");
}