aboutsummaryrefslogtreecommitdiff
path: root/plugins/Manganelo.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-10-13 03:32:07 +0200
committerdec05eba <dec05eba@protonmail.com>2019-10-13 03:32:10 +0200
commit2ba21aa9aa91b975fe0c8be630dde05d0d9b5366 (patch)
tree272124e9068febe01630acc23ddea36866f77484 /plugins/Manganelo.hpp
parentcc25c30cf177ee83d800925c72b7d334b76fb83d (diff)
Manganelo: Download all images at once, and show page after it has downloaded
Diffstat (limited to 'plugins/Manganelo.hpp')
-rw-r--r--plugins/Manganelo.hpp9
1 files changed, 9 insertions, 0 deletions
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 <functional>
+#include <mutex>
namespace QuickMedia {
+ // Return false to stop iteration
+ using PageCallback = std::function<bool(const std::string &url)>;
+
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<std::string> last_chapter_image_urls;
+ std::mutex image_urls_mutex;
};
} \ No newline at end of file