From 657edb8eb9ab2fdef60d9c5d23a4c3093a64d859 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 5 Aug 2019 18:17:00 +0200 Subject: Add manga chapter viewing --- plugins/Manganelo.hpp | 8 +++++++- plugins/Plugin.hpp | 10 +++++++++- plugins/Youtube.hpp | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) (limited to 'plugins') 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> &result_items) override; + SearchResult search(const std::string &url, std::vector> &result_items, Page &next_page) override; SuggestionResult update_search_suggestions(const std::string &text, std::vector> &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 &urls); + private: + std::string last_chapter_url; + std::vector 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 #include #include @@ -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> &result_items) = 0; + virtual SearchResult search(const std::string &text, std::vector> &result_items, Page &next_page) = 0; virtual SuggestionResult update_search_suggestions(const std::string &text, std::vector> &result_items); virtual std::vector> 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> &result_items) override; + SearchResult search(const std::string &text, std::vector> &result_items, Page &next_page) override; SuggestionResult update_search_suggestions(const std::string &text, std::vector> &result_items) override; std::vector> get_related_media(const std::string &url) override; }; -- cgit v1.2.3