Check if cover already exists in publication.
This commit is contained in:
parent
9baa9fb8f0
commit
cfaf8064cc
@ -187,6 +187,12 @@ public class MangaDex : Connector
|
|||||||
|
|
||||||
public override void DownloadCover(Publication publication)
|
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}");
|
DownloadClient.RequestResult requestResult = _downloadClient.MakeRequest($"https://api.mangadex.org/cover/{publication.posterUrl}");
|
||||||
JsonObject? result = JsonSerializer.Deserialize<JsonObject>(requestResult.result);
|
JsonObject? result = JsonSerializer.Deserialize<JsonObject>(requestResult.result);
|
||||||
if (result is null)
|
if (result is null)
|
||||||
|
Loading…
Reference in New Issue
Block a user