aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-09-18 01:10:18 +0200
committerdec05eba <dec05eba@protonmail.com>2020-09-18 17:07:47 +0200
commit12c59fddcf1201536c3bee8db4e0d6ac8964fde6 (patch)
treeeeb7b5dcd1aa24599fb73743a840547c8d8035c8 /plugins
parent94d217c957183844c6267fa34d6b5778123f88f8 (diff)
Initial nyaa.si support
Diffstat (limited to 'plugins')
-rw-r--r--plugins/NyaaSi.hpp26
-rw-r--r--plugins/Plugin.hpp3
2 files changed, 29 insertions, 0 deletions
diff --git a/plugins/NyaaSi.hpp b/plugins/NyaaSi.hpp
new file mode 100644
index 0000000..428d8b5
--- /dev/null
+++ b/plugins/NyaaSi.hpp
@@ -0,0 +1,26 @@
+#pragma once
+
+#include "Plugin.hpp"
+#include <thread>
+#include <mutex>
+#include <condition_variable>
+
+namespace QuickMedia {
+ class Program;
+
+ class NyaaSi : public Plugin {
+ public:
+ NyaaSi();
+ ~NyaaSi() override;
+ PluginResult get_front_page(BodyItems &result_items) override;
+ SearchResult content_list_search(const std::string &list_url, const std::string &text, BodyItems &result_items) override;
+ 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 150; }
+ Page get_page_after_search() const override { return Page::CONTENT_LIST; }
+ bool search_is_filter() override { return true; }
+ bool content_list_search_is_filter() const override { return false; }
+ PluginResult get_content_list(const std::string &url, BodyItems &result_items) override;
+ PluginResult get_content_details(const std::string &list_url, const std::string &url, BodyItems &result_items) override;
+ };
+} \ No newline at end of file
diff --git a/plugins/Plugin.hpp b/plugins/Plugin.hpp
index 54ce67d..7d052c2 100644
--- a/plugins/Plugin.hpp
+++ b/plugins/Plugin.hpp
@@ -51,6 +51,7 @@ namespace QuickMedia {
}
virtual SearchResult search(const std::string &text, BodyItems &result_items);
virtual SuggestionResult update_search_suggestions(const std::string &text, BodyItems &result_items);
+ virtual SearchResult content_list_search(const std::string &list_url, const std::string &text, BodyItems &result_items);
virtual BodyItems get_related_media(const std::string &url);
virtual PluginResult get_content_list(const std::string &url, BodyItems &result_items) {
(void)url;
@@ -68,7 +69,9 @@ namespace QuickMedia {
virtual std::string autocomplete_search(const std::string &query) { return query; }
virtual int get_autocomplete_delay() const { return 100; }
virtual int get_search_delay() const = 0;
+ virtual int get_content_list_search_delay() const { return 350; }
virtual bool search_suggestion_is_search() const { return false; }
+ virtual bool content_list_search_is_filter() const { return true; }
virtual Page get_page_after_search() const = 0;
const std::string name;