aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-08-08 04:13:03 +0200
committerdec05eba <dec05eba@protonmail.com>2019-08-08 04:13:06 +0200
commit3c9ca2c97ae7a2b39bfe5c5e8a9d7941f9fb1525 (patch)
tree04ddde3af4a0355149a755c333c63cf82aa875f0 /plugins
parent81d2e6162f06a01ac36878a2ab0c6efdff461755 (diff)
Youtube: use real search for search suggestions (better results, thumbnails, directly to result)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Manganelo.hpp6
-rw-r--r--plugins/Plugin.hpp5
-rw-r--r--plugins/Youtube.hpp8
3 files changed, 13 insertions, 6 deletions
diff --git a/plugins/Manganelo.hpp b/plugins/Manganelo.hpp
index 01311e1..5720199 100644
--- a/plugins/Manganelo.hpp
+++ b/plugins/Manganelo.hpp
@@ -5,12 +5,14 @@
namespace QuickMedia {
class Manganelo : public Plugin {
public:
- SearchResult search(const std::string &url, std::vector<std::unique_ptr<BodyItem>> &result_items, Page &next_page) override;
+ SearchResult search(const std::string &url, 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;
ImageResult get_image_by_index(const std::string &url, int index, std::string &image_data);
ImageResult get_number_of_images(const std::string &url, int &num_images);
bool search_suggestions_has_thumbnails() const override { return true; }
- bool search_results_has_thumbnails() const override { return true; }
+ bool search_results_has_thumbnails() const override { return false; }
+ int get_search_delay() const override { return 150; }
+ Page get_page_after_search() const override { return Page::EPISODE_LIST; }
private:
// Caches url. If the same url is requested multiple times then the cache is used
ImageResult get_image_urls_for_chapter(const std::string &url);
diff --git a/plugins/Plugin.hpp b/plugins/Plugin.hpp
index 3df53ca..54d49e5 100644
--- a/plugins/Plugin.hpp
+++ b/plugins/Plugin.hpp
@@ -44,11 +44,14 @@ namespace QuickMedia {
public:
virtual ~Plugin() = default;
- virtual SearchResult search(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items, Page &next_page) = 0;
+ virtual SearchResult search(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items);
virtual SuggestionResult update_search_suggestions(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items);
virtual std::vector<std::unique_ptr<BodyItem>> get_related_media(const std::string &url);
virtual bool search_suggestions_has_thumbnails() const = 0;
virtual bool search_results_has_thumbnails() const = 0;
+ virtual int get_search_delay() const = 0;
+ virtual bool search_suggestion_is_search() const { return false; }
+ virtual Page get_page_after_search() const = 0;
protected:
std::string url_param_encode(const std::string &param) const;
};
diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp
index e8cc2c2..64a0d6b 100644
--- a/plugins/Youtube.hpp
+++ b/plugins/Youtube.hpp
@@ -5,10 +5,12 @@
namespace QuickMedia {
class Youtube : public Plugin {
public:
- SearchResult search(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items, Page &next_page) override;
SuggestionResult update_search_suggestions(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) override;
std::vector<std::unique_ptr<BodyItem>> get_related_media(const std::string &url) override;
- bool search_suggestions_has_thumbnails() const override { return false; }
- bool search_results_has_thumbnails() const override { return true; }
+ bool search_suggestions_has_thumbnails() const override { return true; }
+ bool search_results_has_thumbnails() const override { return false; }
+ int get_search_delay() const override { return 250; }
+ bool search_suggestion_is_search() const override { return true; }
+ Page get_page_after_search() const override { return Page::VIDEO_CONTENT; }
};
} \ No newline at end of file