diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-08-05 18:17:00 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2019-08-05 18:17:04 +0200 |
commit | 657edb8eb9ab2fdef60d9c5d23a4c3093a64d859 (patch) | |
tree | a7055146e30551104480efd5f80898e21ae6aa5c /plugins | |
parent | 7e8a2f23a40e6374ddfb551920257846021e86fa (diff) |
Add manga chapter viewing
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Manganelo.hpp | 8 | ||||
-rw-r--r-- | plugins/Plugin.hpp | 10 | ||||
-rw-r--r-- | plugins/Youtube.hpp | 2 |
3 files changed, 17 insertions, 3 deletions
diff --git a/plugins/Manganelo.hpp b/plugins/Manganelo.hpp index 4ed976f..5e9382e 100644 --- a/plugins/Manganelo.hpp +++ b/plugins/Manganelo.hpp @@ -5,7 +5,13 @@ namespace QuickMedia { class Manganelo : public Plugin { public: - SearchResult search(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) override; + SearchResult search(const std::string &url, std::vector<std::unique_ptr<BodyItem>> &result_items, Page &next_page) override; SuggestionResult update_search_suggestions(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) override; + ImageResult get_image_by_index(const std::string &url, int index, std::string &image_data); + private: + ImageResult get_image_urls_for_chapter(const std::string &url, std::vector<std::string> &urls); + private: + std::string last_chapter_url; + std::vector<std::string> last_chapter_image_urls; }; }
\ No newline at end of file diff --git a/plugins/Plugin.hpp b/plugins/Plugin.hpp index 09ce09a..818cc5f 100644 --- a/plugins/Plugin.hpp +++ b/plugins/Plugin.hpp @@ -1,5 +1,6 @@ #pragma once +#include "../include/Page.hpp" #include <string> #include <vector> #include <memory> @@ -35,6 +36,13 @@ namespace QuickMedia { NET_ERR }; + enum class ImageResult { + OK, + END, + ERR, + NET_ERR + }; + struct CommandArg { std::string option; std::string value; @@ -44,7 +52,7 @@ namespace QuickMedia { public: virtual ~Plugin() = default; - virtual SearchResult search(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) = 0; + virtual SearchResult search(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items, Page &next_page) = 0; virtual SuggestionResult update_search_suggestions(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items); virtual std::vector<std::unique_ptr<BodyItem>> get_related_media(const std::string &url); protected: diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp index eda8a1f..c342a10 100644 --- a/plugins/Youtube.hpp +++ b/plugins/Youtube.hpp @@ -5,7 +5,7 @@ namespace QuickMedia { class Youtube : public Plugin { public: - SearchResult search(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) override; + SearchResult search(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items, Page &next_page) override; SuggestionResult update_search_suggestions(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) override; std::vector<std::unique_ptr<BodyItem>> get_related_media(const std::string &url) override; }; |