diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-05-28 02:08:40 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-05-28 02:08:40 +0200 |
commit | 9799803529c57930a0e7f12e45cbcf2b2e4419eb (patch) | |
tree | b2c488b49d901e5bc5e911a2e714a6748f37158e /plugins/Mangadex.hpp | |
parent | 217101c7a79dccf8617a7d3251d4b06bc7cb5905 (diff) |
Add support for mangadex
Diffstat (limited to 'plugins/Mangadex.hpp')
-rw-r--r-- | plugins/Mangadex.hpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/Mangadex.hpp b/plugins/Mangadex.hpp new file mode 100644 index 0000000..9d6d366 --- /dev/null +++ b/plugins/Mangadex.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include "Manga.hpp" +#include <functional> +#include <mutex> + +namespace QuickMedia { + class Mangadex : public Manga { + public: + Mangadex() : Manga("mangadex") {} + SearchResult search(const std::string &url, BodyItems &result_items) override; + SuggestionResult update_search_suggestions(const std::string &text, BodyItems &result_items) override; + ImageResult get_number_of_images(const std::string &url, int &num_images) override; + bool search_suggestions_has_thumbnails() const override { return true; } + bool search_results_has_thumbnails() const override { return false; } + int get_search_delay() const override { return 300; } + Page get_page_after_search() const override { return Page::EPISODE_LIST; } + + ImageResult for_each_page_in_chapter(const std::string &chapter_url, PageCallback callback) override; + + bool extract_id_from_url(const std::string &url, std::string &manga_id) override; + private: + SearchResult search_page(const std::string &url, BodyItems &result_items, int page, bool *is_last_page); + // Caches url. If the same url is requested multiple times then the cache is used + ImageResult get_image_urls_for_chapter(const std::string &url); + private: + std::string last_chapter_url; + std::vector<std::string> last_chapter_image_urls; + std::mutex image_urls_mutex; + }; +}
\ No newline at end of file |