Add optional value to search for Manga instead of downloading all

GetPublications(string = null)
This commit is contained in:
glax 2023-05-18 16:41:14 +02:00
parent b15e032038
commit c3cb4d6e08
2 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,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(); public abstract Publication[] GetPublications(string publicationTitle = "");
public abstract Chapter[] GetChapters(Publication publication); public abstract Chapter[] GetChapters(Publication publication);
public abstract void DownloadChapter(Publication publication, Chapter chapter); //where to? public abstract void DownloadChapter(Publication publication, Chapter chapter); //where to?

View File

@ -15,10 +15,10 @@ public class MangaDex : Connector
this.downloadLocation = downloadLocation; this.downloadLocation = downloadLocation;
} }
public override Publication[] GetPublications() public override Publication[] GetPublications(string publicationTitle = "")
{ {
const int limit = 100; 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 offset = 0;
int total = int.MaxValue; int total = int.MaxValue;
HashSet<Publication> publications = new(); HashSet<Publication> publications = new();