diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-04-16 09:37:53 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-04-16 18:50:03 +0200 |
commit | ba4e62d55156f9b94b569b56b6382bbcf94b7d86 (patch) | |
tree | 1896a38bd43a39a4affcc0e2b4c8d3529fa58a53 /plugins/Manga.hpp | |
parent | ab36fbffef977b99cc03d0b77ac37bdc1b5705dc (diff) |
Convert mangatown and manganelos into a generic manga plugin
Revert for_each_page.. processing of manga instead of getting all pages.
Mangatown requires you to navigate page by page, cant predict
what a specific pages image url will be.
Diffstat (limited to 'plugins/Manga.hpp')
-rw-r--r-- | plugins/Manga.hpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/Manga.hpp b/plugins/Manga.hpp index 60e739b..5dfa800 100644 --- a/plugins/Manga.hpp +++ b/plugins/Manga.hpp @@ -14,27 +14,35 @@ namespace QuickMedia { class MangaImagesPage : public Page { public: - MangaImagesPage(Program *program, std::string manga_name, std::string chapter_name, std::string url) : Page(program), manga_name(std::move(manga_name)), chapter_name(std::move(chapter_name)), url(std::move(url)) {} + MangaImagesPage(Program *program, std::string manga_name, std::string chapter_name, std::string url) : Page(program), manga_name(std::move(manga_name)), chapter_name(std::move(chapter_name)), url(std::move(url)), chapter_num_pages(-1) {} virtual ~MangaImagesPage() = default; const char* get_title() const override { return chapter_name.c_str(); } PageTypez get_type() const override { return PageTypez::MANGA_IMAGES; } - virtual ImageResult get_page_image_urls(std::vector<std::string> &urls) = 0; + virtual ImageResult get_number_of_images(int &num_images) = 0; + virtual ImageResult for_each_page_in_chapter(PageCallback callback) = 0; virtual void change_chapter(std::string new_chapter_name, std::string new_url) { chapter_name = std::move(new_chapter_name); - url = std::move(new_url); + if(url != new_url) { + url = std::move(new_url); + chapter_image_urls.clear(); + chapter_num_pages = -1; + } } const std::string& get_chapter_name() const { return chapter_name; } const std::string& get_url() const { return url; } + // TODO: Remove and use plugin name instead virtual const char* get_service_name() const = 0; const std::string manga_name; protected: std::string chapter_name; std::string url; + std::vector<std::string> chapter_image_urls; + int chapter_num_pages; }; class MangaChaptersPage : public TrackablePage { |