From 12c59fddcf1201536c3bee8db4e0d6ac8964fde6 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 18 Sep 2020 01:10:18 +0200 Subject: Initial nyaa.si support --- plugins/NyaaSi.hpp | 26 ++++++++++++++++++++++++++ plugins/Plugin.hpp | 3 +++ 2 files changed, 29 insertions(+) create mode 100644 plugins/NyaaSi.hpp (limited to 'plugins') 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 +#include +#include + +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; -- cgit v1.2.3