Only send notification on successful downloads
This commit is contained in:
parent
4e5a6fe97b
commit
3ceee63dfc
@ -1,4 +1,5 @@
|
||||
using Tranga.MangaConnectors;
|
||||
using System.Net;
|
||||
using Tranga.MangaConnectors;
|
||||
|
||||
namespace Tranga.Jobs;
|
||||
|
||||
@ -31,9 +32,12 @@ public class DownloadChapter : Job
|
||||
Task downloadTask = new(delegate
|
||||
{
|
||||
mangaConnector.CopyCoverFromCacheToDownloadLocation(chapter.parentManga);
|
||||
mangaConnector.DownloadChapter(chapter, this.progressToken);
|
||||
UpdateLibraries();
|
||||
SendNotifications("Chapter downloaded", $"{chapter.parentManga.sortName} - {chapter.chapterNumber}");
|
||||
HttpStatusCode success = mangaConnector.DownloadChapter(chapter, this.progressToken);
|
||||
if (success == HttpStatusCode.OK)
|
||||
{
|
||||
UpdateLibraries();
|
||||
SendNotifications("Chapter downloaded", $"{chapter.parentManga.sortName} - {chapter.chapterNumber}");
|
||||
}
|
||||
});
|
||||
downloadTask.Start();
|
||||
return Array.Empty<Job>();
|
||||
|
@ -200,7 +200,7 @@ public abstract class MangaConnector : GlobalBase
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
|
||||
if (File.Exists(saveArchiveFilePath)) //Don't download twice.
|
||||
return HttpStatusCode.OK;
|
||||
return HttpStatusCode.Created;
|
||||
|
||||
//Create a temporary folder to store images
|
||||
string tempFolder = Directory.CreateTempSubdirectory().FullName;
|
||||
|
Loading…
Reference in New Issue
Block a user