From 2ba21aa9aa91b975fe0c8be630dde05d0d9b5366 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 13 Oct 2019 03:32:07 +0200 Subject: Manganelo: Download all images at once, and show page after it has downloaded --- plugins/Manganelo.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'plugins/Manganelo.hpp') diff --git a/plugins/Manganelo.hpp b/plugins/Manganelo.hpp index ab3bb3f..3405de2 100644 --- a/plugins/Manganelo.hpp +++ b/plugins/Manganelo.hpp @@ -1,10 +1,16 @@ #pragma once #include "Plugin.hpp" +#include +#include namespace QuickMedia { + // Return false to stop iteration + using PageCallback = std::function; + class Manganelo : public Plugin { public: + Manganelo() : Plugin("manganelo") {} SearchResult search(const std::string &url, BodyItems &result_items) override; SuggestionResult update_search_suggestions(const std::string &text, BodyItems &result_items) override; ImageResult get_image_by_index(const std::string &url, int index, std::string &image_data); @@ -13,11 +19,14 @@ namespace QuickMedia { bool search_results_has_thumbnails() const override { return false; } int get_search_delay() const override { return 150; } Page get_page_after_search() const override { return Page::EPISODE_LIST; } + + ImageResult for_each_page_in_chapter(const std::string &chapter_url, PageCallback callback); private: // 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 last_chapter_image_urls; + std::mutex image_urls_mutex; }; } \ No newline at end of file -- cgit v1.2.3