mirror of
https://github.com/C9Glax/tranga.git
synced 2025-01-12 11:27:32 +01:00
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;
|
namespace Tranga.Jobs;
|
||||||
|
|
||||||
@ -31,9 +32,12 @@ public class DownloadChapter : Job
|
|||||||
Task downloadTask = new(delegate
|
Task downloadTask = new(delegate
|
||||||
{
|
{
|
||||||
mangaConnector.CopyCoverFromCacheToDownloadLocation(chapter.parentManga);
|
mangaConnector.CopyCoverFromCacheToDownloadLocation(chapter.parentManga);
|
||||||
mangaConnector.DownloadChapter(chapter, this.progressToken);
|
HttpStatusCode success = mangaConnector.DownloadChapter(chapter, this.progressToken);
|
||||||
UpdateLibraries();
|
if (success == HttpStatusCode.OK)
|
||||||
SendNotifications("Chapter downloaded", $"{chapter.parentManga.sortName} - {chapter.chapterNumber}");
|
{
|
||||||
|
UpdateLibraries();
|
||||||
|
SendNotifications("Chapter downloaded", $"{chapter.parentManga.sortName} - {chapter.chapterNumber}");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
downloadTask.Start();
|
downloadTask.Start();
|
||||||
return Array.Empty<Job>();
|
return Array.Empty<Job>();
|
||||||
|
@ -200,7 +200,7 @@ public abstract class MangaConnector : GlobalBase
|
|||||||
Directory.CreateDirectory(directoryPath);
|
Directory.CreateDirectory(directoryPath);
|
||||||
|
|
||||||
if (File.Exists(saveArchiveFilePath)) //Don't download twice.
|
if (File.Exists(saveArchiveFilePath)) //Don't download twice.
|
||||||
return HttpStatusCode.OK;
|
return HttpStatusCode.Created;
|
||||||
|
|
||||||
//Create a temporary folder to store images
|
//Create a temporary folder to store images
|
||||||
string tempFolder = Directory.CreateTempSubdirectory().FullName;
|
string tempFolder = Directory.CreateTempSubdirectory().FullName;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user