1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#pragma once
#include "Page.hpp"
namespace QuickMedia {
void get_nyaa_si_categories(BodyItems &result_items);
void get_sukebei_categories(BodyItems &result_items);
class NyaaSiCategoryPage : public Page {
public:
NyaaSiCategoryPage(Program *program, bool is_sukebei) : Page(program), is_sukebei(is_sukebei) {}
const char* get_title() const override { return is_sukebei ? "Select sukebei category" : "Select nyaa.si category"; }
PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
bool clear_search_after_submit() override { return true; }
const bool is_sukebei;
};
enum class NyaaSiSortType {
SIZE_DESC,
UPLOAD_DATE_DESC,
SEEDERS_DESC,
LEECHERS_DESC,
DOWNLOADS_DESC,
SIZE_ASC,
UPLOAD_DATE_ASC,
SEEDERS_ASC,
LEECHERS_ASC,
DOWNLOADS_ASC
};
class NyaaSiSearchPage : public Page {
public:
NyaaSiSearchPage(Program *program, std::string category_name, std::string category_id, std::string domain);
const char* get_title() const override { return title.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;
void set_sort_type(NyaaSiSortType sort_type);
const std::string category_name;
const std::string category_id;
const std::string domain;
private:
NyaaSiSortType sort_type = NyaaSiSortType::UPLOAD_DATE_DESC;
std::string title;
};
class NyaaSiSortOrderPage : public Page {
public:
NyaaSiSortOrderPage(Program *program, Body *body, NyaaSiSearchPage *search_page) : Page(program), body(body), search_page(search_page) {}
const char* get_title() const override { return "Sort order"; }
PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
bool submit_is_async() override { return false; }
private:
Body *body;
NyaaSiSearchPage *search_page;
};
class NyaaSiTorrentPage : public Page {
public:
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;
bool submit_is_async() override { return false; }
};
}
|