diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-10-02 03:53:39 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-10-02 03:53:39 +0200 |
commit | 7f8ef9f591ce85cfac49b71b5ff2bc8293e0d57c (patch) | |
tree | 02e2363c47a1c69be7ba87cbe985d4ab182312cb | |
parent | 275c6c9d801fffbf30fc702c1f683e519f66798f (diff) |
Mangadex: fix oneshots (without chapter name) not being listed in chapters page
-rw-r--r-- | src/plugins/Mangadex.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/Mangadex.cpp b/src/plugins/Mangadex.cpp index a232d65..e57c6cd 100644 --- a/src/plugins/Mangadex.cpp +++ b/src/plugins/Mangadex.cpp @@ -191,7 +191,8 @@ namespace QuickMedia { if(!data_list_json.isArray()) return PluginResult::ERR; - const char *prev_chapter = nullptr; + std::string prev_chapter; + std::string chapter; for(const Json::Value &data_json : data_list_json) { if(!data_json.isObject()) continue; @@ -209,18 +210,20 @@ namespace QuickMedia { continue; const Json::Value &chapter_json = attributes_json["chapter"]; - if(!chapter_json.isString()) - continue; + if(chapter_json.isString()) + chapter = chapter_json.asString(); + else + chapter = "0"; - if(prev_chapter && strcmp(prev_chapter, chapter_json.asCString()) == 0) + if(strcmp(prev_chapter.c_str(), chapter.c_str()) == 0) continue; const Json::Value &hash_json = attributes_json["hash"]; if(!hash_json.isString()) continue; - prev_chapter = chapter_json.asCString(); - std::string title = "Ch. " + chapter_json.asString(); + std::string title = "Ch. " + chapter; + prev_chapter = std::move(chapter); const Json::Value &title_json = attributes_json["title"]; if(title_json.isString() && title_json.asCString()[0] != '\0') title += " - " + title_json.asString(); |