Added functionality to only list chapters in selected language

This commit is contained in:
glax 2023-05-18 18:19:04 +02:00
parent f2be9ba132
commit 170d0c094c
2 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ public abstract class Connector
internal abstract string downloadLocation { get; } internal abstract string downloadLocation { get; }
public abstract string name { get; } public abstract string name { get; }
public abstract Publication[] GetPublications(string publicationTitle = ""); 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? public abstract void DownloadChapter(Publication publication, Chapter chapter); //where to?
internal abstract void DownloadImage(string url, string path); internal abstract void DownloadImage(string url, string path);

View File

@ -113,7 +113,7 @@ public class MangaDex : Connector
return publications.ToArray(); return publications.ToArray();
} }
public override Chapter[] GetChapters(Publication publication) public override Chapter[] GetChapters(Publication publication, string language = "")
{ {
const int limit = 100; const int limit = 100;
int offset = 0; int offset = 0;
@ -124,7 +124,7 @@ public class MangaDex : Connector
{ {
offset += limit; offset += limit;
DownloadClient.RequestResult requestResult = 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<JsonObject>(requestResult.result); JsonObject? result = JsonSerializer.Deserialize<JsonObject>(requestResult.result);
if (result is null) if (result is null)
break; break;