From 117eb25e36ac3b1e1ba18cc9f1e177016c076f34 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 3 Aug 2019 01:52:27 +0200 Subject: Add search suggestions for youtube & manganelo --- plugins/Manganelo.hpp | 1 + plugins/Plugin.hpp | 15 ++++++++++++++- plugins/Youtube.hpp | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/Manganelo.hpp b/plugins/Manganelo.hpp index fd56b85..4ed976f 100644 --- a/plugins/Manganelo.hpp +++ b/plugins/Manganelo.hpp @@ -6,5 +6,6 @@ namespace QuickMedia { class Manganelo : public Plugin { public: SearchResult search(const std::string &text, std::vector> &result_items) override; + SuggestionResult update_search_suggestions(const std::string &text, std::vector> &result_items) override; }; } \ No newline at end of file diff --git a/plugins/Plugin.hpp b/plugins/Plugin.hpp index bc518a8..9d62356 100644 --- a/plugins/Plugin.hpp +++ b/plugins/Plugin.hpp @@ -21,18 +21,31 @@ namespace QuickMedia { NET_ERR }; + enum class SuggestionResult { + OK, + ERR, + NET_ERR + }; + enum class DownloadResult { OK, ERR, NET_ERR }; + struct CommandArg { + std::string option; + std::string value; + }; + class Plugin { public: virtual ~Plugin() = default; virtual SearchResult search(const std::string &text, std::vector> &result_items) = 0; + virtual SuggestionResult update_search_suggestions(const std::string &text, std::vector> &result_items); protected: - DownloadResult download_to_string(const std::string &url, std::string &result); + DownloadResult download_to_string(const std::string &url, std::string &result, const std::vector &additional_args = {}); + std::string url_param_encode(const std::string ¶m) const; }; } \ No newline at end of file diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp index ea2918d..073cb0c 100644 --- a/plugins/Youtube.hpp +++ b/plugins/Youtube.hpp @@ -6,5 +6,6 @@ namespace QuickMedia { class Youtube : public Plugin { public: SearchResult search(const std::string &text, std::vector> &result_items) override; + SuggestionResult update_search_suggestions(const std::string &text, std::vector> &result_items) override; }; } \ No newline at end of file -- cgit v1.2.3