diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-05-03 01:48:19 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-05-03 01:48:19 +0200 |
commit | ab5065e541cb6f84b11062892ce25f033c7fa82d (patch) | |
tree | 6b593e19f035407687e5c2c6a7f951b063fb7a4a /plugins | |
parent | d1f1683bc44ebc51b45083280adabf60d0dd27d7 (diff) |
Add readm.org
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/ImageBoard.hpp | 1 | ||||
-rw-r--r-- | plugins/MangaGeneric.hpp | 37 |
2 files changed, 18 insertions, 20 deletions
diff --git a/plugins/ImageBoard.hpp b/plugins/ImageBoard.hpp index b37448b..6b287b6 100644 --- a/plugins/ImageBoard.hpp +++ b/plugins/ImageBoard.hpp @@ -10,6 +10,7 @@ namespace QuickMedia { //FILE_TOO_LARGE, NO_SUCH_FILE, FILE_TYPE_NOT_ALLOWED, + UPLOAD_FAILED, ERR }; diff --git a/plugins/MangaGeneric.hpp b/plugins/MangaGeneric.hpp index e313c97..dcd3544 100644 --- a/plugins/MangaGeneric.hpp +++ b/plugins/MangaGeneric.hpp @@ -4,13 +4,25 @@ #include <functional> namespace QuickMedia { + struct MangaFormData { + const char *key; + const char *value; + }; + + struct MangaFormDataStr { + const char *key; + std::string value; + }; + + using SearchQueryJsonHandler = std::function<BodyItems(Json::Value&)>; struct SearchQuery { const char *search_template = nullptr; int page_start = 0; + std::vector<MangaFormData> form_data; + bool is_post = false; + SearchQueryJsonHandler json_handler = nullptr; }; - // If |url_contains| is null, then any matching query is added. If |title_field| is "text", then the inner text is used. - // If |url_field| is null, then the current page is used instead. struct TextQuery { const char *html_query = nullptr; const char *title_field = nullptr; @@ -98,44 +110,29 @@ namespace QuickMedia { const char* get_title() const override { return "Search"; } 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 &url, bool is_post, const std::vector<MangaFormDataStr> &form_data, 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); }; - // Add a %s where the search query should be inserted into |search_template| and add a %p where the page number should be inserted, for example: - // example.com/search?q=%s&page=%p - // This is required. MangaGenericSearchPage& search_handler(const char *search_template, int page_start); - // This is required. + MangaGenericSearchPage& search_post_handler(const char *url, std::vector<MangaFormData> form_data, SearchQueryJsonHandler result_handler); MangaGenericSearchPage& text_handler(std::vector<TextQuery> queries); - // This is optional. MangaGenericSearchPage& description_handler(std::vector<DescriptionQuery> queries); - // This is optional. MangaGenericSearchPage& thumbnail_handler(std::vector<ThumbnailQuery> queries); - // This is optional. MangaGenericSearchPage& authors_handler(std::vector<AuthorsQuery> 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 required. + MangaGenericSearchPage& list_chapters_handler(const char *html_query, const char *title_field, const char *url_field, const char *url_contains); - // If |field_contains| is null, then any matching query is added. If |field_name| is "text", then the inner text is used. - // This is optional. MangaGenericSearchPage& list_chapters_uploaded_time_handler(const char *html_query, const char *field_name, const char *field_contains); - // If |field_contains| is null, then any matching query is added. If |field_name| is "text", then the inner text is used. - // This or |list_page_images_pagination_handler| or |list_page_images_custom_handler| is required. MangaGenericSearchPage& list_page_images_handler(const char *html_query, const char *field_name, const char *field_contains, ListPageImagesQueryPost post_handler = nullptr); - // If |image_field_contains| is null, then any matching query is added. If |pages_field_name| or |image_field_name| is "text", then the inner text is used. - // The last matching pages html query item is chosen as the number of pages. - // This or |list_page_images_handler| or |list_page_images_custom_handler| is required. MangaGenericSearchPage& list_page_images_pagination_handler( const char *pages_html_query, const char *pages_field_name, const char *image_html_query, const char *image_field_name, const char *image_field_contains, const char *next_page_html_query, const char *next_page_field_name, const char *next_page_field_contains); - // This or |list_page_images_handler| or |list_page_images_pagination_handler| is required. MangaGenericSearchPage& list_page_images_custom_handler(ListPageCustomHandler handler); // For example: mangasite.com/manga/204353&f=23 |