From d13a7c3e49574f6a5fa6baadfc101577cf44d0a0 Mon Sep 17 00:00:00 2001 From: glax <--local> Date: Thu, 18 May 2023 16:21:21 +0200 Subject: [PATCH] Add field "url" to Chapter to know where to download. --- Tranga/Chapter.cs | 4 +++- Tranga/Connectors/MangaDex.cs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Tranga/Chapter.cs b/Tranga/Chapter.cs index e60bf8a..b167980 100644 --- a/Tranga/Chapter.cs +++ b/Tranga/Chapter.cs @@ -6,12 +6,14 @@ public struct Chapter public string? name { get; } public string? volumeNumber { get; } public string? chapterNumber { get; } + public string url { get; } - public Chapter(Publication publication, string? name, string? volumeNumber, string? chapterNumber) + public Chapter(Publication publication, string? name, string? volumeNumber, string? chapterNumber, string url) { this.publication = publication; this.name = name; this.volumeNumber = volumeNumber; this.chapterNumber = chapterNumber; + this.url = url; } } \ No newline at end of file diff --git a/Tranga/Connectors/MangaDex.cs b/Tranga/Connectors/MangaDex.cs index 412fe5a..5297124 100644 --- a/Tranga/Connectors/MangaDex.cs +++ b/Tranga/Connectors/MangaDex.cs @@ -123,6 +123,8 @@ public class MangaDex : Connector foreach (JsonObject chapter in chaptersInResult) { JsonObject attributes = chapter!["attributes"]!.AsObject(); + string chapterId = attributes["id"]!.GetValue(); + string? title = attributes.ContainsKey("title") && attributes["title"] is not null ? attributes["title"]!.GetValue() : null; @@ -135,7 +137,7 @@ public class MangaDex : Connector ? attributes["chapter"]!.GetValue() : null; - chapters.Add(new Chapter(publication, title, volume, chapterNum)); + chapters.Add(new Chapter(publication, title, volume, chapterNum, chapterId)); } } return chapters.OrderBy(chapter => chapter.chapterNumber).ToArray();