diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Fourchan.hpp | 1 | ||||
-rw-r--r-- | plugins/Manganelo.hpp | 9 | ||||
-rw-r--r-- | plugins/Plugin.hpp | 3 | ||||
-rw-r--r-- | plugins/Pornhub.hpp | 1 | ||||
-rw-r--r-- | plugins/Youtube.hpp | 1 |
5 files changed, 15 insertions, 0 deletions
diff --git a/plugins/Fourchan.hpp b/plugins/Fourchan.hpp index d6b482b..7f9ad13 100644 --- a/plugins/Fourchan.hpp +++ b/plugins/Fourchan.hpp @@ -5,6 +5,7 @@ namespace QuickMedia { class Fourchan : public Plugin { public: + Fourchan() : Plugin("4chan") {} PluginResult get_front_page(BodyItems &result_items) override; SearchResult search(const std::string &url, BodyItems &result_items) override; SuggestionResult update_search_suggestions(const std::string &text, BodyItems &result_items) override; 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 diff --git a/plugins/Plugin.hpp b/plugins/Plugin.hpp index d5802af..dffe898 100644 --- a/plugins/Plugin.hpp +++ b/plugins/Plugin.hpp @@ -50,6 +50,7 @@ namespace QuickMedia { class Plugin { public: + Plugin(const std::string &name) : name(name) {} virtual ~Plugin() = default; virtual PluginResult get_front_page(BodyItems &result_items) { @@ -74,6 +75,8 @@ namespace QuickMedia { virtual int get_search_delay() const = 0; virtual bool search_suggestion_is_search() const { return false; } virtual Page get_page_after_search() const = 0; + + const std::string name; protected: std::string url_param_encode(const std::string ¶m) const; }; diff --git a/plugins/Pornhub.hpp b/plugins/Pornhub.hpp index edbfdab..188a68e 100644 --- a/plugins/Pornhub.hpp +++ b/plugins/Pornhub.hpp @@ -5,6 +5,7 @@ namespace QuickMedia { class Pornhub : public Plugin { public: + Pornhub() : Plugin("pornhub") {} SuggestionResult update_search_suggestions(const std::string &text, BodyItems &result_items) override; BodyItems get_related_media(const std::string &url) override; bool search_suggestions_has_thumbnails() const override { return true; } diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp index 4ca7955..a676cd0 100644 --- a/plugins/Youtube.hpp +++ b/plugins/Youtube.hpp @@ -5,6 +5,7 @@ namespace QuickMedia { class Youtube : public Plugin { public: + Youtube() : Plugin("youtube") {} SuggestionResult update_search_suggestions(const std::string &text, BodyItems &result_items) override; BodyItems get_related_media(const std::string &url) override; bool search_suggestions_has_thumbnails() const override { return true; } |