aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-08-03 01:52:27 +0200
committerdec05eba <dec05eba@protonmail.com>2019-08-03 01:52:30 +0200
commit117eb25e36ac3b1e1ba18cc9f1e177016c076f34 (patch)
tree04bd7fe4662af4c8b5d352098430c489082e71aa /plugins
parent65cf7681a04f2511db8c7829e9828b53a6676c88 (diff)
Add search suggestions for youtube & manganelo
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Manganelo.hpp1
-rw-r--r--plugins/Plugin.hpp15
-rw-r--r--plugins/Youtube.hpp1
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 &param) 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