aboutsummaryrefslogtreecommitdiff
path: root/plugins/MangaGeneric.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-04-26 18:37:00 +0200
committerdec05eba <dec05eba@protonmail.com>2021-04-26 18:37:00 +0200
commit76e1aebbe075287a8297194b38343467c76dd964 (patch)
tree0afa513ab80f2247686bbb62e5d2a6fa9aabc70c /plugins/MangaGeneric.hpp
parent8b5901000e9073d9ff6a3a86cd7c0e0172de7f5a (diff)
Fix soundcloud (fetch client id), add authors to mangakatana, some other fixes
Diffstat (limited to 'plugins/MangaGeneric.hpp')
-rw-r--r--plugins/MangaGeneric.hpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/plugins/MangaGeneric.hpp b/plugins/MangaGeneric.hpp
index 98d06d8..a03756d 100644
--- a/plugins/MangaGeneric.hpp
+++ b/plugins/MangaGeneric.hpp
@@ -23,13 +23,19 @@ namespace QuickMedia {
const char *field_name = nullptr;
};
- // If |field_contains| is null, then any matching query is added. If |field_name| is "text", then the inner text is used.
struct ThumbnailQuery {
const char *html_query = nullptr;
const char *field_name = nullptr;
const char *field_contains = nullptr;
};
+ struct AuthorsQuery {
+ const char *html_query = nullptr;
+ const char *title_field = nullptr;
+ const char *url_field = nullptr;
+ const char *url_contains = nullptr;
+ };
+
struct ListChaptersQuery {
const char *html_query = nullptr;
const char *title_field = nullptr;
@@ -92,6 +98,7 @@ namespace QuickMedia {
const char* get_title() const override { return "All"; }
bool search_is_filter() override { return false; }
SearchResult search(const std::string &str, BodyItems &result_items) override;
+ PluginResult get_page(const std::string &url, BodyItems &result_items);
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;
sf::Vector2i get_thumbnail_max_size() override { return sf::Vector2i(101, 141); };
@@ -106,6 +113,9 @@ namespace QuickMedia {
MangaGenericSearchPage& description_handler(std::vector<DescriptionQuery> queries);
// This is optional.
MangaGenericSearchPage& thumbnail_handler(std::vector<ThumbnailQuery> queries);
+ // If |url_contains| is null, then any matching query is added. If |title_field| is "text", then the inner text is used.
+ // This is optional.
+ MangaGenericSearchPage& authors_handler(const char *html_query, const char *title_field, const char *url_field, const char *url_contains);
// If |url_contains| is null, then any matching query is added. If |title_field| is "text", then the inner text is used.
// This is required.
@@ -141,6 +151,7 @@ namespace QuickMedia {
std::vector<TextQuery> text_queries;
std::vector<DescriptionQuery> description_queries;
std::vector<ThumbnailQuery> thumbnail_queries;
+ AuthorsQuery authors_query;
ListChaptersQuery list_chapters_query;
ListPageQuery list_page_query;
MangaIdExtractor manga_id_extractor;
@@ -162,6 +173,18 @@ namespace QuickMedia {
bool fail_on_http_error;
};
+ class MangaGenericCreatorPage : public LazyFetchPage {
+ public:
+ MangaGenericCreatorPage(Program *program, MangaGenericSearchPage *search_page, Creator creator) : LazyFetchPage(program), search_page(search_page), creator(std::move(creator)) {}
+ const char* get_title() const override { return creator.name.c_str(); }
+ PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult lazy_fetch(BodyItems &result_items) override;
+ sf::Vector2i get_thumbnail_max_size() override { return sf::Vector2i(101, 141); };
+ private:
+ MangaGenericSearchPage *search_page;
+ Creator creator;
+ };
+
class MangaGenericImagesPage : public MangaImagesPage {
public:
MangaGenericImagesPage(Program *program, std::string manga_name, std::string chapter_name, std::string url, const char *service_name, const std::string &website_url, const ListPageQuery *list_page_query, bool fail_on_http_error) :