aboutsummaryrefslogtreecommitdiff
path: root/plugins/NyaaSi.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/NyaaSi.hpp')
-rw-r--r--plugins/NyaaSi.hpp46
1 files changed, 25 insertions, 21 deletions
diff --git a/plugins/NyaaSi.hpp b/plugins/NyaaSi.hpp
index 97b69e7..bad5863 100644
--- a/plugins/NyaaSi.hpp
+++ b/plugins/NyaaSi.hpp
@@ -1,29 +1,33 @@
#pragma once
-#include "Plugin.hpp"
-#include <thread>
-#include <mutex>
-#include <condition_variable>
+#include "Page.hpp"
namespace QuickMedia {
- class Program;
+ class NyaaSiCategoryPage : public Page {
+ public:
+ NyaaSiCategoryPage(Program *program) : Page(program) {}
+ const char* get_title() const override { return "Select category"; }
+ PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ void get_categories(BodyItems &result_items);
+ };
+
+ class NyaaSiSearchPage : public Page {
+ public:
+ NyaaSiSearchPage(Program *program, std::string category_name, std::string category_id) : Page(program), category_name(std::move(category_name)), category_id(std::move(category_id)) {}
+ const char* get_title() const override { return category_name.c_str(); }
+ bool search_is_filter() override { return false; }
+ SearchResult search(const std::string &str, BodyItems &result_items) override;
+ PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override;
+ PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+
+ const std::string category_name;
+ const std::string category_id;
+ };
- class NyaaSi : public Plugin {
+ class NyaaSiTorrentPage : public Page {
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;
- SearchResult content_list_search_page(const std::string &list_url, const std::string &text, int page, 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;
- private:
- SearchResult search_page(const std::string &list_url, const std::string &text, int page, BodyItems &result_items);
+ NyaaSiTorrentPage(Program *program) : Page(program) {}
+ const char* get_title() const override { return "Torrent"; }
+ PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
};
} \ No newline at end of file