diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Manganelo.hpp | 1 | ||||
-rw-r--r-- | plugins/Plugin.hpp | 15 | ||||
-rw-r--r-- | plugins/Youtube.hpp | 1 |
3 files changed, 16 insertions, 1 deletions
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<std::unique_ptr<BodyItem>> &result_items) override; + SuggestionResult update_search_suggestions(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &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<std::unique_ptr<BodyItem>> &result_items) = 0; + virtual SuggestionResult update_search_suggestions(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &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<CommandArg> &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<std::unique_ptr<BodyItem>> &result_items) override; + SuggestionResult update_search_suggestions(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) override; }; }
\ No newline at end of file |