From cfaf8064cc72434b08280a1102611015287bf72b Mon Sep 17 00:00:00 2001 From: glax Date: Fri, 19 May 2023 16:27:30 +0200 Subject: [PATCH] Check if cover already exists in publication. --- Tranga/Connectors/MangaDex.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tranga/Connectors/MangaDex.cs b/Tranga/Connectors/MangaDex.cs index 8b0686f..1eeb57d 100644 --- a/Tranga/Connectors/MangaDex.cs +++ b/Tranga/Connectors/MangaDex.cs @@ -187,6 +187,12 @@ public class MangaDex : Connector public override void DownloadCover(Publication publication) { + string publicationPath = Path.Join(downloadLocation, publication.folderName); + DirectoryInfo dirInfo = new DirectoryInfo(publicationPath); + foreach(FileInfo fileInfo in dirInfo.EnumerateFiles()) + if (fileInfo.Name.Contains("cover.")) + return; + DownloadClient.RequestResult requestResult = _downloadClient.MakeRequest($"https://api.mangadex.org/cover/{publication.posterUrl}"); JsonObject? result = JsonSerializer.Deserialize(requestResult.result); if (result is null)