aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-08-16 21:13:24 +0200
committerdec05eba <dec05eba@protonmail.com>2021-08-16 21:13:24 +0200
commit5cc735b22570f1667d62958e59ce4910b529f5af (patch)
tree75128a8926a48a612bc892d266032bd7afd9c2cf /plugins
parentde4825e548b990493b372237cbef9a790bf114c4 (diff)
Add MyAnimeList (wip)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/HotExamples.hpp4
-rw-r--r--plugins/Info.hpp2
-rw-r--r--plugins/MangaCombined.hpp1
-rw-r--r--plugins/MangaGeneric.hpp2
-rw-r--r--plugins/Mangadex.hpp1
-rw-r--r--plugins/Manganelo.hpp2
-rw-r--r--plugins/Matrix.hpp8
-rw-r--r--plugins/MediaGeneric.hpp1
-rw-r--r--plugins/MyAnimeList.hpp36
-rw-r--r--plugins/NyaaSi.hpp4
-rw-r--r--plugins/Page.hpp4
11 files changed, 46 insertions, 19 deletions
diff --git a/plugins/HotExamples.hpp b/plugins/HotExamples.hpp
index 154f1ab..73bc150 100644
--- a/plugins/HotExamples.hpp
+++ b/plugins/HotExamples.hpp
@@ -10,7 +10,7 @@ namespace QuickMedia {
HotExamplesLanguageSelectPage(Program *program) : Page(program) {}
const char* get_title() const override { return "Select language"; }
PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
- bool submit_is_async() override { return false; }
+ bool submit_is_async() const override { return false; }
};
class HotExamplesSearchPage : public Page {
@@ -29,7 +29,7 @@ namespace QuickMedia {
HotExamplesCodeExamplesPage(Program *program, std::string title) : Page(program), title(std::move(title)) {}
const char* get_title() const override { return title.c_str(); }
PluginResult submit(const std::string&, const std::string&, std::vector<Tab>&) override { return PluginResult::OK; }
- bool submit_is_async() override { return false; }
+ bool submit_is_async() const override { return false; }
private:
std::string title;
};
diff --git a/plugins/Info.hpp b/plugins/Info.hpp
index 4ab39f5..af62282 100644
--- a/plugins/Info.hpp
+++ b/plugins/Info.hpp
@@ -8,7 +8,7 @@ namespace QuickMedia {
InfoPage(Program *program) : Page(program) {}
const char* get_title() const override { return "Info"; }
PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
- bool submit_is_async() override { return false; }
+ bool submit_is_async() const override { return false; }
static std::shared_ptr<BodyItem> add_url(const std::string &url);
static std::shared_ptr<BodyItem> add_reverse_image_search(const std::string &image_url);
diff --git a/plugins/MangaCombined.hpp b/plugins/MangaCombined.hpp
index dafc884..39a143c 100644
--- a/plugins/MangaCombined.hpp
+++ b/plugins/MangaCombined.hpp
@@ -22,7 +22,6 @@ namespace QuickMedia {
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;
- sf::Vector2i get_thumbnail_max_size() override { return sf::Vector2i(101, 141); };
void cancel_operation() override;
private:
std::vector<MangaPlugin> search_pages;
diff --git a/plugins/MangaGeneric.hpp b/plugins/MangaGeneric.hpp
index dcd3544..2f65762 100644
--- a/plugins/MangaGeneric.hpp
+++ b/plugins/MangaGeneric.hpp
@@ -113,7 +113,6 @@ namespace QuickMedia {
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); };
MangaGenericSearchPage& search_handler(const char *search_template, int page_start);
MangaGenericSearchPage& search_post_handler(const char *url, std::vector<MangaFormData> form_data, SearchQueryJsonHandler result_handler);
@@ -175,7 +174,6 @@ namespace QuickMedia {
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;
diff --git a/plugins/Mangadex.hpp b/plugins/Mangadex.hpp
index 7497b06..cd81c44 100644
--- a/plugins/Mangadex.hpp
+++ b/plugins/Mangadex.hpp
@@ -16,7 +16,6 @@ namespace QuickMedia {
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;
- sf::Vector2i get_thumbnail_max_size() override { return sf::Vector2i(101, 141); };
ChapterImageUrls chapter_image_urls;
private:
diff --git a/plugins/Manganelo.hpp b/plugins/Manganelo.hpp
index 7cf3420..62fd9bf 100644
--- a/plugins/Manganelo.hpp
+++ b/plugins/Manganelo.hpp
@@ -10,7 +10,6 @@ namespace QuickMedia {
bool search_is_filter() override { return false; }
SearchResult search(const std::string &str, 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); };
};
class ManganeloChaptersPage : public MangaChaptersPage {
@@ -28,7 +27,6 @@ namespace QuickMedia {
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:
Creator creator;
};
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp
index f589db5..5292414 100644
--- a/plugins/Matrix.hpp
+++ b/plugins/Matrix.hpp
@@ -319,7 +319,7 @@ namespace QuickMedia {
const char* get_title() const override { return title.c_str(); }
PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
- bool submit_is_async() override { return false; }
+ bool submit_is_async() const override { return false; }
bool clear_search_after_submit() override { return true; }
void add_body_item(std::shared_ptr<BodyItem> body_item);
@@ -349,7 +349,7 @@ namespace QuickMedia {
MatrixRoomTagsPage(Program *program, Body *body) : Page(program), body(body) {}
const char* get_title() const override { return "Tags"; }
PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
- bool submit_is_async() override { return false; }
+ bool submit_is_async() const override { return false; }
bool clear_search_after_submit() override { return true; }
void add_room_body_item_to_tag(std::shared_ptr<BodyItem> body_item, const std::string &tag);
@@ -380,7 +380,7 @@ namespace QuickMedia {
const char* get_title() const override { return title.c_str(); }
PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
- bool submit_is_async() override { return false; }
+ bool submit_is_async() const override { return false; }
bool clear_search_after_submit() override { return true; }
void add_body_item(std::shared_ptr<BodyItem> body_item);
@@ -484,7 +484,7 @@ namespace QuickMedia {
PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
bool is_ready() override;
- bool submit_is_async() override { return false; }
+ bool submit_is_async() const override { return false; }
bool clear_search_after_submit() override { return true; }
void add_notification(MatrixNotification notification);
diff --git a/plugins/MediaGeneric.hpp b/plugins/MediaGeneric.hpp
index 8885db2..fce0e97 100644
--- a/plugins/MediaGeneric.hpp
+++ b/plugins/MediaGeneric.hpp
@@ -40,7 +40,6 @@ namespace QuickMedia {
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;
- sf::Vector2i get_thumbnail_max_size() override { return thumbnail_max_size; };
PluginResult get_related_media(const std::string &url, BodyItems &result_items);
diff --git a/plugins/MyAnimeList.hpp b/plugins/MyAnimeList.hpp
new file mode 100644
index 0000000..c88e94f
--- /dev/null
+++ b/plugins/MyAnimeList.hpp
@@ -0,0 +1,36 @@
+#pragma once
+
+#include "Page.hpp"
+
+namespace QuickMedia {
+ class MyAnimeListSearchPage : public Page {
+ public:
+ MyAnimeListSearchPage(Program *program) : Page(program) {}
+ const char* get_title() const override { return "Search for anime or manga"; }
+ bool search_is_filter() override { return false; }
+ SearchResult search(const std::string &str, BodyItems &result_items) override;
+ PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ };
+
+ class MyAnimeListDetailsPage : public LazyFetchPage {
+ public:
+ MyAnimeListDetailsPage(Program *program, std::string url) : LazyFetchPage(program), url(std::move(url)) {}
+ const char* get_title() const override { return "Details"; }
+ bool submit_is_async() const override { return false; }
+ PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult lazy_fetch(BodyItems &result_items) override;
+ private:
+ std::string url;
+ };
+
+ class MyAnimeListRecommendationsPage : public LazyFetchPage {
+ public:
+ MyAnimeListRecommendationsPage(Program *program, std::string url) : LazyFetchPage(program), url(std::move(url)) {}
+ const char* get_title() const override { return "Recommendations"; }
+ bool submit_is_async() const override { return false; }
+ PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult lazy_fetch(BodyItems &result_items) override;
+ private:
+ std::string url;
+ };
+} \ No newline at end of file
diff --git a/plugins/NyaaSi.hpp b/plugins/NyaaSi.hpp
index 6f161ac..f113544 100644
--- a/plugins/NyaaSi.hpp
+++ b/plugins/NyaaSi.hpp
@@ -54,7 +54,7 @@ namespace QuickMedia {
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; }
+ bool submit_is_async() const override { return false; }
private:
Body *body;
NyaaSiSearchPage *search_page;
@@ -65,6 +65,6 @@ namespace QuickMedia {
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; }
+ bool submit_is_async() const override { return false; }
};
} \ No newline at end of file
diff --git a/plugins/Page.hpp b/plugins/Page.hpp
index 9d5bade..8d033e1 100644
--- a/plugins/Page.hpp
+++ b/plugins/Page.hpp
@@ -41,7 +41,7 @@ namespace QuickMedia {
return PluginResult::ERR;
}
// Override and return false to make submit run in the main (ui) thread
- virtual bool submit_is_async() { return true; }
+ virtual bool submit_is_async() const { return true; }
virtual bool clear_search_after_submit() { return false; }
virtual PluginResult submit_suggestion(const std::string &title, const std::string &url, BodyItems &result_items) {
(void)title;
@@ -73,8 +73,6 @@ namespace QuickMedia {
std::unique_ptr<SearchBar> create_search_bar(const std::string &placeholder_text, int search_delay);
bool load_manga_content_storage(const char *service_name, const std::string &manga_title, const std::string &manga_id);
-
- virtual sf::Vector2i get_thumbnail_max_size() { return sf::Vector2i(250, 141); };
Program *program;
std::shared_ptr<BodyItem> submit_body_item; // TODO: Remove this