From 170d0c094cd9acd53d4a1d4a1894c336013859f2 Mon Sep 17 00:00:00 2001 From: glax <--local> Date: Thu, 18 May 2023 18:19:04 +0200 Subject: [PATCH] Added functionality to only list chapters in selected language --- Tranga/Connector.cs | 2 +- Tranga/Connectors/MangaDex.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tranga/Connector.cs b/Tranga/Connector.cs index 49000e2..cf1a198 100644 --- a/Tranga/Connector.cs +++ b/Tranga/Connector.cs @@ -8,7 +8,7 @@ public abstract class Connector internal abstract string downloadLocation { get; } public abstract string name { get; } public abstract Publication[] GetPublications(string publicationTitle = ""); - public abstract Chapter[] GetChapters(Publication publication); + public abstract Chapter[] GetChapters(Publication publication, string language = ""); public abstract void DownloadChapter(Publication publication, Chapter chapter); //where to? internal abstract void DownloadImage(string url, string path); diff --git a/Tranga/Connectors/MangaDex.cs b/Tranga/Connectors/MangaDex.cs index 078b23c..361c20d 100644 --- a/Tranga/Connectors/MangaDex.cs +++ b/Tranga/Connectors/MangaDex.cs @@ -113,7 +113,7 @@ public class MangaDex : Connector return publications.ToArray(); } - public override Chapter[] GetChapters(Publication publication) + public override Chapter[] GetChapters(Publication publication, string language = "") { const int limit = 100; int offset = 0; @@ -124,7 +124,7 @@ public class MangaDex : Connector { offset += limit; DownloadClient.RequestResult requestResult = - _downloadClient.MakeRequest($"https://api.mangadex.org/manga/{id}/feed?limit={limit}&offset={offset}"); + _downloadClient.MakeRequest($"https://api.mangadex.org/manga/{id}/feed?limit={limit}&offset={offset}&translatedLanguage%5B%5D={language}"); JsonObject? result = JsonSerializer.Deserialize(requestResult.result); if (result is null) break;