From fd4e8cdc9449dbb0224a1a41ef0561f50012d405 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 19 Oct 2020 03:12:31 +0200 Subject: Add pagination to ph and mangatown --- plugins/Mangatown.hpp | 1 + plugins/Page.hpp | 1 + plugins/Plugin.hpp | 1 + plugins/Pornhub.hpp | 1 + 4 files changed, 4 insertions(+) (limited to 'plugins') diff --git a/plugins/Mangatown.hpp b/plugins/Mangatown.hpp index c85b5b7..151b4c2 100644 --- a/plugins/Mangatown.hpp +++ b/plugins/Mangatown.hpp @@ -10,6 +10,7 @@ namespace QuickMedia { const char* get_title() const override { return "All"; } bool search_is_filter() override { return false; } SearchResult search(const std::string &str, BodyItems &result_items) override; + PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override; PluginResult submit(const std::string &title, const std::string &url, std::vector &result_tabs) override; private: bool extract_id_from_url(const std::string &url, std::string &manga_id) const; diff --git a/plugins/Page.hpp b/plugins/Page.hpp index 947f045..2adce85 100644 --- a/plugins/Page.hpp +++ b/plugins/Page.hpp @@ -21,6 +21,7 @@ namespace QuickMedia { // Return empty |result_tabs| and PluginResult::OK to do nothing; which is useful for implementing custom actions on item submit virtual PluginResult submit(const std::string &title, const std::string &url, std::vector &result_tabs) = 0; + // Note: If pagination is done by fetching the next page until we get to |page|, then the "current page" should be reset everytime |search| is called virtual PluginResult get_page(const std::string &str, int page, BodyItems &result_items) { (void)str; (void)page; (void)result_items; return PluginResult::OK; } virtual BodyItems get_related_media(const std::string &url); diff --git a/plugins/Plugin.hpp b/plugins/Plugin.hpp index d754445..2026319 100644 --- a/plugins/Plugin.hpp +++ b/plugins/Plugin.hpp @@ -39,4 +39,5 @@ namespace QuickMedia { PluginResult download_result_to_plugin_result(DownloadResult download_result); SearchResult download_result_to_search_result(DownloadResult download_result); ImageResult download_result_to_image_result(DownloadResult download_result); + PluginResult search_result_to_plugin_result(SearchResult search_result); } \ No newline at end of file diff --git a/plugins/Pornhub.hpp b/plugins/Pornhub.hpp index 195845f..b058bbe 100644 --- a/plugins/Pornhub.hpp +++ b/plugins/Pornhub.hpp @@ -9,6 +9,7 @@ namespace QuickMedia { const char* get_title() const override { return "All"; } bool search_is_filter() override { return false; } SearchResult search(const std::string &str, BodyItems &result_items) override; + PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override; PluginResult submit(const std::string &title, const std::string &url, std::vector &result_tabs) override; }; -- cgit v1.2.3