From c3cb4d6e0887bcea89bb24f840a929f45fbf0e1c Mon Sep 17 00:00:00 2001 From: glax <--local> Date: Thu, 18 May 2023 16:41:14 +0200 Subject: [PATCH] Add optional value to search for Manga instead of downloading all GetPublications(string = null) --- 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 b04bd28..8d31a0a 100644 --- a/Tranga/Connector.cs +++ b/Tranga/Connector.cs @@ -6,7 +6,7 @@ public abstract class Connector { internal abstract string downloadLocation { get; } public abstract string name { get; } - public abstract Publication[] GetPublications(); + public abstract Publication[] GetPublications(string publicationTitle = ""); public abstract Chapter[] GetChapters(Publication publication); public abstract void DownloadChapter(Publication publication, Chapter chapter); //where to? diff --git a/Tranga/Connectors/MangaDex.cs b/Tranga/Connectors/MangaDex.cs index 6bf293a..50fec60 100644 --- a/Tranga/Connectors/MangaDex.cs +++ b/Tranga/Connectors/MangaDex.cs @@ -15,10 +15,10 @@ public class MangaDex : Connector this.downloadLocation = downloadLocation; } - public override Publication[] GetPublications() + public override Publication[] GetPublications(string publicationTitle = "") { const int limit = 100; - string publicationsUrl = $"https://api.mangadex.org/manga?limit={limit}&offset="; + string publicationsUrl = $"https://api.mangadex.org/manga?limit={limit}&title={publicationTitle}&offset="; int offset = 0; int total = int.MaxValue; HashSet publications = new();