diff --git a/Tranga/Jobs/DownloadChapter.cs b/Tranga/Jobs/DownloadChapter.cs index dc81368..d01fd49 100644 --- a/Tranga/Jobs/DownloadChapter.cs +++ b/Tranga/Jobs/DownloadChapter.cs @@ -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(); diff --git a/Tranga/MangaConnectors/MangaConnector.cs b/Tranga/MangaConnectors/MangaConnector.cs index 09fb7f2..d8ddacb 100644 --- a/Tranga/MangaConnectors/MangaConnector.cs +++ b/Tranga/MangaConnectors/MangaConnector.cs @@ -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;